X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fsal%2Fyang-prototype%2Fyang%2Fyang-model-util%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fyang%2Fmodel%2Futil%2FDecimal64.java;h=1387da9b1cf5ead763a14d21b8b3d784ecc6ceb5;hb=970fb91c60c15a9b57e078f81aab7dde903addb9;hp=a1073c60cf598d768d3cfd488896d81f0bb82ed2;hpb=4ce0f6630bc576b97c8c9a08848aafb6e90a75b0;p=controller.git diff --git a/opendaylight/sal/yang-prototype/yang/yang-model-util/src/main/java/org/opendaylight/controller/yang/model/util/Decimal64.java b/opendaylight/sal/yang-prototype/yang/yang-model-util/src/main/java/org/opendaylight/controller/yang/model/util/Decimal64.java index a1073c60cf..1387da9b1c 100644 --- a/opendaylight/sal/yang-prototype/yang/yang-model-util/src/main/java/org/opendaylight/controller/yang/model/util/Decimal64.java +++ b/opendaylight/sal/yang-prototype/yang/yang-model-util/src/main/java/org/opendaylight/controller/yang/model/util/Decimal64.java @@ -21,16 +21,15 @@ import org.opendaylight.controller.yang.model.api.type.RangeConstraint; /** * The default implementation of Decimal Type Definition interface. - * - * + * + * * @see DecimalTypeDefinition */ -public class Decimal64 implements DecimalTypeDefinition { - +public final class Decimal64 implements DecimalTypeDefinition { private final QName name = BaseTypes.constructQName("decimal64"); private final SchemaPath path; - private String units = ""; - private BigDecimal defaultValue = null; + private final String units = ""; + private final BigDecimal defaultValue = null; private final String description = "The decimal64 type represents a subset of the real numbers, which can " + "be represented by decimal numerals. The value space of decimal64 is the set of numbers that can " @@ -41,6 +40,7 @@ public class Decimal64 implements DecimalTypeDefinition { private final List rangeStatements; private final Integer fractionDigits; + private final DecimalTypeDefinition baseType; /** * Default Decimal64 Type Constructor.
@@ -52,108 +52,28 @@ public class Decimal64 implements DecimalTypeDefinition { * inclusively as defined interface {@link DecimalTypeDefinition}
* If the fraction digits are not defined inner the definition boundaries * the constructor will throw {@link IllegalArgumentException} - * + * + * @param path * @param fractionDigits * integer between 1 and 18 inclusively - * + * * @see DecimalTypeDefinition * @exception IllegalArgumentException */ - public Decimal64(final Integer fractionDigits) { - super(); + public Decimal64(final SchemaPath path, final Integer fractionDigits) { if (!((fractionDigits.intValue() > 1) && (fractionDigits.intValue() <= 18))) { throw new IllegalArgumentException( "The fraction digits outside of boundaries. Fraction digits MUST be integer between 1 and 18 inclusively"); } this.fractionDigits = fractionDigits; rangeStatements = defaultRangeStatements(); - this.path = BaseTypes.schemaPath(name); - } - - /** - * Decimal64 Type Constructor.
- * - * If parameter Range Statements is null or - * defined as empty List the constructor automatically assigns - * the boundaries as min and max value defined for Decimal64 in [RFC-6020] The - * decimal64 Built-In Type
- *
- * The fractions digits MUST be defined as integer between 1 and 18 - * inclusively as defined interface {@link DecimalTypeDefinition}
- * If the fraction digits are not defined inner the definition boundaries - * the constructor will throw {@link IllegalArgumentException} - * - * @param rangeStatements - * Range Constraint Statements - * @param fractionDigits - * integer between 1 and 18 inclusively - * @exception IllegalArgumentException - */ - public Decimal64(final List rangeStatements, - Integer fractionDigits) { - super(); - if (!((fractionDigits.intValue() > 1) && (fractionDigits.intValue() <= 18))) { - throw new IllegalArgumentException( - "The fraction digits outside of boundaries. Fraction digits MUST be integer between 1 and 18 inclusively"); - } - if (rangeStatements == null || rangeStatements.isEmpty()) { - this.rangeStatements = defaultRangeStatements(); - } else { - this.rangeStatements = Collections.unmodifiableList(rangeStatements); - } - this.fractionDigits = fractionDigits; - this.path = BaseTypes.schemaPath(name); - } - - /** - * Decimal64 Type Constructor.
- * If parameter Range Statements is null or - * defined as empty List the constructor automatically assigns - * the boundaries as min and max value defined for Decimal64 in [RFC-6020] The - * decimal64 Built-In Type
- *
- * The fractions digits MUST be defined as integer between 1 and 18 - * inclusively as defined interface {@link DecimalTypeDefinition}
- * If the fraction digits are not defined inner the definition boundaries - * the constructor will throw {@link IllegalArgumentException} - * - * @param units - * units associated with the type - * @param defaultValue - * Default Value for type - * @param rangeStatements - * Range Constraint Statements - * @param fractionDigits - * integer between 1 and 18 inclusively - * - * @exception IllegalArgumentException - */ - public Decimal64(final String units, final BigDecimal defaultValue, - final List rangeStatements, - final Integer fractionDigits) { - super(); - if (!((fractionDigits.intValue() > 1) && (fractionDigits.intValue() <= 18))) { - throw new IllegalArgumentException( - "The fraction digits outside of boundaries. Fraction digits MUST be integer between 1 and 18 inclusively"); - } - - if (rangeStatements == null || rangeStatements.isEmpty()) { - this.rangeStatements = defaultRangeStatements(); - - } else { - this.rangeStatements = Collections.unmodifiableList(rangeStatements); - } - this.units = units; - this.defaultValue = defaultValue; - this.fractionDigits = fractionDigits; - this.path = BaseTypes.schemaPath(name); + this.path = path; + this.baseType = this; } /** * Returns unmodifiable List with default definition of Range Statements. - * + * * @return unmodifiable List with default definition of Range Statements. */ private List defaultRangeStatements() { @@ -170,7 +90,7 @@ public class Decimal64 implements DecimalTypeDefinition { @Override public DecimalTypeDefinition getBaseType() { - return this; + return baseType; } @Override