/**
* <code>Type</code> representation of <code>uint8</code> YANG type
*/
- public static final Type UINT8_TYPE = Types.typeForClass(Short.class, singleRangeRestrictions(0, 255));
+ public static final Type UINT8_TYPE = Types.typeForClass(Short.class, singleRangeRestrictions((short)0, (short)255));
/**
* <code>Type</code> representation of <code>uint16</code> YANG type
/**
* <code>Type</code> representation of <code>uint32</code> YANG type
*/
- public static final Type UINT32_TYPE = Types.typeForClass(Long.class, singleRangeRestrictions(0, 4294967295L));
+ public static final Type UINT32_TYPE = Types.typeForClass(Long.class, singleRangeRestrictions(0L, 4294967295L));
/**
* <code>Type</code> representation of <code>uint64</code> YANG type
*/
public static final Type UINT64_TYPE = Types.typeForClass(BigInteger.class,
- singleRangeRestrictions(0, new BigInteger("18446744073709551615")));
+ singleRangeRestrictions(BigInteger.ZERO, new BigInteger("18446744073709551615")));
public static final Type UNION_TYPE = new UnionType();
}
};
- private static Restrictions singleRangeRestrictions(final Number min, final Number max) {
+ private static <T extends Number> Restrictions singleRangeRestrictions(final T min, final T max) {
return new Restrictions() {
@Override
public boolean isEmpty() {
*/
package org.opendaylight.yangtools.yang.model.util;
+import com.google.common.base.Optional;
import org.opendaylight.yangtools.yang.model.api.type.LengthConstraint;
import org.opendaylight.yangtools.yang.model.api.type.PatternConstraint;
import org.opendaylight.yangtools.yang.model.api.type.RangeConstraint;
-import com.google.common.base.Optional;
-
/**
* Utility class which provides factory methods to construct Constraints.
*
*
* @see RangeConstraint
*
+ * @param <T> Type of constraint
* @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. {@link Optional#absent()} if description is undefined.
* @param reference Reference associated with constraint. {@link Optional#absent()} if reference is undefined.
* @return Instance of {@link RangeConstraint}
*/
- public static RangeConstraint newRangeConstraint(final Number min, final Number max, final Optional<String> description,
+ public static <T extends Number> RangeConstraint newRangeConstraint(final T min, final T max, final Optional<String> description,
final Optional<String> reference) {
return new RangeConstraintImpl(min, max, description, reference);
}