This method is only used in mdsal-binding-dom-codec, move it there.
JIRA: MDSAL-781
Change-Id: I0ee82715a0d69ddcf2f7daaca1ec7e7a2b2012bd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
import org.opendaylight.mdsal.binding.runtime.api.BindingRuntimeContext;
import org.opendaylight.mdsal.binding.runtime.api.CompositeRuntimeType;
import org.opendaylight.mdsal.binding.runtime.api.RuntimeTypeContainer;
-import org.opendaylight.mdsal.binding.spec.reflect.BindingReflections;
import org.opendaylight.yangtools.util.ClassLoaderUtils;
+import org.opendaylight.yangtools.yang.binding.Augmentable;
import org.opendaylight.yangtools.yang.binding.Augmentation;
import org.opendaylight.yangtools.yang.binding.BindingObject;
import org.opendaylight.yangtools.yang.binding.DataContainer;
return false;
}
if (Augmentation.class.isAssignableFrom(potential)
- && !BindingReflections.findAugmentationTarget(potential).equals(
- BindingReflections.findAugmentationTarget(target))) {
+ && !findAugmentationTarget(potential).equals(findAugmentationTarget(target))) {
return false;
}
for (Method potentialMethod : potential.getMethods()) {
}
return true;
}
+
+ /**
+ * Find augmentation target class from concrete Augmentation class. This method uses first generic argument of
+ * implemented {@link Augmentation} interface.
+ *
+ * @param augmentation {@link Augmentation} subclass for which we want to determine augmentation target.
+ * @return Augmentation target - class which augmentation provides additional extensions.
+ */
+ static final Class<? extends Augmentable<?>> findAugmentationTarget(
+ final Class<? extends Augmentation<?>> augmentation) {
+ final Optional<Class<Augmentable<?>>> opt = ClassLoaderUtils.findFirstGenericArgument(augmentation,
+ Augmentation.class);
+ return opt.orElse(null);
+ }
}
import org.opendaylight.mdsal.binding.runtime.api.AugmentRuntimeType;
import org.opendaylight.mdsal.binding.runtime.api.BindingRuntimeContext;
import org.opendaylight.mdsal.binding.runtime.api.CompositeRuntimeType;
-import org.opendaylight.mdsal.binding.spec.reflect.BindingReflections;
import org.opendaylight.yangtools.yang.binding.Augmentation;
import org.opendaylight.yangtools.yang.binding.BindingObject;
import org.opendaylight.yangtools.yang.binding.DataObject;
final ImmutableMap<Class<?>, AugmentationCodecPrototype> oldMismatched,
final @NonNull Class<?> childClass) {
@SuppressWarnings("rawtypes")
- final Class<?> augTarget = BindingReflections.findAugmentationTarget((Class) childClass);
+ final Class<?> augTarget = findAugmentationTarget((Class) childClass);
// Do not bother with proposals which are not augmentations of our class, or do not match what the runtime
// context would load.
if (getBindingClass().equals(augTarget) && belongsToRuntimeContext(childClass)) {
<groupId>org.eclipse.jdt</groupId>
<artifactId>org.eclipse.jdt.annotation</artifactId>
</dependency>
- <dependency>
- <groupId>org.opendaylight.yangtools</groupId>
- <artifactId>util</artifactId>
- </dependency>
<dependency>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>yang-common</artifactId>
import java.util.ServiceLoader;
import java.util.concurrent.TimeUnit;
import org.eclipse.jdt.annotation.NonNull;
-import org.opendaylight.yangtools.util.ClassLoaderUtils;
import org.opendaylight.yangtools.yang.binding.Action;
-import org.opendaylight.yangtools.yang.binding.Augmentable;
import org.opendaylight.yangtools.yang.binding.Augmentation;
import org.opendaylight.yangtools.yang.binding.BaseIdentity;
import org.opendaylight.yangtools.yang.binding.BindingContract;
// Hidden on purpose
}
- /**
- * Find augmentation target class from concrete Augmentation class. This method uses first generic argument of
- * implemented {@link Augmentation} interface.
- *
- * @param augmentation
- * {@link Augmentation} subclass for which we want to determine
- * augmentation target.
- * @return Augmentation target - class which augmentation provides additional extensions.
- */
- public static Class<? extends Augmentable<?>> findAugmentationTarget(
- final Class<? extends Augmentation<?>> augmentation) {
- final Optional<Class<Augmentable<?>>> opt = ClassLoaderUtils.findFirstGenericArgument(augmentation,
- Augmentation.class);
- return opt.orElse(null);
- }
-
/**
* Returns a QName associated to supplied type.
*
assertFalse("Should not be Notification", BindingReflections.isNotification(DataObject.class));
assertTrue(BindingReflections.isRpcMethod(TestImplementation.class.getDeclaredMethod("rpcMethodTest")));
- assertEquals(TestImplementation.class, BindingReflections.findAugmentationTarget(TestImplementation.class));
assertEquals(QName.create("test", "test"), BindingReflections.getQName(TestIdentity.VALUE));
}