diff --git a/src/main/java/org/gbif/ipt/model/SubSchemaRequirement.java b/src/main/java/org/gbif/ipt/model/SubSchemaRequirement.java new file mode 100644 index 0000000000..02df95c602 --- /dev/null +++ b/src/main/java/org/gbif/ipt/model/SubSchemaRequirement.java @@ -0,0 +1,87 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.gbif.ipt.model; + +import java.util.List; +import java.util.Objects; +import java.util.StringJoiner; + +/** + * Represents what {@link DataSubschema} are required in the data package. + */ +public class SubSchemaRequirement { + + private List required; + private List optional; + private List anyOf; + private List oneOf; + + public List getRequired() { + return required; + } + + public void setRequired(List required) { + this.required = required; + } + + public List getOptional() { + return optional; + } + + public void setOptional(List optional) { + this.optional = optional; + } + + public List getAnyOf() { + return anyOf; + } + + public void setAnyOf(List anyOf) { + this.anyOf = anyOf; + } + + public List getOneOf() { + return oneOf; + } + + public void setOneOf(List oneOf) { + this.oneOf = oneOf; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + SubSchemaRequirement that = (SubSchemaRequirement) o; + return Objects.equals(required, that.required) + && Objects.equals(optional, that.optional) + && Objects.equals(anyOf, that.anyOf) + && Objects.equals(oneOf, that.oneOf); + } + + @Override + public int hashCode() { + return Objects.hash(required, optional, anyOf, oneOf); + } + + @Override + public String toString() { + return new StringJoiner(", ", SubSchemaRequirement.class.getSimpleName() + "[", "]") + .add("required=" + required) + .add("optional=" + optional) + .add("anyOf=" + anyOf) + .add("oneOf=" + oneOf) + .toString(); + } +}