*
* Provides static factory methods which constructs instances of
* <ul>
- * <li>{@link LengthConstraint} - {@link #lengthConstraint(Number, Number, String, String)}
- * <li>{@link RangeConstraint} - {@link #rangeConstraint(Number, Number, String, String)}
- * <li>{@link PatternConstraint} - {@link #patternConstraint(String, String, String)}
+ * <li>{@link LengthConstraint} - {@link #newLengthConstraint(Number, Number, Optional, Optional)}
+ * <li>{@link RangeConstraint} - {@link #newRangeConstraint(Number, Number, Optional, Optional)}
+ * <li>{@link PatternConstraint} - {@link #newPatternConstraint(String, Optional, Optional)}
* </ul>
*/
public final class BaseConstraints {
-
private BaseConstraints() {
+ throw new UnsupportedOperationException();
}
-
/**
* Creates a {@link LengthConstraint}.
*
return new RangeConstraintImpl(min, max, description, reference);
}
-
/**
* Creates a {@link PatternConstraint}.
*
final Optional<String> reference) {
return new PatternConstraintImpl(pattern, description, reference);
}
-
-
- /**
- * Creates a {@link LengthConstraint}.
- *
- * Creates an instance of Length constraint based on supplied parameters
- * with additional behaviour:
- *
- * <ul>
- * <li>{@link LengthConstraint#getErrorAppTag()} returns <code>length-out-of-specified-bounds</code>
- * <li>{@link LengthConstraint#getErrorMessage()} returns <code>The argument is out of bounds <<i>min</i>, <i>max</i> ></code>
- * </ul>
- *
- * @see LengthConstraint
- *
- * @param min length-restricting lower bound value. The value MUST NOT be negative.
- * @param max length-restricting upper bound value. The value MUST NOT be negative.
- * @param description Description associated with constraint.
- * @param reference Reference associated with constraint.
- * @return Instance of {@link LengthConstraint}
- * @deprecated Use {@link #newLengthConstraint(Number, Number, Optional, Optional)} instead.
- */
- @Deprecated
- public static LengthConstraint lengthConstraint(final Number min, final Number max, final String description,
- final String reference) {
- return newLengthConstraint(min, max, Optional.fromNullable(description), Optional.fromNullable(reference));
- }
-
- /**
- * Creates a {@link RangeConstraint}.
- *
- * Creates an instance of Range constraint based on supplied parameters
- * with additional behaviour:
- *
- * <ul>
- * <li>{@link RangeConstraint#getErrorAppTag()} returns <code>range-out-of-specified-bounds</code>
- * <li>{@link RangeConstraint#getErrorMessage()} returns <code>The argument is out of bounds <<i>min</i>, <i>max</i> ></code>
- * </ul>
- *
- *
- * @see RangeConstraint
- *
- * @param min value-restricting lower bound value. The value MUST NOT Be null.
- * @param max value-restricting upper bound value. The value MUST NOT Be null.
- * @param description Description associated with constraint.
- * @param reference Reference associated with constraint.
- * @return Instance of {@link RangeConstraint}
- * @deprecated Use {@link #newRangeConstraint(Number, Number, Optional, Optional)} instead.
- */
- @Deprecated
- public static RangeConstraint rangeConstraint(final Number min, final Number max, final String description,
- final String reference) {
- return newRangeConstraint(min, max, Optional.fromNullable(description), Optional.fromNullable(reference));
- }
-
- /**
- * Creates a {@link PatternConstraint}.
- *
- * Creates an instance of Range constraint based on supplied parameters
- * with additional behaviour:
- *
- * <ul>
- * <li>{@link PatternConstraint#getErrorAppTag()} returns <code>invalid-regular-expression</code>
- * </ul>
- *
- *
- * @see PatternConstraint
- *
- * @param pattern Regular expression, MUST NOT
- * @param description Description associated with constraint.
- * @param reference Reference associated with constraint.
- * @return Instance of {@link PatternConstraint}
- * @deprecated Use {@link #newPatternConstraint(String, Optional, Optional)} Instead.
- */
- @Deprecated
- public static PatternConstraint patternConstraint(final String pattern, final String description,
- final String reference) {
- return newPatternConstraint(pattern, Optional.fromNullable(description), Optional.fromNullable(reference));
- }
}
import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableSet;
-
import java.net.URI;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
import java.util.Set;
-
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.QNameModule;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
/**
public static final QName UINT64_QNAME = constructQName("uint64");
public static final QName UNION_QNAME = constructQName("union");
- private static final Set<String> BUILD_IN_TYPES = ImmutableSet.<String> builder().add(BINARY_QNAME.getLocalName()) //
- .add(BITS_QNAME.getLocalName()) //
- .add(BOOLEAN_QNAME.getLocalName()) //
- .add(DECIMAL64_QNAME.getLocalName()) //
- .add(EMPTY_QNAME.getLocalName()) //
- .add(ENUMERATION_QNAME.getLocalName()) //
- .add(IDENTITYREF_QNAME.getLocalName()) //
- .add(INSTANCE_IDENTIFIER_QNAME.getLocalName()) //
- .add(INT8_QNAME.getLocalName()) //
- .add(INT16_QNAME.getLocalName()) //
- .add(INT32_QNAME.getLocalName()) //
- .add(INT64_QNAME.getLocalName()) //
- .add(LEAFREF_QNAME.getLocalName()) //
- .add(STRING_QNAME.getLocalName()) //
- .add(UINT8_QNAME.getLocalName()) //
- .add(UINT16_QNAME.getLocalName()) //
- .add(UINT32_QNAME.getLocalName()) //
- .add(UINT64_QNAME.getLocalName()) //
- .add(UNION_QNAME.getLocalName()) //
+ private static final Set<String> BUILD_IN_TYPES = ImmutableSet.<String> builder()
+ .add(BINARY_QNAME.getLocalName())
+ .add(BITS_QNAME.getLocalName())
+ .add(BOOLEAN_QNAME.getLocalName())
+ .add(DECIMAL64_QNAME.getLocalName())
+ .add(EMPTY_QNAME.getLocalName())
+ .add(ENUMERATION_QNAME.getLocalName())
+ .add(IDENTITYREF_QNAME.getLocalName())
+ .add(INSTANCE_IDENTIFIER_QNAME.getLocalName())
+ .add(INT8_QNAME.getLocalName())
+ .add(INT16_QNAME.getLocalName())
+ .add(INT32_QNAME.getLocalName())
+ .add(INT64_QNAME.getLocalName())
+ .add(LEAFREF_QNAME.getLocalName())
+ .add(STRING_QNAME.getLocalName())
+ .add(UINT8_QNAME.getLocalName())
+ .add(UINT16_QNAME.getLocalName())
+ .add(UINT32_QNAME.getLocalName())
+ .add(UINT64_QNAME.getLocalName())
+ .add(UNION_QNAME.getLocalName())
.build();
/**
* @return built-in base yang type QName.
*/
public static QName constructQName(final String typeName) {
- return QName.create(BASE_TYPES_MODULE, typeName);
- }
-
- /**
- * Creates Schema Path from {@link QName}.
- *
- * @param typeName
- * yang type QName
- * @return Schema Path from Qname.
- * @deprecated Use {@link SchemaPath#create(boolean, QName...)} instead.
- */
- @Deprecated
- public static SchemaPath schemaPath(final QName typeName) {
- return SchemaPath.create(true, typeName);
- }
-
- /**
- * Creates Schema Path from List of partial paths defined as Strings, module
- * Namespace and module latest Revision Date.
- *
- * @param actualPath
- * List of partial paths
- * @param namespace
- * Module Namespace
- * @param revision
- * Revision Date
- * @return Schema Path
- *
- * @deprecated Use {@link SchemaPath#create(Iterable, boolean)} with QNames
- * manually constructed.
- */
- @Deprecated
- public static SchemaPath schemaPath(final List<String> actualPath, final URI namespace, final Date revision) {
- if (actualPath == null) {
- throw new IllegalArgumentException("The actual path List MUST be specified.");
- }
- final List<QName> pathList = new ArrayList<QName>();
- for (final String path : actualPath) {
- final QName qname = QName.create(namespace, revision, path);
- if (qname != null) {
- pathList.add(qname);
- }
- }
- return SchemaPath.create(pathList, true);
+ return QName.cachedReference(QName.create(BASE_TYPES_MODULE, typeName));
}
/**
private final SchemaPath path;
private final List<Bit> bits;
- /**
- * Default constructor. <br>
- * Instantiates Bits type as empty bits list.
- *
- * @param path
- * @deprecated Use static factory method {@link #create(SchemaPath, List)} instead.
- */
- @Deprecated
- public BitsType(final SchemaPath path) {
- super();
- this.bits = Collections.emptyList();
- this.path = Preconditions.checkNotNull(path,"path must not be null");
- }
-
/**
* Constructor with explicit definition of bits assigned to BitsType.
*
* @param path
* @param bits
- * @deprecated Use static factory method {@link #create(SchemaPath, List)} instead.
*/
- @Deprecated
- public BitsType(final SchemaPath path, final List<Bit> bits) {
+ private BitsType(final SchemaPath path, final List<Bit> bits) {
super();
this.bits = ImmutableList.copyOf(bits);
- this.path = Preconditions.checkNotNull(path,"path must not be null");
+ this.path = Preconditions.checkNotNull(path, "path must not be null");
}
public static BitsType create(final SchemaPath path, final List<Bit> bits) {
*
* @see DecimalTypeDefinition
* @exception IllegalArgumentException
- * @deprecated Use static factory {@link #create(SchemaPath, Integer)}.
*/
- @Deprecated
- public Decimal64(final SchemaPath path, final Integer fractionDigits) {
+ private Decimal64(final SchemaPath path, final Integer fractionDigits) {
if (!((fractionDigits.intValue() >= 1) && (fractionDigits.intValue() <= MAX_NUMBER_OF_FRACTION_DIGITS))) {
throw new IllegalArgumentException(
"The fraction digits outside of boundaries. Fraction digits MUST be integer between 1 and 18 inclusively");
*/
package org.opendaylight.yangtools.yang.model.util;
+import com.google.common.base.Optional;
+import com.google.common.base.Preconditions;
+import com.google.common.collect.ImmutableList;
import java.util.Collections;
import java.util.List;
-
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.model.api.SchemaPath;
import org.opendaylight.yangtools.yang.model.api.Status;
import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
import org.opendaylight.yangtools.yang.model.api.type.EnumTypeDefinition;
-import com.google.common.base.Optional;
-import com.google.common.base.Preconditions;
-import com.google.common.collect.ImmutableList;
-
/**
* The <code>default</code> implementation of Enumeration Type Definition
* interface.
private final EnumPair defaultEnum;
private final List<EnumPair> enums;
-
- /**
- * Constructs EnumerationType
- *
- * @param path
- * @param enums
- * @deprecated Use {@link #create(SchemaPath, List, Optional)} instead.
- */
- @Deprecated
- public EnumerationType(final SchemaPath path, final List<EnumPair> enums) {
- this(path,enums,Optional.<EnumPair>absent());
- }
-
- /**
- * Constructs EnumerationType
- *
- * @param path
- * @param defaultEnum
- * @param enums
- * @deprecated Use {@link #create(SchemaPath, List, Optional)} instead.
- */
- @Deprecated
- public EnumerationType(final SchemaPath path, final EnumPair defaultEnum, final List<EnumPair> enums) {
- this(path,enums,Optional.fromNullable(defaultEnum));
- }
-
private EnumerationType(final SchemaPath path, final List<EnumPair> enums, final Optional<EnumPair> defaultEnum) {
this.path = Preconditions.checkNotNull(path,"path must not be null");
this.enums = ImmutableList.copyOf(Preconditions.checkNotNull(enums, "enums must not be null."));
}
/**
- *
- * Constructs new enumeration
+ * Constructs a new enumeration
*
* @param path Schema Path to definition point of this enumeration
* @param enums List of defined enumeration values
* @param defaultValue {@link Optional#of(Object)} of default value, {@link Optional#absent()} if no default value is defined.
* If defaultValue is set, it must be present in provided list of enumerations.
- *
*/
public static EnumerationType create(final SchemaPath path, final List<EnumPair> enums, final Optional<EnumPair> defaultValue) {
return new EnumerationType(path, enums, defaultValue);
* (non-Javadoc)
*
* @see
- * org.opendaylight.yangtools.yang.model.api.TypeDefinition#getDefaultValue
- * ()
+ * org.opendaylight.yangtools.yang.model.api.TypeDefinition#getDefaultValue()
*/
@Override
public Object getDefaultValue() {
* (non-Javadoc)
*
* @see
- * org.opendaylight.yangtools.yang.model.base.type.api.EnumTypeDefinition
- * #getValues()
+ * org.opendaylight.yangtools.yang.model.base.type.api.EnumTypeDefinition#getValues()
*/
@Override
public List<EnumPair> getValues() {
import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
-
-import java.net.URI;
import java.util.Collections;
-import java.util.Date;
import java.util.List;
-
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.model.api.SchemaPath;
import org.opendaylight.yangtools.yang.model.api.Status;
private final String reference;
private final List<UnknownSchemaNode> unknownSchemaNodes;
- private List<RangeConstraint> ranges = Collections.emptyList();
- private List<LengthConstraint> lengths = Collections.emptyList();
- private List<PatternConstraint> patterns = Collections.emptyList();
- private Integer fractionDigits = null;
-
private final Status status;
private final String units;
private final Object defaultValue;
private final boolean addedByUses;
+ private List<RangeConstraint> ranges = Collections.emptyList();
+ private List<LengthConstraint> lengths = Collections.emptyList();
+ private List<PatternConstraint> patterns = Collections.emptyList();
+ private Integer fractionDigits = null;
+
/**
*
* Creates Builder for extended / derived type.
* @param reference Reference of Type
* @param path Schema path to type definition.
*/
- public static final Builder builder(final QName typeName,final TypeDefinition<?> baseType,final Optional<String> description,final Optional<String> reference,final SchemaPath path) {
+ public static final Builder builder(final QName typeName, final TypeDefinition<?> baseType,
+ final Optional<String> description, final Optional<String> reference, final SchemaPath path) {
return new Builder(typeName, baseType, description.or(""), reference.or(""), path);
}
private Integer fractionDigits = null;
/**
- *
- * @param actualPath
- * @param namespace
- * @param revision
- * @param typeName
- * @param baseType
- * @param description
- * @param reference
- *
- * @deprecated Use {@link ExtendedType#builder(QName, TypeDefinition, Optional, Optional, SchemaPath)} instead.
- */
- @Deprecated
- public Builder(final List<String> actualPath, final URI namespace,
- final Date revision, final QName typeName,
- final TypeDefinition<?> baseType, final String description,
- final String reference) {
- this(typeName,baseType,description,reference,BaseTypes.schemaPath(actualPath, namespace, revision));
- }
-
- /**
- *
* Creates Builder for extended / derived type.
*
* @param typeName QName of derived type
* @param description Description of type
* @param reference Reference of Type
* @param path Schema path to type definition.
- *
- * @deprecated Use {@link ExtendedType#builder(QName, TypeDefinition, Optional, Optional, SchemaPath)} instead.
*/
- @Deprecated
- public Builder(final QName typeName, final TypeDefinition<?> baseType,
+ protected Builder(final QName typeName, final TypeDefinition<?> baseType,
final String description, final String reference,
final SchemaPath path) {
this.typeName = Preconditions.checkNotNull(typeName, "type name must not be null.");
*/
package org.opendaylight.yangtools.yang.model.util;
+import com.google.common.base.Preconditions;
import java.util.Collections;
import java.util.List;
-
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.model.api.IdentitySchemaNode;
import org.opendaylight.yangtools.yang.model.api.SchemaPath;
import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
import org.opendaylight.yangtools.yang.model.api.type.IdentityrefTypeDefinition;
-import com.google.common.base.Preconditions;
-
/**
* The <code>default</code> implementation of Identityref Type Definition
* interface.
*/
public final class IdentityrefType implements IdentityrefTypeDefinition {
private static final QName NAME = BaseTypes.IDENTITYREF_QNAME;
- 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 IdentitySchemaNode identity;
private static final String UNITS = "";
- /**
- * Constructs new {@link IdentityrefTypeDefinition} definition.
- *
- * @param identity
- * @param schemaPath
- */
- @Deprecated
- public IdentityrefType(final IdentitySchemaNode identity, final SchemaPath schemaPath) {
- this(schemaPath,identity);
- }
+ private final IdentitySchemaNode identity;
+ private final SchemaPath path;
private IdentityrefType(final SchemaPath path, final IdentitySchemaNode baseIdentity) {
this.path = Preconditions.checkNotNull(path, "Path must be specified");
}
/**
- *
- * Constructs new {@link IdentityrefTypeDefinition} definition.
+ * Constructs a new {@link IdentityrefTypeDefinition} definition.
*
* @param path Path to the definition.
* @param baseIdentity Base Identity, all derived identities are valid arguments for instance of this type.
public String toString() {
return "identityref " + identity.getQName().getLocalName();
}
-
}
import java.util.Collections;
import java.util.List;
-
import org.opendaylight.yangtools.concepts.Immutable;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.model.api.RevisionAwareXPath;
private static final String DESCRIPTION = "The instance-identifier built-in type is used to "
+ "uniquely identify a particular instance node in the data tree.";
private static final String REFERENCE = "https://tools.ietf.org/html/rfc6020#section-9.13";
-
private static final String UNITS = "";
- private final Boolean requireInstance;
private static final InstanceIdentifierType INSTANCE_WITH_REQUIRED_TRUE = new InstanceIdentifierType(true);
private static final InstanceIdentifierType INSTANCE_WITH_REQUIRED_FALSE = new InstanceIdentifierType(false);
- /**
- * Constructs new instance identifier.
- *
- * @param xpath
- * @deprecated Use {@link #getInstance()} for default one, since Instance Identifier does not have xpath.
- */
- @Deprecated
- public InstanceIdentifierType(final RevisionAwareXPath xpath) {
- requireInstance = true;
- }
-
- /**
- * Constructs new instance identifier.
- *
- * @param xpath
- * @param requireInstance if instance of data is required
- * @deprecated Use {@link #create(boolean)}, since Instance Identifier does not have xpath.
- */
- @Deprecated
- public InstanceIdentifierType(final RevisionAwareXPath xpath, final boolean requireInstance) {
- this.requireInstance = requireInstance;
- }
+ private final Boolean requireInstance;
private InstanceIdentifierType(final boolean requiredInstance) {
this.requireInstance = requiredInstance;
* (non-Javadoc)
*
* @see
- * org.opendaylight.yangtools.yang.model.api.TypeDefinition#getDefaultValue
- * ()
+ * org.opendaylight.yangtools.yang.model.api.TypeDefinition#getDefaultValue()
*/
@Override
public Object getDefaultValue() {
* (non-Javadoc)
*
* @see
- * org.opendaylight.yangtools.yang.model.api.SchemaNode#getExtensionSchemaNodes
- * ()
+ * org.opendaylight.yangtools.yang.model.api.SchemaNode#getExtensionSchemaNodes()
*/
@Override
public List<UnknownSchemaNode> getUnknownSchemaNodes() {
InstanceIdentifierType other = (InstanceIdentifierType) obj;
return requireInstance.equals(other.requireInstance);
}
-
-
-
}
@Deprecated
public Leafref(final RevisionAwareXPath xpath) {
- this(PATH,xpath);
-
+ this(PATH, xpath);
}
private Leafref(final SchemaPath path, final RevisionAwareXPath target) {
this.xpath = Preconditions.checkNotNull(target,"target must not be null.");
}
- public static Leafref create(final SchemaPath path,final RevisionAwareXPath target) {
+ public static Leafref create(final SchemaPath path, final RevisionAwareXPath target) {
return new Leafref(path,target);
}
*/
package org.opendaylight.yangtools.yang.model.util;
-import org.opendaylight.yangtools.yang.model.api.MustDefinition;
-import org.opendaylight.yangtools.yang.model.api.RevisionAwareXPath;
-
import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
+import org.opendaylight.yangtools.yang.model.api.MustDefinition;
+import org.opendaylight.yangtools.yang.model.api.RevisionAwareXPath;
/**
- *
* Immutable implementation of {@link MustDefinition}
- *
*/
public final class MustDefinitionImpl implements MustDefinition {
private final String mustStr;
private final String errorMessage;
/**
- *
* Creates new Must Definition
*
* @param mustStr must string statement, Must not be null.
* @param reference Reference for condition
* @param errorAppTag error application tag which should be used for error reporting when condition fails
* @param errorMessage message which should be used for error reporting when condition fails
- * @deprecated Use {@link #create(String, Optional, Optional, Optional, Optional)} instead.
*/
- @Deprecated
- public MustDefinitionImpl(final String mustStr, final String description, final String reference, final String errorAppTag, final String errorMessage) {
+ private MustDefinitionImpl(final String mustStr, final String description, final String reference, final String errorAppTag, final String errorMessage) {
this.mustStr = Preconditions.checkNotNull(mustStr);
this.description = description;
this.reference = reference;
* @param errorAppTag error application tag which should be used for error reporting when condition fails
* @param errorMessage message which should be used for error reporting when condition fails
*/
- public static MustDefinitionImpl create(final String mustStr, final Optional<String> description, final Optional<String> reference, final Optional<String> errorAppTag, final Optional<String> errorMessage) {
+ public static MustDefinitionImpl create(final String mustStr, final Optional<String> description,
+ final Optional<String> reference, final Optional<String> errorAppTag, final Optional<String> errorMessage) {
return new MustDefinitionImpl(mustStr, description.orNull(), reference.orNull(), errorAppTag.orNull(), errorMessage.orNull());
}
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
-
import java.util.Collections;
import java.util.List;
-
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.model.api.SchemaPath;
import org.opendaylight.yangtools.yang.model.api.Status;
private static final String REFERENCE = "https://tools.ietf.org/html/rfc6020#section-9.12";
private final List<TypeDefinition<?>> types;
- @Deprecated
- public UnionType(final List<TypeDefinition<?>> types) {
+ private UnionType(final List<TypeDefinition<?>> types) {
Preconditions.checkNotNull(types,"When the type is 'union', the 'type' statement MUST be present.");
this.types = ImmutableList.copyOf(types);
}
+++ /dev/null
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.model.util;
-
-import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
-
-/**
- * Utility class which provides various helper methods for working with YANG
- * built-in types.
- *
- * @deprecated Use {@link BaseTypes} instead.
- */
-@Deprecated
-public final class YangTypesConverter {
- /**
- * It isn't desirable to create the instances of this class
- */
- private YangTypesConverter() {
- }
-
- @Deprecated
- public static boolean isBaseYangType(final String type) {
- return BaseTypes.isYangBuildInType(type);
- }
-
- /**
- *
- * Returns default instance of built-in type for supplied string.
- *
- * @param typeName
- * @return default instance of built-in type for supplied string or null, if
- * default instance does not exist.
- *
- * @deprecated Use {@link BaseTypes#defaultBaseTypeFor(String)} instead.
- */
- @Deprecated
- public static TypeDefinition<?> javaTypeForBaseYangType(final String typeName) {
- return BaseTypes.defaultBaseTypeFor(typeName).orNull();
- }
-
-}
*/
package org.opendaylight.yangtools.yang.parser.util;
+import com.google.common.base.Optional;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collections;
if (max instanceof UnknownBoundaryNumber) {
max = resolveMaxRange(max);
}
- firstRange = BaseConstraints.rangeConstraint(min, max, firstRange.getDescription(),
- firstRange.getReference());
+ firstRange = BaseConstraints.newRangeConstraint(min, max,
+ Optional.fromNullable(firstRange.getDescription()),
+ Optional.fromNullable(firstRange.getReference()));
resolved.set(0, firstRange);
- lastRange = BaseConstraints.rangeConstraint(min, max, lastRange.getDescription(), lastRange.getReference());
+ lastRange = BaseConstraints.newRangeConstraint(min, max,
+ Optional.fromNullable(lastRange.getDescription()),
+ Optional.fromNullable(lastRange.getReference()));
resolved.set(resolved.size() - 1, lastRange);
} else {
if (min instanceof UnknownBoundaryNumber) {
min = resolveMinRange(min);
- firstRange = BaseConstraints.rangeConstraint(min, firstRange.getMax(), firstRange.getDescription(),
- firstRange.getReference());
+ firstRange = BaseConstraints.newRangeConstraint(min, firstRange.getMax(),
+ Optional.fromNullable(firstRange.getDescription()),
+ Optional.fromNullable(firstRange.getReference()));
resolved.set(0, firstRange);
}
if (max instanceof UnknownBoundaryNumber) {
max = resolveMaxRange(max);
- lastRange = BaseConstraints.rangeConstraint(lastRange.getMin(), max, lastRange.getDescription(),
- lastRange.getReference());
+ lastRange = BaseConstraints.newRangeConstraint(lastRange.getMin(), max,
+ Optional.fromNullable(lastRange.getDescription()),
+ Optional.fromNullable(lastRange.getReference()));
resolved.set(resolved.size() - 1, lastRange);
}
}
if (max instanceof UnknownBoundaryNumber) {
max = resolveMaxLength(max);
}
- firstLength = BaseConstraints.lengthConstraint(min, max, firstLength.getDescription(),
- firstLength.getReference());
+ firstLength = BaseConstraints.newLengthConstraint(min, max,
+ Optional.fromNullable(firstLength.getDescription()),
+ Optional.fromNullable(firstLength.getReference()));
resolved.set(0, firstLength);
- lastLength = BaseConstraints.lengthConstraint(min, max, lastLength.getDescription(),
- lastLength.getReference());
+ lastLength = BaseConstraints.newLengthConstraint(min, max,
+ Optional.fromNullable(lastLength.getDescription()),
+ Optional.fromNullable(lastLength.getReference()));
resolved.set(resolved.size() - 1, lastLength);
} else {
if (min instanceof UnknownBoundaryNumber) {
min = resolveMinLength(min);
- firstLength = BaseConstraints.lengthConstraint(min, firstLength.getMax(), firstLength.getDescription(),
- firstLength.getReference());
+ firstLength = BaseConstraints.newLengthConstraint(min, firstLength.getMax(),
+ Optional.fromNullable(firstLength.getDescription()),
+ Optional.fromNullable(firstLength.getReference()));
resolved.set(0, firstLength);
}
if (max instanceof UnknownBoundaryNumber) {
max = resolveMaxLength(max);
- lastLength = BaseConstraints.lengthConstraint(lastLength.getMin(), max, lastLength.getDescription(),
- lastLength.getReference());
+ lastLength = BaseConstraints.newLengthConstraint(lastLength.getMin(), max,
+ Optional.fromNullable(lastLength.getDescription()),
+ Optional.fromNullable(lastLength.getReference()));
resolved.set(resolved.size() - 1, lastLength);
}
}
validateRange(getRange());
}
- private void validateRange(List<RangeConstraint> typeRange) {
+ private void validateRange(final List<RangeConstraint> typeRange) {
if (ranges.size() < 2) {
return;
}
}
}
- private boolean areRangesSubintervalsOfParentRanges(List<RangeConstraint> parentRanges, final BigDecimal min,
+ private boolean areRangesSubintervalsOfParentRanges(final List<RangeConstraint> parentRanges, final BigDecimal min,
final BigDecimal max) {
boolean check = false;
for (RangeConstraint r : parentRanges) {
validateLength(getLength());
}
- private void validateLength(List<LengthConstraint> typeLength) {
+ private void validateLength(final List<LengthConstraint> typeLength) {
if (lengths.size() < 2) {
return;
}