Method now returns null instead of reference to itself.
Signed-off-by: Martin Vitez <mvitez@cisco.com>
24 files changed:
var Type returnType = null;
if (typeDef instanceof EnumTypeDefinition) {
returnType = typeProvider.javaTypeForSchemaDefinitionType(typeDef, leaf);
var Type returnType = null;
if (typeDef instanceof EnumTypeDefinition) {
returnType = typeProvider.javaTypeForSchemaDefinitionType(typeDef, leaf);
- val enumTypeDef = enumTypeDefFromExtendedType(typeDef);
+ val enumTypeDef = typeDef as EnumTypeDefinition;
val enumBuilder = resolveInnerEnumFromTypeDefinition(enumTypeDef, leafName, typeBuilder);
if (enumBuilder !== null) {
val enumBuilder = resolveInnerEnumFromTypeDefinition(enumTypeDef, leafName, typeBuilder);
if (enumBuilder !== null) {
if (typeDef instanceof UnionTypeDefinition) {
genTOBuilders.addAll(
(typeProvider as TypeProviderImpl).
if (typeDef instanceof UnionTypeDefinition) {
genTOBuilders.addAll(
(typeProvider as TypeProviderImpl).
- provideGeneratedTOBuildersForUnionTypeDef(packageName, typeDef, classNameFromLeaf, leaf));
+ provideGeneratedTOBuildersForUnionTypeDef(packageName, (typeDef as UnionTypeDefinition), classNameFromLeaf, leaf));
} else if (typeDef instanceof BitsTypeDefinition) {
genTOBuilders.add(
((typeProvider as TypeProviderImpl) ).
} else if (typeDef instanceof BitsTypeDefinition) {
genTOBuilders.add(
((typeProvider as TypeProviderImpl) ).
*/
package org.opendaylight.yangtools.sal.binding.yang.types;
*/
package org.opendaylight.yangtools.sal.binding.yang.types;
-import static org.opendaylight.yangtools.binding.generator.util.BindingGeneratorUtil.moduleNamespaceToPackageName;
-import static org.opendaylight.yangtools.binding.generator.util.BindingGeneratorUtil.packageNameForGeneratedType;
-import static org.opendaylight.yangtools.binding.generator.util.BindingGeneratorUtil.parseToClassName;
-import static org.opendaylight.yangtools.binding.generator.util.BindingGeneratorUtil.parseToValidParamName;
-import static org.opendaylight.yangtools.yang.model.util.SchemaContextUtil.findDataSchemaNode;
-import static org.opendaylight.yangtools.yang.model.util.SchemaContextUtil.findDataSchemaNodeForRelativeXPath;
-import static org.opendaylight.yangtools.yang.model.util.SchemaContextUtil.findParentModule;
+import static org.opendaylight.yangtools.binding.generator.util.BindingGeneratorUtil.*;
+import static org.opendaylight.yangtools.yang.model.util.SchemaContextUtil.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.ArrayList;
import java.util.HashMap;
/**
* Creates new instance of class <code>TypeProviderImpl</code>.
/**
* Creates new instance of class <code>TypeProviderImpl</code>.
* @param schemaContext
* contains the schema data red from YANG files
* @throws IllegalArgumentException
* @param schemaContext
* contains the schema data red from YANG files
* @throws IllegalArgumentException
/**
* Puts <code>refType</code> to map with key <code>refTypePath</code>
/**
* Puts <code>refType</code> to map with key <code>refTypePath</code>
* @param refTypePath
* schema path used as the map key
* @param refType
* @param refTypePath
* schema path used as the map key
* @param refType
* <li>if <code>refTypePath</code> equal null</li>
* <li>if <code>refType</code> equal null</li>
* </ul>
* <li>if <code>refTypePath</code> equal null</li>
* <li>if <code>refType</code> equal null</li>
* </ul>
*/
public void putReferencedType(final SchemaPath refTypePath, final Type refType) {
Preconditions.checkArgument(refTypePath != null,
"Path reference of Enumeration Type Definition cannot be NULL!");
*/
public void putReferencedType(final SchemaPath refTypePath, final Type refType) {
Preconditions.checkArgument(refTypePath != null,
"Path reference of Enumeration Type Definition cannot be NULL!");
Preconditions.checkArgument(refType != null, "Reference to Enumeration Type cannot be NULL!");
referencedTypes.put(refTypePath, refType);
}
/**
Preconditions.checkArgument(refType != null, "Reference to Enumeration Type cannot be NULL!");
referencedTypes.put(refTypePath, refType);
}
/**
* Converts basic YANG type <code>type</code> to JAVA <code>Type</code>.
* Converts basic YANG type <code>type</code> to JAVA <code>Type</code>.
* @param type
* string with YANG name of type
* @returns JAVA <code>Type</code> for YANG type <code>type</code>
* @param type
* string with YANG name of type
* @returns JAVA <code>Type</code> for YANG type <code>type</code>
/**
* Converts schema definition type <code>typeDefinition</code> to JAVA
* <code>Type</code>
/**
* Converts schema definition type <code>typeDefinition</code> to JAVA
* <code>Type</code>
* @param typeDefinition
* type definition which is converted to JAVA type
* @throws IllegalArgumentException
* @param typeDefinition
* type definition which is converted to JAVA type
* @throws IllegalArgumentException
* Returns JAVA <code>Type</code> for instances of the type
* <code>LeafrefTypeDefinition</code> or
* <code>IdentityrefTypeDefinition</code>.
* Returns JAVA <code>Type</code> for instances of the type
* <code>LeafrefTypeDefinition</code> or
* <code>IdentityrefTypeDefinition</code>.
* @param typeDefinition
* type definition which is converted to JAVA <code>Type</code>
* @return JAVA <code>Type</code> instance for <code>typeDefinition</code>
* @param typeDefinition
* type definition which is converted to JAVA <code>Type</code>
* @return JAVA <code>Type</code> instance for <code>typeDefinition</code>
/**
* Returns JAVA <code>Type</code> for instances of the type
* <code>ExtendedType</code>.
/**
* Returns JAVA <code>Type</code> for instances of the type
* <code>ExtendedType</code>.
* @param typeDefinition
* type definition which is converted to JAVA <code>Type</code>
* @return JAVA <code>Type</code> instance for <code>typeDefinition</code>
* @param typeDefinition
* type definition which is converted to JAVA <code>Type</code>
* @return JAVA <code>Type</code> instance for <code>typeDefinition</code>
* Seeks for identity reference <code>idref</code> the JAVA
* <code>type</code>.<br />
* <br />
* Seeks for identity reference <code>idref</code> the JAVA
* <code>type</code>.<br />
* <br />
* <i>Example:<br />
* If identy which is referenced via <code>idref</code> has name <b>Idn</b>
* then returning type is <b>{@code Class<? extends Idn>}</b></i>
* <i>Example:<br />
* If identy which is referenced via <code>idref</code> has name <b>Idn</b>
* then returning type is <b>{@code Class<? extends Idn>}</b></i>
* @param idref
* identityref type definition for which JAVA <code>Type</code>
* is sought
* @param idref
* identityref type definition for which JAVA <code>Type</code>
* is sought
/**
* Converts <code>typeDefinition</code> to concrete JAVA <code>Type</code>.
/**
* Converts <code>typeDefinition</code> to concrete JAVA <code>Type</code>.
* @param typeDefinition
* type definition which should be converted to JAVA
* <code>Type</code>
* @param typeDefinition
* type definition which should be converted to JAVA
* <code>Type</code>
/**
* Gets base type definition for <code>extendTypeDef</code>. The method is
* recursivelly called until non <code>ExtendedType</code> type is found.
/**
* Gets base type definition for <code>extendTypeDef</code>. The method is
* recursivelly called until non <code>ExtendedType</code> type is found.
* @param extendTypeDef
* type definition for which is the base type definition sought
* @return type definition which is base type for <code>extendTypeDef</code>
* @param extendTypeDef
* type definition for which is the base type definition sought
* @return type definition which is base type for <code>extendTypeDef</code>
/**
* Converts <code>leafrefType</code> to JAVA <code>Type</code>.
/**
* Converts <code>leafrefType</code> to JAVA <code>Type</code>.
* The path of <code>leafrefType</code> is followed to find referenced node
* and its <code>Type</code> is returned.
* The path of <code>leafrefType</code> is followed to find referenced node
* and its <code>Type</code> is returned.
* @param leafrefType
* leafref type definition for which is the type sought
* @return JAVA <code>Type</code> of data schema node which is referenced in
* @param leafrefType
* leafref type definition for which is the type sought
* @return JAVA <code>Type</code> of data schema node which is referenced in
* <li>if <code>leafrefType</code> equal null</li>
* <li>if path statement of <code>leafrefType</code> equal null</li>
* </ul>
* <li>if <code>leafrefType</code> equal null</li>
* <li>if path statement of <code>leafrefType</code> equal null</li>
* </ul>
*/
public Type provideTypeForLeafref(final LeafrefTypeDefinition leafrefType, final SchemaNode parentNode) {
Type returnType = null;
*/
public Type provideTypeForLeafref(final LeafrefTypeDefinition leafrefType, final SchemaNode parentNode) {
Type returnType = null;
/**
* Checks if <code>dataNode</code> is <code>LeafSchemaNode</code> and if it
* so then checks if it is of type <code>EnumTypeDefinition</code>.
/**
* Checks if <code>dataNode</code> is <code>LeafSchemaNode</code> and if it
* so then checks if it is of type <code>EnumTypeDefinition</code>.
* @param dataNode
* data schema node for which is checked if it is leaf and if it
* is of enum type
* @param dataNode
* data schema node for which is checked if it is leaf and if it
* is of enum type
/**
* Checks if <code>dataNode</code> is <code>LeafListSchemaNode</code> and if
* it so then checks if it is of type <code>EnumTypeDefinition</code>.
/**
* Checks if <code>dataNode</code> is <code>LeafListSchemaNode</code> and if
* it so then checks if it is of type <code>EnumTypeDefinition</code>.
* @param dataNode
* data schema node for which is checked if it is leaflist and if
* it is of enum type
* @param dataNode
* data schema node for which is checked if it is leaflist and if
* it is of enum type
* Converts <code>enumTypeDef</code> to
* {@link org.opendaylight.yangtools.sal.binding.model.api.Enumeration
* enumeration}.
* Converts <code>enumTypeDef</code> to
* {@link org.opendaylight.yangtools.sal.binding.model.api.Enumeration
* enumeration}.
* @param enumTypeDef
* enumeration type definition which is converted to enumeration
* @param enumName
* @param enumTypeDef
* enumeration type definition which is converted to enumeration
* @param enumName
/**
* Adds enumeration to <code>typeBuilder</code>. The enumeration data are
* taken from <code>enumTypeDef</code>.
/**
* Adds enumeration to <code>typeBuilder</code>. The enumeration data are
* taken from <code>enumTypeDef</code>.
* @param enumTypeDef
* enumeration type definition is source of enumeration data for
* <code>typeBuilder</code>
* @param enumTypeDef
* enumeration type definition is source of enumeration data for
* <code>typeBuilder</code>
* <li>if name of <code>enumTypeDef</code> equal null</li>
* <li>if name of <code>typeBuilder</code> equal null</li>
* </ul>
* <li>if name of <code>enumTypeDef</code> equal null</li>
* <li>if name of <code>typeBuilder</code> equal null</li>
* </ul>
*/
private Enumeration addInnerEnumerationToTypeBuilder(final EnumTypeDefinition enumTypeDef, final String enumName,
final GeneratedTypeBuilderBase<?> typeBuilder) {
*/
private Enumeration addInnerEnumerationToTypeBuilder(final EnumTypeDefinition enumTypeDef, final String enumName,
final GeneratedTypeBuilderBase<?> typeBuilder) {
/**
* Converts <code>dataNode</code> to JAVA <code>Type</code>.
/**
* Converts <code>dataNode</code> to JAVA <code>Type</code>.
* @param dataNode
* contains information about YANG type
* @return JAVA <code>Type</code> representation of <code>dataNode</code>
* @param dataNode
* contains information about YANG type
* @return JAVA <code>Type</code> representation of <code>dataNode</code>
/**
* Passes through all modules and through all its type definitions and
* convert it to generated types.
/**
* Passes through all modules and through all its type definitions and
* convert it to generated types.
* The modules are firstly sorted by mutual dependencies. The modules are
* sequentially passed. All type definitions of a module are at the
* beginning sorted so that type definition with less amount of references
* The modules are firstly sorted by mutual dependencies. The modules are
* sequentially passed. All type definitions of a module are at the
* beginning sorted so that type definition with less amount of references
* {@link TypeProviderImpl#genTypeDefsContextMap genTypeDefsContextMap}
* which map current module name to the map which maps type names to
* returned types (generated types).
* {@link TypeProviderImpl#genTypeDefsContextMap genTypeDefsContextMap}
* which map current module name to the map which maps type names to
* returned types (generated types).
*/
private void resolveTypeDefsFromContext() {
final Set<Module> modules = schemaContext.getModules();
*/
private void resolveTypeDefsFromContext() {
final Set<Module> modules = schemaContext.getModules();
* @param basePackageName
* string with name of package to which the module belongs
* @param moduleName
* @param basePackageName
* string with name of package to which the module belongs
* @param moduleName
returnType = provideGeneratedTOFromExtendedType(innerExtendedType, basePackageName, typedefName);
} else if (innerTypeDefinition instanceof UnionTypeDefinition) {
final GeneratedTOBuilder genTOBuilder = provideGeneratedTOBuilderForUnionTypeDef(basePackageName,
returnType = provideGeneratedTOFromExtendedType(innerExtendedType, basePackageName, typedefName);
} else if (innerTypeDefinition instanceof UnionTypeDefinition) {
final GeneratedTOBuilder genTOBuilder = provideGeneratedTOBuilderForUnionTypeDef(basePackageName,
- typedef, typedefName, typedef);
+ (UnionTypeDefinition) innerTypeDefinition, typedefName, typedef);
returnType = genTOBuilder.toInstance();
} else if (innerTypeDefinition instanceof EnumTypeDefinition) {
final EnumTypeDefinition enumTypeDef = (EnumTypeDefinition) innerTypeDefinition;
returnType = genTOBuilder.toInstance();
} else if (innerTypeDefinition instanceof EnumTypeDefinition) {
final EnumTypeDefinition enumTypeDef = (EnumTypeDefinition) innerTypeDefinition;
/**
* Wraps base YANG type to generated TO.
/**
* Wraps base YANG type to generated TO.
* @param basePackageName
* string with name of package to which the module belongs
* @param typedef
* @param basePackageName
* string with name of package to which the module belongs
* @param typedef
/**
* Converts output list of generated TO builders to one TO builder (first
* from list) which contains the remaining builders as its enclosing TO.
/**
* Converts output list of generated TO builders to one TO builder (first
* from list) which contains the remaining builders as its enclosing TO.
* @param basePackageName
* string with name of package to which the module belongs
* @param typedef
* @param basePackageName
* string with name of package to which the module belongs
* @param typedef
* builders
*/
public GeneratedTOBuilder provideGeneratedTOBuilderForUnionTypeDef(final String basePackageName,
* builders
*/
public GeneratedTOBuilder provideGeneratedTOBuilderForUnionTypeDef(final String basePackageName,
- final TypeDefinition<?> typedef, String typeDefName, SchemaNode parentNode) {
+ final UnionTypeDefinition typedef, String typeDefName, SchemaNode parentNode) {
final List<GeneratedTOBuilder> genTOBuilders = provideGeneratedTOBuildersForUnionTypeDef(basePackageName,
typedef, typeDefName, parentNode);
GeneratedTOBuilder resultTOBuilder = null;
final List<GeneratedTOBuilder> genTOBuilders = provideGeneratedTOBuildersForUnionTypeDef(basePackageName,
typedef, typeDefName, parentNode);
GeneratedTOBuilder resultTOBuilder = null;
* Converts <code>typedef</code> to generated TO with
* <code>typeDefName</code>. Every union type from <code>typedef</code> is
* added to generated TO builder as property.
* Converts <code>typedef</code> to generated TO with
* <code>typeDefName</code>. Every union type from <code>typedef</code> is
* added to generated TO builder as property.
* @param basePackageName
* string with name of package to which the module belongs
* @param typedef
* @param basePackageName
* string with name of package to which the module belongs
* @param typedef
* </ul>
*/
public List<GeneratedTOBuilder> provideGeneratedTOBuildersForUnionTypeDef(final String basePackageName,
* </ul>
*/
public List<GeneratedTOBuilder> provideGeneratedTOBuildersForUnionTypeDef(final String basePackageName,
- final TypeDefinition<?> typedef, final String typeDefName, final SchemaNode parentNode) {
+ final UnionTypeDefinition typedef, final String typeDefName, final SchemaNode parentNode) {
Preconditions.checkArgument(basePackageName != null, "Base Package Name cannot be NULL!");
Preconditions.checkArgument(typedef != null, "Type Definition cannot be NULL!");
Preconditions.checkArgument(typedef.getQName() != null,
Preconditions.checkArgument(basePackageName != null, "Base Package Name cannot be NULL!");
Preconditions.checkArgument(typedef != null, "Type Definition cannot be NULL!");
Preconditions.checkArgument(typedef.getQName() != null,
final List<GeneratedTOBuilder> generatedTOBuilders = new ArrayList<>();
final List<GeneratedTOBuilder> generatedTOBuilders = new ArrayList<>();
- final TypeDefinition<?> baseTypeDefinition = typedef.getBaseType();
- if ((baseTypeDefinition != null) && (baseTypeDefinition instanceof UnionTypeDefinition)) {
- final UnionTypeDefinition unionTypeDef = (UnionTypeDefinition) baseTypeDefinition;
- final List<TypeDefinition<?>> unionTypes = unionTypeDef.getTypes();
+ if (typedef != null) {
+ final List<TypeDefinition<?>> unionTypes = typedef.getTypes();
final GeneratedTOBuilder unionGenTOBuilder;
if (typeDefName != null && !typeDefName.isEmpty()) {
final GeneratedTOBuilder unionGenTOBuilder;
if (typeDefName != null && !typeDefName.isEmpty()) {
for (final TypeDefinition<?> unionType : unionTypes) {
final String unionTypeName = unionType.getQName().getLocalName();
if (unionType instanceof UnionType) {
for (final TypeDefinition<?> unionType : unionTypes) {
final String unionTypeName = unionType.getQName().getLocalName();
if (unionType instanceof UnionType) {
- generatedTOBuilders.addAll(resolveUnionSubtypeAsUnion(unionGenTOBuilder, unionType,
+ generatedTOBuilders.addAll(resolveUnionSubtypeAsUnion(unionGenTOBuilder, (UnionType) unionType,
basePackageName, parentNode));
} else if (unionType instanceof ExtendedType) {
resolveExtendedSubtypeAsUnion(unionGenTOBuilder, (ExtendedType) unionType, unionTypeName,
basePackageName, parentNode));
} else if (unionType instanceof ExtendedType) {
resolveExtendedSubtypeAsUnion(unionGenTOBuilder, (ExtendedType) unionType, unionTypeName,
/**
* Wraps code which handle case when union subtype is also of the type
* <code>UnionType</code>.
/**
* Wraps code which handle case when union subtype is also of the type
* <code>UnionType</code>.
* In this case the new generated TO is created for union subtype (recursive
* call of method
* {@link #provideGeneratedTOBuilderForUnionTypeDef(String, TypeDefinition, String)
* provideGeneratedTOBuilderForUnionTypeDef} and in parent TO builder
* <code>parentUnionGenTOBuilder</code> is created property which type is
* equal to new generated TO.
* In this case the new generated TO is created for union subtype (recursive
* call of method
* {@link #provideGeneratedTOBuilderForUnionTypeDef(String, TypeDefinition, String)
* provideGeneratedTOBuilderForUnionTypeDef} and in parent TO builder
* <code>parentUnionGenTOBuilder</code> is created property which type is
* equal to new generated TO.
* @param parentUnionGenTOBuilder
* generated TO builder to which is the property with the child
* union subtype added
* @param parentUnionGenTOBuilder
* generated TO builder to which is the property with the child
* union subtype added
* <code>provideGeneratedTOBuildersForUnionTypeDef</code> method.
*/
private List<GeneratedTOBuilder> resolveUnionSubtypeAsUnion(final GeneratedTOBuilder parentUnionGenTOBuilder,
* <code>provideGeneratedTOBuildersForUnionTypeDef</code> method.
*/
private List<GeneratedTOBuilder> resolveUnionSubtypeAsUnion(final GeneratedTOBuilder parentUnionGenTOBuilder,
- final TypeDefinition<?> unionSubtype, final String basePackageName, final SchemaNode parentNode) {
+ final UnionTypeDefinition unionSubtype, final String basePackageName, final SchemaNode parentNode) {
final String newTOBuilderName = provideAvailableNameForGenTOBuilder(parentUnionGenTOBuilder.getName());
final List<GeneratedTOBuilder> subUnionGenTOBUilders = provideGeneratedTOBuildersForUnionTypeDef(
basePackageName, unionSubtype, newTOBuilderName, parentNode);
final String newTOBuilderName = provideAvailableNameForGenTOBuilder(parentUnionGenTOBuilder.getName());
final List<GeneratedTOBuilder> subUnionGenTOBUilders = provideGeneratedTOBuildersForUnionTypeDef(
basePackageName, unionSubtype, newTOBuilderName, parentNode);
/**
* Wraps code which handle case when union subtype is of the type
* <code>ExtendedType</code>.
/**
* Wraps code which handle case when union subtype is of the type
* <code>ExtendedType</code>.
* If TO for this type already exists it is used for the creation of the
* property in <code>parentUnionGenTOBuilder</code>. In other case the base
* type is used for the property creation.
* If TO for this type already exists it is used for the creation of the
* property in <code>parentUnionGenTOBuilder</code>. In other case the base
* type is used for the property creation.
* @param parentUnionGenTOBuilder
* generated TO builder in which new property is created
* @param unionSubtype
* @param parentUnionGenTOBuilder
* generated TO builder in which new property is created
* @param unionSubtype
/**
* Searches for generated TO for <code>searchedTypeDef</code> type
* definition in {@link #genTypeDefsContextMap genTypeDefsContextMap}
/**
* Searches for generated TO for <code>searchedTypeDef</code> type
* definition in {@link #genTypeDefsContextMap genTypeDefsContextMap}
* @param searchedTypeName
* string with name of <code>searchedTypeDef</code>
* @return generated TO for <code>searchedTypeDef</code> or
* @param searchedTypeName
* string with name of <code>searchedTypeDef</code>
* @return generated TO for <code>searchedTypeDef</code> or
* Stores generated TO created from <code>genTOBuilder</code> for
* <code>newTypeDef</code> to {@link #genTypeDefsContextMap
* genTypeDefsContextMap} if the module for <code>newTypeDef</code> exists
* Stores generated TO created from <code>genTOBuilder</code> for
* <code>newTypeDef</code> to {@link #genTypeDefsContextMap
* genTypeDefsContextMap} if the module for <code>newTypeDef</code> exists
* @param newTypeDef
* type definition for which is <code>genTOBuilder</code> created
* @param genTOBuilder
* @param newTypeDef
* type definition for which is <code>genTOBuilder</code> created
* @param genTOBuilder
/**
* Adds a new property with the name <code>propertyName</code> and with type
* <code>type</code> to <code>unonGenTransObject</code>.
/**
* Adds a new property with the name <code>propertyName</code> and with type
* <code>type</code> to <code>unonGenTransObject</code>.
* @param unionGenTransObject
* generated TO to which should be property added
* @param type
* @param unionGenTransObject
* generated TO to which should be property added
* @param type
/**
* Converts <code>typedef</code> to the generated TO builder.
/**
* Converts <code>typedef</code> to the generated TO builder.
* @param basePackageName
* string with name of package to which the module belongs
* @param typedef
* @param basePackageName
* string with name of package to which the module belongs
* @param typedef
/**
* Converts <code>typeDef</code> which should be of the type
* <code>BitsTypeDefinition</code> to <code>GeneratedTOBuilder</code>.
/**
* Converts <code>typeDef</code> which should be of the type
* <code>BitsTypeDefinition</code> to <code>GeneratedTOBuilder</code>.
* All the bits of the typeDef are added to returning generated TO as
* properties.
* All the bits of the typeDef are added to returning generated TO as
* properties.
* @param basePackageName
* string with name of package to which the module belongs
* @param typeDef
* @param basePackageName
* string with name of package to which the module belongs
* @param typeDef
/**
* Converts the pattern constraints from <code>typedef</code> to the list of
* the strings which represents these constraints.
/**
* Converts the pattern constraints from <code>typedef</code> to the list of
* the strings which represents these constraints.
* @param typedef
* extended type in which are the pattern constraints sought
* @return list of strings which represents the constraint patterns
* @throws IllegalArgumentException
* if <code>typedef</code> equals null
* @param typedef
* extended type in which are the pattern constraints sought
* @return list of strings which represents the constraint patterns
* @throws IllegalArgumentException
* if <code>typedef</code> equals null
*/
private List<String> resolveRegExpressionsFromTypedef(ExtendedType typedef) {
final List<String> regExps = new ArrayList<String>();
*/
private List<String> resolveRegExpressionsFromTypedef(ExtendedType typedef) {
final List<String> regExps = new ArrayList<String>();
* Adds to the <code>genTOBuilder</code> the constant which contains regular
* expressions from the <code>regularExpressions</code>
* Adds to the <code>genTOBuilder</code> the constant which contains regular
* expressions from the <code>regularExpressions</code>
* @param genTOBuilder
* generated TO builder to which are
* <code>regular expressions</code> added
* @param genTOBuilder
* generated TO builder to which are
* <code>regular expressions</code> added
* <code>innerExtendedType</code>, about the package name
* <code>typedefName</code> and about the generated TO name
* <code>typedefName</code>.
* <code>innerExtendedType</code>, about the package name
* <code>typedefName</code> and about the generated TO name
* <code>typedefName</code>.
* It is supposed that <code>innerExtendedType</code> is already present in
* {@link TypeProviderImpl#genTypeDefsContextMap genTypeDefsContextMap} to
* be possible set it as extended type for the returning generated TO.
* It is supposed that <code>innerExtendedType</code> is already present in
* {@link TypeProviderImpl#genTypeDefsContextMap genTypeDefsContextMap} to
* be possible set it as extended type for the returning generated TO.
* @param innerExtendedType
* extended type which is part of some other extended type
* @param basePackageName
* @param innerExtendedType
* extended type which is part of some other extended type
* @param basePackageName
* equal depth. In next step are lists from this map concatenated to one
* list in ascending order according to their depth. All type definitions
* are in the list behind all type definitions on which depends.
* equal depth. In next step are lists from this map concatenated to one
* list in ascending order according to their depth. All type definitions
* are in the list behind all type definitions on which depends.
* @param unsortedTypeDefinitions
* list of type definitions which should be sorted by depth
* @return list of type definitions sorted according their each other
* @param unsortedTypeDefinitions
* list of type definitions which should be sorted by depth
* @return list of type definitions sorted according their each other
/**
* Returns how many immersion is necessary to get from the type definition
* to the base type.
/**
* Returns how many immersion is necessary to get from the type definition
* to the base type.
* @param typeDefinition
* type definition for which is depth sought.
* @return number of immersions which are necessary to get from the type
* definition to the base type
*/
private int getTypeDefinitionDepth(final TypeDefinition<?> typeDefinition) {
* @param typeDefinition
* type definition for which is depth sought.
* @return number of immersions which are necessary to get from the type
* definition to the base type
*/
private int getTypeDefinitionDepth(final TypeDefinition<?> typeDefinition) {
- Preconditions.checkArgument(typeDefinition != null, "Type definition can't be null");
+ if (typeDefinition == null) {
+ return 1;
+ }
int depth = 1;
TypeDefinition<?> baseType = typeDefinition.getBaseType();
int depth = 1;
TypeDefinition<?> baseType = typeDefinition.getBaseType();
* Returns string which contains the same value as <code>name</code> but
* integer suffix is incremented by one. If <code>name</code> contains no
* number suffix then number 1 is added.
* Returns string which contains the same value as <code>name</code> but
* integer suffix is incremented by one. If <code>name</code> contains no
* number suffix then number 1 is added.
* @param name
* string with name of augmented node
* @return string with the number suffix incremented by one (or 1 is added)
* @param name
* string with name of augmented node
* @return string with the number suffix incremented by one (or 1 is added)
* interface which represents SIGNED Integer values defined in Yang language. <br>
* The integer built-in types in Yang are int8, int16, int32, int64. They
* represent signed integers of different sizes:
* interface which represents SIGNED Integer values defined in Yang language. <br>
* The integer built-in types in Yang are int8, int16, int32, int64. They
* represent signed integers of different sizes:
* <ul>
* <li>int8 - represents integer values between -128 and 127, inclusively.</li>
* <li>int16 - represents integer values between -32768 and 32767, inclusively.</li>
* <ul>
* <li>int8 - represents integer values between -128 and 127, inclusively.</li>
* <li>int16 - represents integer values between -32768 and 32767, inclusively.</li>
* <li>int64 - represents integer values between -9223372036854775808 and
* 9223372036854775807, inclusively.</li>
* </ul>
* <li>int64 - represents integer values between -9223372036854775808 and
* 9223372036854775807, inclusively.</li>
* </ul>
-public abstract class AbstractSignedInteger implements IntegerTypeDefinition {
+abstract class AbstractSignedInteger implements IntegerTypeDefinition {
private final QName name;
private final SchemaPath path;
private final String description;
private final QName name;
private final SchemaPath path;
private final String description;
"https://tools.ietf.org/html/rfc6020#section-9.2.4"));
}
"https://tools.ietf.org/html/rfc6020#section-9.2.4"));
}
+ @Override
+ public IntegerTypeDefinition getBaseType() {
+ return null;
+ }
+
@Override
public String getUnits() {
return units;
@Override
public String getUnits() {
return units;
* interface which represents UNSIGNED Integer values defined in Yang language. <br>
* The integer built-in types in Yang are uint8, uint16, uint32, and uint64.
* They represent unsigned integers of different sizes:
* interface which represents UNSIGNED Integer values defined in Yang language. <br>
* The integer built-in types in Yang are uint8, uint16, uint32, and uint64.
* They represent unsigned integers of different sizes:
* <ul>
* <li>uint8 - represents integer values between 0 and 255, inclusively.</li>
* <li>uint16 - represents integer values between 0 and 65535, inclusively.</li>
* <ul>
* <li>uint8 - represents integer values between 0 and 255, inclusively.</li>
* <li>uint16 - represents integer values between 0 and 65535, inclusively.</li>
* <li>uint64 - represents integer values between 0 and 18446744073709551615,
* inclusively.</li>
* </ul>
* <li>uint64 - represents integer values between 0 and 18446744073709551615,
* inclusively.</li>
* </ul>
-public abstract class AbstractUnsignedInteger implements UnsignedIntegerTypeDefinition {
+abstract class AbstractUnsignedInteger implements UnsignedIntegerTypeDefinition {
private static final long MIN_VALUE = 0;
private final QName name;
private final SchemaPath path;
private static final long MIN_VALUE = 0;
private final QName name;
private final SchemaPath path;
private final List<RangeConstraint> rangeStatements;
/**
private final List<RangeConstraint> rangeStatements;
/**
* @param name
* @param description
* @param maxRange
* @param name
* @param description
* @param maxRange
"https://tools.ietf.org/html/rfc6020#section-9.2.4"));
}
"https://tools.ietf.org/html/rfc6020#section-9.2.4"));
}
+ @Override
+ public UnsignedIntegerTypeDefinition getBaseType() {
+ return null;
+ }
+
@Override
public String getUnits() {
return units;
@Override
public String getUnits() {
return units;
/**
* The <code>default</code> implementation of Binary Type Definition interface.
/**
* The <code>default</code> implementation of Binary Type Definition interface.
* @see BinaryTypeDefinition
*/
public final class BinaryType implements BinaryTypeDefinition {
* @see BinaryTypeDefinition
*/
public final class BinaryType implements BinaryTypeDefinition {
* @see
* org.opendaylight.yangtools.yang.model.api.TypeDefinition#getBaseType()
*/
@Override
public BinaryTypeDefinition getBaseType() {
* @see
* org.opendaylight.yangtools.yang.model.api.TypeDefinition#getBaseType()
*/
@Override
public BinaryTypeDefinition getBaseType() {
* @see org.opendaylight.yangtools.yang.model.api.TypeDefinition#getUnits()
*/
@Override
* @see org.opendaylight.yangtools.yang.model.api.TypeDefinition#getUnits()
*/
@Override
* @see
* org.opendaylight.yangtools.yang.model.api.TypeDefinition#getDefaultValue
* ()
* @see
* org.opendaylight.yangtools.yang.model.api.TypeDefinition#getDefaultValue
* ()
* @see org.opendaylight.yangtools.yang.model.api.SchemaNode#getQName()
*/
@Override
* @see org.opendaylight.yangtools.yang.model.api.SchemaNode#getQName()
*/
@Override
* @see org.opendaylight.yangtools.yang.model.api.SchemaNode#getPath()
*/
@Override
* @see org.opendaylight.yangtools.yang.model.api.SchemaNode#getPath()
*/
@Override
* @see
* org.opendaylight.yangtools.yang.model.api.SchemaNode#getDescription()
*/
* @see
* org.opendaylight.yangtools.yang.model.api.SchemaNode#getDescription()
*/
* @see org.opendaylight.yangtools.yang.model.api.SchemaNode#getReference()
*/
@Override
* @see org.opendaylight.yangtools.yang.model.api.SchemaNode#getReference()
*/
@Override
* @see org.opendaylight.yangtools.yang.model.api.SchemaNode#getStatus()
*/
@Override
* @see org.opendaylight.yangtools.yang.model.api.SchemaNode#getStatus()
*/
@Override
* @see
* org.opendaylight.yangtools.yang.model.base.type.api.BinaryTypeDefinition
* #getLengthConstraint ()
* @see
* org.opendaylight.yangtools.yang.model.base.type.api.BinaryTypeDefinition
* #getLengthConstraint ()
/**
* The <code>default</code> implementation of Bits Type Definition interface.
/**
* The <code>default</code> implementation of Bits Type Definition interface.
* @see BitsTypeDefinition
*/
public final class BitsType implements BitsTypeDefinition {
* @see BitsTypeDefinition
*/
public final class BitsType implements BitsTypeDefinition {
+ "numbers starting at 0. Each bit number has an assigned name.";
private static final String REFERENCE = "https://tools.ietf.org/html/rfc6020#section-9.7";
+ "numbers starting at 0. Each bit number has an assigned name.";
private static final String REFERENCE = "https://tools.ietf.org/html/rfc6020#section-9.7";
- private final BitsTypeDefinition baseType;
private final List<Bit> bits;
private static final String UNITS = "";
/**
* Default constructor. <br>
* Instantiates Bits type as empty bits list.
private final List<Bit> bits;
private static final String UNITS = "";
/**
* Default constructor. <br>
* Instantiates Bits type as empty bits list.
* @param path
*/
public BitsType(final SchemaPath path) {
super();
this.bits = Collections.emptyList();
this.path = path;
* @param path
*/
public BitsType(final SchemaPath path) {
super();
this.bits = Collections.emptyList();
this.path = path;
}
/**
* Constructor with explicit definition of bits assigned to BitsType.
}
/**
* Constructor with explicit definition of bits assigned to BitsType.
* @param path
* @param bits
*/
* @param path
* @param bits
*/
super();
this.bits = Collections.unmodifiableList(bits);
this.path = path;
super();
this.bits = Collections.unmodifiableList(bits);
this.path = path;
* @see
* org.opendaylight.yangtools.yang.model.api.TypeDefinition#getBaseType()
*/
@Override
public BitsTypeDefinition getBaseType() {
* @see
* org.opendaylight.yangtools.yang.model.api.TypeDefinition#getBaseType()
*/
@Override
public BitsTypeDefinition getBaseType() {
* @see org.opendaylight.yangtools.yang.model.api.TypeDefinition#getUnits()
*/
@Override
* @see org.opendaylight.yangtools.yang.model.api.TypeDefinition#getUnits()
*/
@Override
* @see
* org.opendaylight.yangtools.yang.model.api.TypeDefinition#getDefaultValue
* ()
* @see
* org.opendaylight.yangtools.yang.model.api.TypeDefinition#getDefaultValue
* ()
* @see org.opendaylight.yangtools.yang.model.api.SchemaNode#getQName()
*/
@Override
* @see org.opendaylight.yangtools.yang.model.api.SchemaNode#getQName()
*/
@Override
* @see org.opendaylight.yangtools.yang.model.api.SchemaNode#getPath()
*/
@Override
* @see org.opendaylight.yangtools.yang.model.api.SchemaNode#getPath()
*/
@Override
* @see
* org.opendaylight.yangtools.yang.model.api.SchemaNode#getDescription()
*/
* @see
* org.opendaylight.yangtools.yang.model.api.SchemaNode#getDescription()
*/
* @see org.opendaylight.yangtools.yang.model.api.SchemaNode#getReference()
*/
@Override
* @see org.opendaylight.yangtools.yang.model.api.SchemaNode#getReference()
*/
@Override
* @see org.opendaylight.yangtools.yang.model.api.SchemaNode#getStatus()
*/
@Override
* @see org.opendaylight.yangtools.yang.model.api.SchemaNode#getStatus()
*/
@Override
/**
* The <code>default</code> implementation of Boolean Type Definition interface.
/**
* The <code>default</code> implementation of Boolean Type Definition interface.
* @see BooleanTypeDefinition
*/
public final class BooleanType implements BooleanTypeDefinition {
* @see BooleanTypeDefinition
*/
public final class BooleanType implements BooleanTypeDefinition {
* @see
* org.opendaylight.yangtools.yang.model.api.TypeDefinition#getBaseType()
*/
@Override
public BooleanTypeDefinition getBaseType() {
* @see
* org.opendaylight.yangtools.yang.model.api.TypeDefinition#getBaseType()
*/
@Override
public BooleanTypeDefinition getBaseType() {
* @see org.opendaylight.yangtools.yang.model.api.TypeDefinition#getUnits()
*/
@Override
* @see org.opendaylight.yangtools.yang.model.api.TypeDefinition#getUnits()
*/
@Override
* @see
* org.opendaylight.yangtools.yang.model.api.TypeDefinition#getDefaultValue
* ()
* @see
* org.opendaylight.yangtools.yang.model.api.TypeDefinition#getDefaultValue
* ()
* @see org.opendaylight.yangtools.yang.model.api.SchemaNode#getQName()
*/
@Override
* @see org.opendaylight.yangtools.yang.model.api.SchemaNode#getQName()
*/
@Override
* @see org.opendaylight.yangtools.yang.model.api.SchemaNode#getPath()
*/
@Override
* @see org.opendaylight.yangtools.yang.model.api.SchemaNode#getPath()
*/
@Override
* @see
* org.opendaylight.yangtools.yang.model.api.SchemaNode#getDescription()
*/
* @see
* org.opendaylight.yangtools.yang.model.api.SchemaNode#getDescription()
*/
* @see org.opendaylight.yangtools.yang.model.api.SchemaNode#getReference()
*/
@Override
* @see org.opendaylight.yangtools.yang.model.api.SchemaNode#getReference()
*/
@Override
* @see org.opendaylight.yangtools.yang.model.api.SchemaNode#getStatus()
*/
@Override
* @see org.opendaylight.yangtools.yang.model.api.SchemaNode#getStatus()
*/
@Override
/**
* The <code>default</code> implementation of Decimal Type Definition interface.
/**
* The <code>default</code> implementation of Decimal Type Definition interface.
* @see DecimalTypeDefinition
*/
public final class Decimal64 implements DecimalTypeDefinition {
* @see DecimalTypeDefinition
*/
public final class Decimal64 implements DecimalTypeDefinition {
private final List<RangeConstraint> rangeStatements;
private final Integer fractionDigits;
private final List<RangeConstraint> rangeStatements;
private final Integer fractionDigits;
- private final DecimalTypeDefinition baseType;
private static final int MAX_NUMBER_OF_FRACTION_DIGITS = 18;
/**
private static final int MAX_NUMBER_OF_FRACTION_DIGITS = 18;
/**
* {@link DecimalTypeDefinition} <br>
* If the fraction digits are not defined inner the definition boundaries
* the constructor will throw {@link IllegalArgumentException}
* {@link DecimalTypeDefinition} <br>
* 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
* @param path
* @param fractionDigits
* integer between 1 and 18 inclusively
* @see DecimalTypeDefinition
* @exception IllegalArgumentException
*/
* @see DecimalTypeDefinition
* @exception IllegalArgumentException
*/
this.fractionDigits = fractionDigits;
rangeStatements = defaultRangeStatements();
this.path = path;
this.fractionDigits = fractionDigits;
rangeStatements = defaultRangeStatements();
this.path = path;
}
/**
* Returns unmodifiable List with default definition of Range Statements.
}
/**
* Returns unmodifiable List with default definition of Range Statements.
* @return unmodifiable List with default definition of Range Statements.
*/
private List<RangeConstraint> defaultRangeStatements() {
* @return unmodifiable List with default definition of Range Statements.
*/
private List<RangeConstraint> defaultRangeStatements() {
@Override
public DecimalTypeDefinition getBaseType() {
@Override
public DecimalTypeDefinition getBaseType() {
@Override
public EmptyTypeDefinition getBaseType() {
@Override
public EmptyTypeDefinition getBaseType() {
/**
* The <code>default</code> implementation of Enumertaion Type Definition
* interface.
/**
* The <code>default</code> implementation of Enumertaion Type Definition
* interface.
* @see EnumTypeDefinition
*/
public final class EnumerationType implements EnumTypeDefinition {
* @see EnumTypeDefinition
*/
public final class EnumerationType implements EnumTypeDefinition {
private final EnumPair defaultEnum;
private final List<EnumPair> enums;
private static final String UNITS = "";
private final EnumPair defaultEnum;
private final List<EnumPair> enums;
private static final String UNITS = "";
- private final EnumTypeDefinition baseType;
public EnumerationType(final SchemaPath path, final List<EnumPair> enums) {
super();
this.path = path;
this.enums = Collections.unmodifiableList(enums);
this.defaultEnum = null;
public EnumerationType(final SchemaPath path, final List<EnumPair> enums) {
super();
this.path = path;
this.enums = Collections.unmodifiableList(enums);
this.defaultEnum = null;
}
public EnumerationType(final SchemaPath path, final EnumPair defaultEnum, final List<EnumPair> enums) {
super();
this.path = path;
}
public EnumerationType(final SchemaPath path, final EnumPair defaultEnum, final List<EnumPair> enums) {
super();
this.path = path;
this.defaultEnum = defaultEnum;
this.enums = Collections.unmodifiableList(enums);
}
/*
* (non-Javadoc)
this.defaultEnum = defaultEnum;
this.enums = Collections.unmodifiableList(enums);
}
/*
* (non-Javadoc)
* @see
* org.opendaylight.yangtools.yang.model.api.TypeDefinition#getBaseType()
*/
@Override
public EnumTypeDefinition getBaseType() {
* @see
* org.opendaylight.yangtools.yang.model.api.TypeDefinition#getBaseType()
*/
@Override
public EnumTypeDefinition getBaseType() {
* @see org.opendaylight.yangtools.yang.model.api.TypeDefinition#getUnits()
*/
@Override
* @see org.opendaylight.yangtools.yang.model.api.TypeDefinition#getUnits()
*/
@Override
* @see
* org.opendaylight.yangtools.yang.model.api.TypeDefinition#getDefaultValue
* ()
* @see
* org.opendaylight.yangtools.yang.model.api.TypeDefinition#getDefaultValue
* ()
* @see org.opendaylight.yangtools.yang.model.api.SchemaNode#getQName()
*/
@Override
* @see org.opendaylight.yangtools.yang.model.api.SchemaNode#getQName()
*/
@Override
* @see org.opendaylight.yangtools.yang.model.api.SchemaNode#getPath()
*/
@Override
* @see org.opendaylight.yangtools.yang.model.api.SchemaNode#getPath()
*/
@Override
* @see
* org.opendaylight.yangtools.yang.model.api.SchemaNode#getDescription()
*/
* @see
* org.opendaylight.yangtools.yang.model.api.SchemaNode#getDescription()
*/
* @see org.opendaylight.yangtools.yang.model.api.SchemaNode#getReference()
*/
@Override
* @see org.opendaylight.yangtools.yang.model.api.SchemaNode#getReference()
*/
@Override
* @see org.opendaylight.yangtools.yang.model.api.SchemaNode#getStatus()
*/
@Override
* @see org.opendaylight.yangtools.yang.model.api.SchemaNode#getStatus()
*/
@Override
* @see
* org.opendaylight.yangtools.yang.model.base.type.api.EnumTypeDefinition
* #getValues()
* @see
* org.opendaylight.yangtools.yang.model.base.type.api.EnumTypeDefinition
* #getValues()
/**
* The <code>default</code> implementation of Identityref Type Definition
* interface.
/**
* The <code>default</code> implementation of Identityref Type Definition
* interface.
* @see IdentityrefTypeDefinition
*/
public final class IdentityrefType implements IdentityrefTypeDefinition {
* @see IdentityrefTypeDefinition
*/
public final class IdentityrefType implements IdentityrefTypeDefinition {
private final SchemaPath path;
private static final String DESCRIPTION = "The identityref type is used to reference an existing identity.";
private static final String REFERENCE = "https://tools.ietf.org/html/rfc6020#section-9.10";
private final SchemaPath path;
private static final String DESCRIPTION = "The identityref type is used to reference an existing identity.";
private static final String REFERENCE = "https://tools.ietf.org/html/rfc6020#section-9.10";
- private final IdentityrefTypeDefinition baseType;
private final QName identity;
private static final String UNITS = "";
public IdentityrefType(QName identity, SchemaPath schemaPath) {
this.identity = identity;
this.path = schemaPath;
private final QName identity;
private static final String UNITS = "";
public IdentityrefType(QName identity, SchemaPath schemaPath) {
this.identity = identity;
this.path = schemaPath;
@Override
public IdentityrefTypeDefinition getBaseType() {
@Override
public IdentityrefTypeDefinition getBaseType() {
/**
* The <code>default</code> implementation of Instance Identifier Type
* Definition interface.
/**
* The <code>default</code> implementation of Instance Identifier Type
* Definition interface.
* @see InstanceIdentifierTypeDefinition
*/
public final class InstanceIdentifier implements InstanceIdentifierTypeDefinition {
* @see InstanceIdentifierTypeDefinition
*/
public final class InstanceIdentifier implements InstanceIdentifierTypeDefinition {
* @see
* org.opendaylight.yangtools.yang.model.api.TypeDefinition#getBaseType()
*/
@Override
public InstanceIdentifierTypeDefinition getBaseType() {
* @see
* org.opendaylight.yangtools.yang.model.api.TypeDefinition#getBaseType()
*/
@Override
public InstanceIdentifierTypeDefinition getBaseType() {
* @see org.opendaylight.yangtools.yang.model.api.TypeDefinition#getUnits()
*/
@Override
* @see org.opendaylight.yangtools.yang.model.api.TypeDefinition#getUnits()
*/
@Override
* @see
* org.opendaylight.yangtools.yang.model.api.TypeDefinition#getDefaultValue
* ()
* @see
* org.opendaylight.yangtools.yang.model.api.TypeDefinition#getDefaultValue
* ()
* @see org.opendaylight.yangtools.yang.model.api.SchemaNode#getQName()
*/
@Override
* @see org.opendaylight.yangtools.yang.model.api.SchemaNode#getQName()
*/
@Override
* @see org.opendaylight.yangtools.yang.model.api.SchemaNode#getPath()
*/
@Override
* @see org.opendaylight.yangtools.yang.model.api.SchemaNode#getPath()
*/
@Override
* @see
* org.opendaylight.yangtools.yang.model.api.SchemaNode#getDescription()
*/
* @see
* org.opendaylight.yangtools.yang.model.api.SchemaNode#getDescription()
*/
* @see org.opendaylight.yangtools.yang.model.api.SchemaNode#getReference()
*/
@Override
* @see org.opendaylight.yangtools.yang.model.api.SchemaNode#getReference()
*/
@Override
* @see org.opendaylight.yangtools.yang.model.api.SchemaNode#getStatus()
*/
@Override
* @see org.opendaylight.yangtools.yang.model.api.SchemaNode#getStatus()
*/
@Override
* @see
* org.opendaylight.yangtools.yang.model.api.SchemaNode#getExtensionSchemaNodes
* ()
* @see
* org.opendaylight.yangtools.yang.model.api.SchemaNode#getExtensionSchemaNodes
* ()
* @see org.opendaylight.yangtools.yang.model.api.type.
* InstanceIdentifierTypeDefinition# getPathStatement()
*/
* @see org.opendaylight.yangtools.yang.model.api.type.
* InstanceIdentifierTypeDefinition# getPathStatement()
*/
* @see org.opendaylight.yangtools.yang.model.api.type.
* InstanceIdentifierTypeDefinition# requireInstance()
*/
* @see org.opendaylight.yangtools.yang.model.api.type.
* InstanceIdentifierTypeDefinition# requireInstance()
*/
package org.opendaylight.yangtools.yang.model.util;
import org.opendaylight.yangtools.yang.common.QName;
package org.opendaylight.yangtools.yang.model.util;
import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.type.IntegerTypeDefinition;
/**
* Implementation of Yang int16 built-in type. <br>
* int16 represents integer values between -32768 and 32767, inclusively. The
* Java counterpart of Yang int16 built-in type is {@link Short}.
/**
* Implementation of Yang int16 built-in type. <br>
* int16 represents integer values between -32768 and 32767, inclusively. The
* Java counterpart of Yang int16 built-in type is {@link Short}.
* @see AbstractSignedInteger
*/
public final class Int16 extends AbstractSignedInteger {
* @see AbstractSignedInteger
*/
public final class Int16 extends AbstractSignedInteger {
- @Override
- public IntegerTypeDefinition getBaseType() {
- return this;
- }
-
@Override
public Object getDefaultValue() {
return null;
@Override
public Object getDefaultValue() {
return null;
package org.opendaylight.yangtools.yang.model.util;
import org.opendaylight.yangtools.yang.common.QName;
package org.opendaylight.yangtools.yang.model.util;
import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.type.IntegerTypeDefinition;
/**
* Implementation of Yang int32 built-in type. <br>
* int32 represents integer values between -2147483648 and 2147483647,
* inclusively. The Java counterpart of Yang int32 built-in type is
* {@link Integer}.
/**
* Implementation of Yang int32 built-in type. <br>
* int32 represents integer values between -2147483648 and 2147483647,
* inclusively. The Java counterpart of Yang int32 built-in type is
* {@link Integer}.
* @see AbstractSignedInteger
* @see AbstractSignedInteger
*/
public final class Int32 extends AbstractSignedInteger {
private static Int32 instance;
*/
public final class Int32 extends AbstractSignedInteger {
private static Int32 instance;
- @Override
- public IntegerTypeDefinition getBaseType() {
- return this;
- }
-
@Override
public Object getDefaultValue() {
return null;
@Override
public Object getDefaultValue() {
return null;
package org.opendaylight.yangtools.yang.model.util;
import org.opendaylight.yangtools.yang.common.QName;
package org.opendaylight.yangtools.yang.model.util;
import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.type.IntegerTypeDefinition;
/**
* Implementation of Yang int64 built-in type. <br>
* int64 represents integer values between -9223372036854775808 and
* 9223372036854775807, inclusively. The Java counterpart of Yang int64 built-in
* type is {@link Long}.
/**
* Implementation of Yang int64 built-in type. <br>
* int64 represents integer values between -9223372036854775808 and
* 9223372036854775807, inclusively. The Java counterpart of Yang int64 built-in
* type is {@link Long}.
*/
public final class Int64 extends AbstractSignedInteger {
private static Int64 instance;
*/
public final class Int64 extends AbstractSignedInteger {
private static Int64 instance;
- @Override
- public IntegerTypeDefinition getBaseType() {
- return this;
- }
-
@Override
public Object getDefaultValue() {
return null;
@Override
public Object getDefaultValue() {
return null;
package org.opendaylight.yangtools.yang.model.util;
import org.opendaylight.yangtools.yang.common.QName;
package org.opendaylight.yangtools.yang.model.util;
import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.type.IntegerTypeDefinition;
/**
* Implementation of Yang int8 built-in type. <br>
* int8 represents integer values between -128 and 127, inclusively. The Java
* counterpart of Yang int8 built-in type is {@link Byte}.
/**
* Implementation of Yang int8 built-in type. <br>
* int8 represents integer values between -128 and 127, inclusively. The Java
* counterpart of Yang int8 built-in type is {@link Byte}.
* @see AbstractSignedInteger
*/
public final class Int8 extends AbstractSignedInteger {
* @see AbstractSignedInteger
*/
public final class Int8 extends AbstractSignedInteger {
- @Override
- public IntegerTypeDefinition getBaseType() {
- return this;
- }
-
@Override
public Object getDefaultValue() {
return null;
@Override
public Object getDefaultValue() {
return null;
@Override
public LeafrefTypeDefinition getBaseType() {
@Override
public LeafrefTypeDefinition getBaseType() {
/**
* The <code>default</code> implementation of String Type Definition interface.
/**
* The <code>default</code> implementation of String Type Definition interface.
* @see StringTypeDefinition
*/
public final class StringType implements StringTypeDefinition {
* @see StringTypeDefinition
*/
public final class StringType implements StringTypeDefinition {
* @see
* org.opendaylight.yangtools.yang.model.api.TypeDefinition#getBaseType()
*/
@Override
public StringTypeDefinition getBaseType() {
* @see
* org.opendaylight.yangtools.yang.model.api.TypeDefinition#getBaseType()
*/
@Override
public StringTypeDefinition getBaseType() {
* @see org.opendaylight.yangtools.yang.model.api.TypeDefinition#getUnits()
*/
@Override
* @see org.opendaylight.yangtools.yang.model.api.TypeDefinition#getUnits()
*/
@Override
* @see
* org.opendaylight.yangtools.yang.model.api.TypeDefinition#getDefaultValue
* ()
* @see
* org.opendaylight.yangtools.yang.model.api.TypeDefinition#getDefaultValue
* ()
* @see org.opendaylight.yangtools.yang.model.api.SchemaNode#getQName()
*/
@Override
* @see org.opendaylight.yangtools.yang.model.api.SchemaNode#getQName()
*/
@Override
* @see org.opendaylight.yangtools.yang.model.api.SchemaNode#getPath()
*/
@Override
* @see org.opendaylight.yangtools.yang.model.api.SchemaNode#getPath()
*/
@Override
* @see
* org.opendaylight.yangtools.yang.model.api.SchemaNode#getDescription()
*/
* @see
* org.opendaylight.yangtools.yang.model.api.SchemaNode#getDescription()
*/
* @see org.opendaylight.yangtools.yang.model.api.SchemaNode#getReference()
*/
@Override
* @see org.opendaylight.yangtools.yang.model.api.SchemaNode#getReference()
*/
@Override
* @see org.opendaylight.yangtools.yang.model.api.SchemaNode#getStatus()
*/
@Override
* @see org.opendaylight.yangtools.yang.model.api.SchemaNode#getStatus()
*/
@Override
* @see
* com.csico.yang.model.base.type.api.StringTypeDefinition#getLengthStatements
* ()
* @see
* com.csico.yang.model.base.type.api.StringTypeDefinition#getLengthStatements
* ()
* @see
* com.csico.yang.model.base.type.api.StringTypeDefinition#getPatterns()
*/
* @see
* com.csico.yang.model.base.type.api.StringTypeDefinition#getPatterns()
*/
package org.opendaylight.yangtools.yang.model.util;
import org.opendaylight.yangtools.yang.common.QName;
package org.opendaylight.yangtools.yang.model.util;
import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.type.UnsignedIntegerTypeDefinition;
/**
* Implementation of Yang uint16 built-in type. <br>
* uint16 represents integer values between 0 and 65535, inclusively. The Java
* counterpart of Yang uint16 built-in type is {@link Integer}.
/**
* Implementation of Yang uint16 built-in type. <br>
* uint16 represents integer values between 0 and 65535, inclusively. The Java
* counterpart of Yang uint16 built-in type is {@link Integer}.
*/
public final class Uint16 extends AbstractUnsignedInteger {
public static final int MAX_VALUE = 65535;
*/
public final class Uint16 extends AbstractUnsignedInteger {
public static final int MAX_VALUE = 65535;
- @Override
- public UnsignedIntegerTypeDefinition getBaseType() {
- return this;
- }
-
@Override
public Object getDefaultValue() {
return null;
@Override
public Object getDefaultValue() {
return null;
package org.opendaylight.yangtools.yang.model.util;
import org.opendaylight.yangtools.yang.common.QName;
package org.opendaylight.yangtools.yang.model.util;
import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.type.UnsignedIntegerTypeDefinition;
/**
* Implementation of Yang uint32 built-in type. <br>
* uint32 represents integer values between 0 and 4294967295, inclusively.
/**
* Implementation of Yang uint32 built-in type. <br>
* uint32 represents integer values between 0 and 4294967295, inclusively.
*/
public final class Uint32 extends AbstractUnsignedInteger {
public static final long MAX_VALUE = 4294967295L;
*/
public final class Uint32 extends AbstractUnsignedInteger {
public static final long MAX_VALUE = 4294967295L;
- @Override
- public UnsignedIntegerTypeDefinition getBaseType() {
- return this;
- }
-
@Override
public Object getDefaultValue() {
return null;
@Override
public Object getDefaultValue() {
return null;
import java.math.BigInteger;
import org.opendaylight.yangtools.yang.common.QName;
import java.math.BigInteger;
import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.type.UnsignedIntegerTypeDefinition;
/**
* Implementation of Yang uint64 built-in type. <br>
* uint64 represents integer values between 0 and 18446744073709551615,
* inclusively. The Java counterpart of Yang uint64 built-in type is
* {@link BigInteger}.
/**
* Implementation of Yang uint64 built-in type. <br>
* uint64 represents integer values between 0 and 18446744073709551615,
* inclusively. The Java counterpart of Yang uint64 built-in type is
* {@link BigInteger}.
*/
public final class Uint64 extends AbstractUnsignedInteger {
public static final BigInteger MAX_VALUE = new BigInteger("18446744073709551615");
*/
public final class Uint64 extends AbstractUnsignedInteger {
public static final BigInteger MAX_VALUE = new BigInteger("18446744073709551615");
- @Override
- public UnsignedIntegerTypeDefinition getBaseType() {
- return this;
- }
-
@Override
public Object getDefaultValue() {
return null;
@Override
public Object getDefaultValue() {
return null;
package org.opendaylight.yangtools.yang.model.util;
import org.opendaylight.yangtools.yang.common.QName;
package org.opendaylight.yangtools.yang.model.util;
import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.type.UnsignedIntegerTypeDefinition;
/**
* Implementation of Yang uint8 built-in type. <br>
* uint8 represents integer values between 0 and 255, inclusively.
/**
* Implementation of Yang uint8 built-in type. <br>
* uint8 represents integer values between 0 and 255, inclusively.
* @see AbstractUnsignedInteger
*/
public final class Uint8 extends AbstractUnsignedInteger {
* @see AbstractUnsignedInteger
*/
public final class Uint8 extends AbstractUnsignedInteger {
- @Override
- public UnsignedIntegerTypeDefinition getBaseType() {
- return this;
- }
-
@Override
public Object getDefaultValue() {
return null;
@Override
public Object getDefaultValue() {
return null;
@Override
public UnionTypeDefinition getBaseType() {
@Override
public UnionTypeDefinition getBaseType() {
package org.opendaylight.yangtools.yang.model.util;
import static org.junit.Assert.*;
package org.opendaylight.yangtools.yang.model.util;
import static org.junit.Assert.*;
import org.junit.Test;
public class Int8Test {
import org.junit.Test;
public class Int8Test {
Int8 int8 = Int8.getInstance();
Int8 int8Second = Int8.getInstance();
assertTrue("The method 'getInstance()' has to return the same instance", int8 == int8Second);
Int8 int8 = Int8.getInstance();
Int8 int8Second = Int8.getInstance();
assertTrue("The method 'getInstance()' has to return the same instance", int8 == int8Second);
- assertTrue("The method 'getBaseType()' is returning incorrect value", int8.getBaseType() == int8);
+ assertTrue("The method 'getBaseType()' is returning incorrect value", int8.getBaseType() == null);
assertTrue("The method 'getDefaultType()' is returning incorrect value", int8.getDefaultValue() == null);
assertEquals("The method 'toString()' is returning incorrect value",
"type (urn:ietf:params:xml:ns:yang:1)int8", int8.toString());
assertTrue("The method 'getDefaultType()' is returning incorrect value", int8.getDefaultValue() == null);
assertEquals("The method 'toString()' is returning incorrect value",
"type (urn:ietf:params:xml:ns:yang:1)int8", int8.toString());