import org.opendaylight.mdsal.binding.model.api.Type;
import org.opendaylight.mdsal.binding.model.api.WildcardType;
import org.opendaylight.yangtools.concepts.Builder;
-import org.opendaylight.yangtools.yang.binding.Augmentable;
import org.opendaylight.yangtools.yang.binding.Augmentation;
import org.opendaylight.yangtools.yang.model.api.type.LengthConstraint;
import org.opendaylight.yangtools.yang.model.api.type.PatternConstraint;
private static final @NonNull ConcreteType SERIALIZABLE = typeForClass(Serializable.class);
private static final @NonNull ConcreteType SET_TYPE = typeForClass(Set.class);
+ private static final @NonNull ConcreteType AUGMENTATION = typeForClass(Augmentation.class);
+
/**
* It is not desirable to create instance of this class.
*/
return parameterizedTypeFor(MAP_TYPE, keyType, valueType);
}
+ public static boolean isMapType(final ParameterizedType type) {
+ return MAP_TYPE.equals(type.getRawType());
+ }
+
+ public static boolean isMapType(final Type type) {
+ return type instanceof ParameterizedType && isMapType((ParameterizedType) type);
+ }
+
/**
* Returns an instance of {@link ParameterizedType} describing the typed {@link Set}<V> with concrete type
* of value.
return parameterizedTypeFor(LIST_TYPE, valueType);
}
+ public static boolean isListType(final ParameterizedType type) {
+ return LIST_TYPE.equals(type.getRawType());
+ }
+
public static boolean isListType(final Type type) {
- return type instanceof ParameterizedType && LIST_TYPE.equals(((ParameterizedType) type).getRawType());
+ return type instanceof ParameterizedType && isListType((ParameterizedType) type);
}
/**
* @return <code>ParametrizedType</code> representation of raw type
* <code>Augmentable</code> with actual parameter
* <code>valueType</code>
+ * @deprecated Use {@link BindingTypes#augmentable(Type)} instead.
*/
+ @Deprecated(forRemoval = true)
public static @NonNull ParameterizedType augmentableTypeFor(final Type valueType) {
- final Type augmentable = typeForClass(Augmentable.class);
- return parameterizedTypeFor(augmentable, valueType);
+ return BindingTypes.augmentable(valueType);
}
/**
* <code>valueType</code>
*/
public static @NonNull ParameterizedType augmentationTypeFor(final Type valueType) {
- final Type augmentation = typeForClass(Augmentation.class);
- return parameterizedTypeFor(augmentation, valueType);
+ return parameterizedTypeFor(AUGMENTATION, valueType);
}
public static @Nullable String getOuterClassName(final Type valueType) {