import static org.opendaylight.mdsal.binding.model.util.BindingTypes.RPC_SERVICE;
import static org.opendaylight.mdsal.binding.model.util.BindingTypes.action;
import static org.opendaylight.mdsal.binding.model.util.BindingTypes.augmentable;
+import static org.opendaylight.mdsal.binding.model.util.BindingTypes.augmentation;
import static org.opendaylight.mdsal.binding.model.util.BindingTypes.childOf;
import static org.opendaylight.mdsal.binding.model.util.BindingTypes.choiceIn;
import static org.opendaylight.mdsal.binding.model.util.BindingTypes.identifiable;
import static org.opendaylight.mdsal.binding.model.util.BindingTypes.rpcResult;
import static org.opendaylight.mdsal.binding.model.util.Types.BOOLEAN;
import static org.opendaylight.mdsal.binding.model.util.Types.STRING;
-import static org.opendaylight.mdsal.binding.model.util.Types.augmentationTypeFor;
import static org.opendaylight.mdsal.binding.model.util.Types.classType;
import static org.opendaylight.mdsal.binding.model.util.Types.listTypeFor;
import static org.opendaylight.mdsal.binding.model.util.Types.listenableFutureTypeFor;
augTypeBuilder.addImplementsType(DATA_OBJECT);
defaultImplementedInterace(augTypeBuilder);
- augTypeBuilder.addImplementsType(augmentationTypeFor(targetTypeRef));
+ augTypeBuilder.addImplementsType(augmentation(targetTypeRef));
annotateDeprecatedIfNecessary(augSchema, augTypeBuilder);
addImplementedInterfaceFromUses(augSchema, augTypeBuilder);
return parameterizedTypeFor(AUGMENTABLE, type);
}
+ /**
+ * Specialize {@link Augmentation} for a particular type.
+ *
+ * @param type Type for which to specialize
+ * @return A parameterized type corresponding to {@code Augmentation<Type>}
+ * @throws NullPointerException if {@code type} is null
+ */
+ public static @NonNull ParameterizedType augmentation(final Type type) {
+ return parameterizedTypeFor(AUGMENTATION, type);
+ }
+
/**
* Specialize {@link ChildOf} for a particular type.
*
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.Augmentation;
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;
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.
*/
* is <code>valueType</code>.
*
* @param valueType JAVA <code>Type</code> with actual parameter
- * @return <code>ParametrizedType</code> reprezentation of raw type
+ * @return <code>ParametrizedType</code> representation of raw type
* <code>Augmentation</code> with actual parameter
* <code>valueType</code>
+ * @deprecated Use {@link BindingTypes#augmentation(Type)} instead.
*/
+ @Deprecated(forRemoval = true)
public static @NonNull ParameterizedType augmentationTypeFor(final Type valueType) {
- return parameterizedTypeFor(AUGMENTATION, valueType);
+ return BindingTypes.augmentation(valueType);
}
public static @Nullable String getOuterClassName(final Type valueType) {
import static org.opendaylight.mdsal.binding.model.util.Types.typeForClass;
import org.junit.Test;
+import org.opendaylight.mdsal.binding.model.api.ParameterizedType;
import org.opendaylight.yangtools.yang.binding.Augmentable;
import org.opendaylight.yangtools.yang.binding.Augmentation;
import org.opendaylight.yangtools.yang.binding.BaseIdentity;
@Test
public void testAugmentable() {
- assertNotNull(BindingTypes.augmentable(Types.objectType()));
+ ParameterizedType augmentableType = BindingTypes.augmentable(Types.objectType());
+ assertEquals("Augmentable", augmentableType.getName());
}
@Test
public void testChildOf() {
assertNotNull(BindingTypes.childOf(Types.objectType()));
}
+
+ @Test(expected = NullPointerException.class)
+ public void testAugmentationNull() {
+ BindingTypes.augmentation(null);
+ }
+
+ @Test
+ public void testAugmentation() {
+ ParameterizedType augmentationType = BindingTypes.augmentation(Types.objectType());
+ assertEquals("Augmentation", augmentationType.getName());
+ }
}
\ No newline at end of file
assertEquals("WildcardTypeTest", wildcardType.getName());
}
+ @Deprecated
@Test(expected = NullPointerException.class)
public void testAugmentableTypeForNull() {
Types.augmentableTypeFor(null);
}
+ @Deprecated
@Test(expected = NullPointerException.class)
public void augmentationTypeForNull() {
Types.augmentationTypeFor(null);
}
+ @Deprecated
@Test
public void testAugmentableTypeFor() {
ParameterizedType augmentableType = Types.augmentableTypeFor(Types.objectType());
assertEquals("Augmentable", augmentableType.getName());
}
+ @Deprecated
@Test
public void augmentationTypeFor() {
ParameterizedType augmentationType = Types.augmentationTypeFor(Types.objectType());