package org.opendaylight.yangtools.yang.model.api.type;
import java.util.List;
+import java.util.Objects;
import javax.annotation.Nonnull;
import org.opendaylight.yangtools.yang.model.api.DocumentedNode;
import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
* type.
*/
public interface EnumTypeDefinition extends TypeDefinition<EnumTypeDefinition> {
- /**
- * Returns all enumeration values.
- *
- * @return list of <code>EnumPair</code> type instastances which contain the
- * data about all individual enumeration pairs of
- * <code>enumeration</code> YANG built-in type
- */
- @Nonnull List<EnumPair> getValues();
-
/**
* Contains the methods for accessing the data about the concrete
* enumeration item which represents <code>enum</code> YANG type.
*/
int getValue();
}
+
+ /**
+ * Returns all enumeration values.
+ *
+ * @return list of <code>EnumPair</code> type instastances which contain the
+ * data about all individual enumeration pairs of
+ * <code>enumeration</code> YANG built-in type
+ */
+ @Nonnull List<EnumPair> getValues();
+
+ static boolean equals(final EnumTypeDefinition type, final Object obj) {
+ if (type == obj) {
+ return true;
+ }
+
+ final EnumTypeDefinition other = TypeDefinitions.castIfEquals(EnumTypeDefinition.class, type, obj);
+ return other != null && type.getValues().equals(other.getValues());
+ }
+
+ static int hashCode(final EnumTypeDefinition type) {
+ return Objects.hash(type.getPath(), type.getUnknownSchemaNodes(), type.getBaseType(),
+ type.getUnits().orElse(null),
+ type.getDefaultValue(), type.getValues());
+ }
+
+ static String toString(final EnumTypeDefinition type) {
+ return TypeDefinitions.toStringHelper(type).add("values", type.getValues()).toString();
+ }
}