/**
* The <code>default</code> implementation of Enumertaion Type Definition interface.
- *
+ *
* @see EnumTypeDefinition
*/
-public class EnumerationType implements EnumTypeDefinition {
-
+public final class EnumerationType implements EnumTypeDefinition {
private final QName name = BaseTypes.constructQName("enumeration");
- private final SchemaPath path = BaseTypes.schemaPath(name);
+ private final SchemaPath path;
private final String description = "The enumeration built-in type represents values from a set of assigned names.";
private final String reference = "https://tools.ietf.org/html/rfc6020#section-9.6";
- private final List<EnumPair> defaultEnum;
+ private final EnumPair defaultEnum;
private final List<EnumPair> enums;
- private String units = "";
+ private final String units = "";
+ private final EnumTypeDefinition baseType;
- public EnumerationType(final List<EnumPair> enums) {
+ public EnumerationType(final SchemaPath path, final List<EnumPair> enums) {
super();
+ this.path = path;
this.enums = Collections.unmodifiableList(enums);
- defaultEnum = Collections.emptyList();
+ this.defaultEnum = null;
+ this.baseType = this;
}
- public EnumerationType(final List<EnumPair> defaultEnum,
- final List<EnumPair> enums, final String units) {
+ public EnumerationType(final SchemaPath path, final EnumPair defaultEnum,
+ final List<EnumPair> enums) {
super();
- this.defaultEnum = Collections.unmodifiableList(defaultEnum);
+ this.path = path;
+ this.baseType = this;
+ this.defaultEnum = defaultEnum;
this.enums = Collections.unmodifiableList(enums);
- this.units = units;
}
/*
* (non-Javadoc)
- *
+ *
* @see org.opendaylight.controller.yang.model.api.TypeDefinition#getBaseType()
*/
@Override
public EnumTypeDefinition getBaseType() {
- return this;
+ return baseType;
}
/*
* (non-Javadoc)
- *
+ *
* @see org.opendaylight.controller.yang.model.api.TypeDefinition#getUnits()
*/
@Override
/*
* (non-Javadoc)
- *
+ *
* @see org.opendaylight.controller.yang.model.api.TypeDefinition#getDefaultValue()
*/
@Override
/*
* (non-Javadoc)
- *
+ *
* @see org.opendaylight.controller.yang.model.api.SchemaNode#getQName()
*/
@Override
/*
* (non-Javadoc)
- *
+ *
* @see org.opendaylight.controller.yang.model.api.SchemaNode#getPath()
*/
@Override
/*
* (non-Javadoc)
- *
+ *
* @see org.opendaylight.controller.yang.model.api.SchemaNode#getDescription()
*/
@Override
/*
* (non-Javadoc)
- *
+ *
* @see org.opendaylight.controller.yang.model.api.SchemaNode#getReference()
*/
@Override
/*
* (non-Javadoc)
- *
+ *
* @see org.opendaylight.controller.yang.model.api.SchemaNode#getStatus()
*/
@Override
/*
* (non-Javadoc)
- *
+ *
* @see org.opendaylight.controller.yang.model.base.type.api.EnumTypeDefinition#getValues()
*/
@Override