BUG-865: Remove deprecated methods in yang.model.util 65/26965/3
authorRobert Varga <rovarga@cisco.com>
Mon, 14 Sep 2015 18:31:19 +0000 (20:31 +0200)
committerTony Tkacik <ttkacik@cisco.com>
Wed, 16 Sep 2015 16:55:10 +0000 (16:55 +0000)
These have been deprecated before Lithium shipped and can therefore be
removed.

Change-Id: Ia71b9343c7ef04f0424711c75581ce2ca5e3e770
Signed-off-by: Robert Varga <rovarga@cisco.com>
13 files changed:
yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/BaseConstraints.java
yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/BaseTypes.java
yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/BitsType.java
yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/Decimal64.java
yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/EnumerationType.java
yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/ExtendedType.java
yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/IdentityrefType.java
yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/InstanceIdentifierType.java
yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/Leafref.java
yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/MustDefinitionImpl.java
yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/UnionType.java
yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/YangTypesConverter.java [deleted file]
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/util/TypeConstraints.java

index 8a186ce8530921f5d0d9853ecd2da6b1214990e4..9b904c563e53ac231b881a1ae05c79244b2e3e8c 100644 (file)
@@ -17,17 +17,16 @@ import org.opendaylight.yangtools.yang.model.api.type.RangeConstraint;
  *
  * 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}.
      *
@@ -78,7 +77,6 @@ public final class BaseConstraints {
         return new RangeConstraintImpl(min, max, description, reference);
     }
 
-
     /**
      * Creates a {@link PatternConstraint}.
      *
@@ -100,83 +98,4 @@ public final class BaseConstraints {
             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 &lt;<i>min</i>, <i>max</i> &gt;</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 &lt;<i>min</i>, <i>max</i> &gt;</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));
-    }
 }
index 5f50f5e54a49d60a49feefa36c9ac94cdf315999..297ba539ec6ab51996eb6cf9a088ef70da473f35 100644 (file)
@@ -10,16 +10,10 @@ package org.opendaylight.yangtools.yang.model.util;
 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;
 
 /**
@@ -55,25 +49,26 @@ public final class BaseTypes {
     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();
 
     /**
@@ -85,50 +80,7 @@ public final class BaseTypes {
      * @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));
     }
 
     /**
index 32e55bfef031e81f6425df280ef29d83ccac2227..169175fdeb2a5905815e8f2274a807b79439b7d6 100644 (file)
@@ -33,32 +33,16 @@ public final class BitsType implements BitsTypeDefinition {
     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) {
index 7e8cb8f31ea1639aecbd9eee0dc1222ce86cc797..89f1e1a1960ad4b705d6cef2d7741783e91ecf7e 100644 (file)
@@ -73,10 +73,8 @@ public final class Decimal64 implements DecimalTypeDefinition {
      *
      * @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");
index 1bd020019fa8fe63704dbd47572e9c478674bc7f..91d2705c0f5069d3279d339c97bea2218a92c211 100644 (file)
@@ -7,19 +7,17 @@
  */
 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.
@@ -35,32 +33,6 @@ public final class EnumerationType implements EnumTypeDefinition {
     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."));
@@ -73,14 +45,12 @@ public final class EnumerationType implements EnumTypeDefinition {
     }
 
     /**
-     *
-     * 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);
@@ -111,8 +81,7 @@ public final class EnumerationType implements EnumTypeDefinition {
      * (non-Javadoc)
      *
      * @see
-     * org.opendaylight.yangtools.yang.model.api.TypeDefinition#getDefaultValue
-     * ()
+     * org.opendaylight.yangtools.yang.model.api.TypeDefinition#getDefaultValue()
      */
     @Override
     public Object getDefaultValue() {
@@ -174,8 +143,7 @@ public final class EnumerationType implements EnumTypeDefinition {
      * (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() {
index c4a7ffe3edab286c9396defec69cdb2edebc057b..875f463a8f0826f5e29f93cb43b6175fb22b43d3 100644 (file)
@@ -9,12 +9,8 @@ package org.opendaylight.yangtools.yang.model.util;
 
 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;
@@ -41,16 +37,16 @@ public class ExtendedType implements TypeDefinition<TypeDefinition<?>> {
     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.
@@ -61,7 +57,8 @@ public class ExtendedType implements TypeDefinition<TypeDefinition<?>> {
      * @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);
     }
 
@@ -86,27 +83,6 @@ public class ExtendedType implements TypeDefinition<TypeDefinition<?>> {
         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
@@ -114,11 +90,8 @@ public class ExtendedType implements TypeDefinition<TypeDefinition<?>> {
          * @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.");
index 16823e6708706682e24853627b07fc64581521f7..097e9ecb222e605707d4d814e20f9adc1f77bab0 100644 (file)
@@ -7,9 +7,9 @@
  */
 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;
@@ -17,8 +17,6 @@ import org.opendaylight.yangtools.yang.model.api.Status;
 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.
@@ -27,22 +25,12 @@ import com.google.common.base.Preconditions;
  */
 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");
@@ -50,8 +38,7 @@ public final class IdentityrefType implements IdentityrefTypeDefinition {
     }
 
     /**
-     *
-     * 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.
@@ -115,5 +102,4 @@ public final class IdentityrefType implements IdentityrefTypeDefinition {
     public String toString() {
         return "identityref " + identity.getQName().getLocalName();
     }
-
 }
index 02289efb0531f8b25931c5f513cec7379738baa4..a0f45d89c8283e2463ecc125dfe34e45879deb39 100644 (file)
@@ -9,7 +9,6 @@ package org.opendaylight.yangtools.yang.model.util;
 
 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;
@@ -36,35 +35,12 @@ public final class InstanceIdentifierType implements InstanceIdentifierTypeDefin
     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;
@@ -103,8 +79,7 @@ public final class InstanceIdentifierType implements InstanceIdentifierTypeDefin
      * (non-Javadoc)
      *
      * @see
-     * org.opendaylight.yangtools.yang.model.api.TypeDefinition#getDefaultValue
-     * ()
+     * org.opendaylight.yangtools.yang.model.api.TypeDefinition#getDefaultValue()
      */
     @Override
     public Object getDefaultValue() {
@@ -166,8 +141,7 @@ public final class InstanceIdentifierType implements InstanceIdentifierTypeDefin
      * (non-Javadoc)
      *
      * @see
-     * org.opendaylight.yangtools.yang.model.api.SchemaNode#getExtensionSchemaNodes
-     * ()
+     * org.opendaylight.yangtools.yang.model.api.SchemaNode#getExtensionSchemaNodes()
      */
     @Override
     public List<UnknownSchemaNode> getUnknownSchemaNodes() {
@@ -219,7 +193,4 @@ public final class InstanceIdentifierType implements InstanceIdentifierTypeDefin
         InstanceIdentifierType other = (InstanceIdentifierType) obj;
         return requireInstance.equals(other.requireInstance);
     }
-
-
-
 }
index 5a14d3097b7c2eb8fdf9c780e18fc3fb0582bf2e..16c45d01ba050eff06ab192789eae971cb59844b 100644 (file)
@@ -34,8 +34,7 @@ public final class Leafref implements LeafrefTypeDefinition {
 
     @Deprecated
     public Leafref(final RevisionAwareXPath xpath) {
-        this(PATH,xpath);
-
+        this(PATH, xpath);
     }
 
     private Leafref(final SchemaPath path, final RevisionAwareXPath target) {
@@ -43,7 +42,7 @@ public final class Leafref implements LeafrefTypeDefinition {
         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);
     }
 
index 38ebb1b05b67f35ce979bb34238fd84b65f4d8d7..3acb23041c14dce9bcc1caca712481ac1081cc34 100644 (file)
@@ -7,16 +7,13 @@
  */
 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;
@@ -26,7 +23,6 @@ public final class MustDefinitionImpl implements MustDefinition {
     private final String errorMessage;
 
     /**
-     *
      * Creates new Must Definition
      *
      * @param mustStr must string statement, Must not be null.
@@ -34,10 +30,8 @@ public final class MustDefinitionImpl implements MustDefinition {
      * @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;
@@ -55,7 +49,8 @@ public final class MustDefinitionImpl implements MustDefinition {
     * @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());
     }
 
index ec8edd3411763f3f14ac18885fdd70aced4c8fab..a27fc024efca760a2cf23c567fd93271f95821a5 100644 (file)
@@ -9,10 +9,8 @@ package org.opendaylight.yangtools.yang.model.util;
 
 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;
@@ -26,8 +24,7 @@ public final class UnionType implements UnionTypeDefinition {
     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);
     }
diff --git a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/YangTypesConverter.java b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/YangTypesConverter.java
deleted file mode 100644 (file)
index 98c63d0..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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();
-    }
-
-}
index 8ab8d163d17e677a496a822c4aef4c1b8cc823e3..ceb7cd8693defb5bd21cc09903cafd4cccafbc9f 100644 (file)
@@ -7,6 +7,7 @@
  */
 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;
@@ -57,22 +58,27 @@ public final class TypeConstraints {
             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);
             }
         }
@@ -139,23 +145,27 @@ public final class TypeConstraints {
             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);
             }
         }
@@ -225,7 +235,7 @@ public final class TypeConstraints {
         validateRange(getRange());
     }
 
-    private void validateRange(List<RangeConstraint> typeRange) {
+    private void validateRange(final List<RangeConstraint> typeRange) {
         if (ranges.size() < 2) {
             return;
         }
@@ -245,7 +255,7 @@ public final class TypeConstraints {
         }
     }
 
-    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) {
@@ -273,7 +283,7 @@ public final class TypeConstraints {
         validateLength(getLength());
     }
 
-    private void validateLength(List<LengthConstraint> typeLength) {
+    private void validateLength(final List<LengthConstraint> typeLength) {
         if (lengths.size() < 2) {
             return;
         }