public final class BindingReflections extends Object
Modifier and Type | Method and Description |
---|---|
static Class<? extends Augmentable<?>> |
findAugmentationTarget(Class<? extends Augmentation<?>> augmentation)
Find augmentation target class from concrete Augmentation class.
|
static Class<?> |
findHierarchicalParent(Class<? extends ChildOf<?>> childClass)
Find data hierarchy parent from concrete Data class.
|
static Class<?> |
findHierarchicalParent(DataObject child)
Find data hierarchy parent from concrete Data class.
|
static org.opendaylight.yangtools.yang.common.QName |
findQName(Class<?> dataType)
Returns a QName associated to supplied type.
|
static Map<Class<? extends Augmentation<?>>,Augmentation<?>> |
getAugmentations(Augmentable<?> input)
Extracts augmentation from Binding DTO field using reflection.
|
static Iterable<Class<? extends DataObject>> |
getChildrenClasses(Class<? extends DataContainer> type)
Scans supplied class and returns an iterable of all data children classes.
|
static Map<Class<?>,Method> |
getChildrenClassToMethod(Class<?> type)
Scans supplied class and returns an iterable of all data children classes.
|
static Map<Class<?>,Method> |
getChildrenClassToNonnullMethod(Class<?> type) |
static String |
getModelRootPackageName(Package pkg)
Returns root package name for supplied package.
|
static String |
getModelRootPackageName(String name)
Returns root package name for supplied package name.
|
static YangModuleInfo |
getModuleInfo(Class<?> cls)
Returns instance of
YangModuleInfo of declaring model for specific class. |
static String |
getModuleInfoClassName(String packageName) |
static org.opendaylight.yangtools.yang.common.QName |
getQName(Class<? extends BaseIdentity> context) |
static org.opendaylight.yangtools.yang.common.QNameModule |
getQNameModule(Class<?> clz) |
static boolean |
isAugmentationChild(Class<?> clazz)
Checks if class is child of augmentation.
|
static boolean |
isBindingClass(Class<?> cls)
Check if supplied class is derived from YANG model.
|
static boolean |
isNotification(Class<?> potentialNotification)
Checks is supplied class is a
Notification . |
static boolean |
isNotificationCallback(Method method)
Checks if supplied method is callback for notifications.
|
static boolean |
isRpcMethod(Method possibleMethod)
Checks if method is RPC invocation.
|
static boolean |
isRpcType(Class<? extends DataObject> targetType)
Checks if supplied class represents RPC Input / RPC Output.
|
static boolean |
isSubstitutionFor(Class potential,
Class target)
Determines if two augmentation classes or case classes represents same
data.
|
static com.google.common.collect.ImmutableSet<YangModuleInfo> |
loadModuleInfos()
Loads
YangModuleInfo infos available on current classloader. |
static com.google.common.collect.ImmutableSet<YangModuleInfo> |
loadModuleInfos(ClassLoader loader)
Loads
YangModuleInfo infos available on supplied classloader. |
static Optional<Class<? extends DataContainer>> |
resolveRpcInputClass(Method targetMethod)
Extracts input class for RPC method.
|
static Optional<Class<?>> |
resolveRpcOutputClass(Method targetMethod)
Extracts Output class for RPC method.
|
public static Class<? extends Augmentable<?>> findAugmentationTarget(Class<? extends Augmentation<?>> augmentation)
Augmentation
interface.augmentation
- Augmentation
subclass for which we want to determine
augmentation target.public static Class<?> findHierarchicalParent(Class<? extends ChildOf<?>> childClass)
ChildOf
interface.childClass
- child class for which we want to find the parent class.public static Class<?> findHierarchicalParent(DataObject child)
DataContainer.getImplementedInterface()
and uses findHierarchicalParent(Class)
.child
- Child object for which the parent needs to be located.public static org.opendaylight.yangtools.yang.common.QName findQName(Class<?> dataType)
dataType
- Data type classpublic static boolean isRpcMethod(Method possibleMethod)
possibleMethod
- Method to checkpublic static Optional<Class<?>> resolveRpcOutputClass(Method targetMethod)
targetMethod
- method to scanpublic static Optional<Class<? extends DataContainer>> resolveRpcInputClass(Method targetMethod)
targetMethod
- method to scanpublic static org.opendaylight.yangtools.yang.common.QName getQName(Class<? extends BaseIdentity> context)
public static boolean isAugmentationChild(Class<?> clazz)
public static String getModelRootPackageName(Package pkg)
pkg
- Package for which find model root package.public static String getModelRootPackageName(String name)
name
- Package for which find model root package.public static org.opendaylight.yangtools.yang.common.QNameModule getQNameModule(Class<?> clz)
public static YangModuleInfo getModuleInfo(Class<?> cls) throws Exception
YangModuleInfo
of declaring model for specific class.cls
- data object classYangModuleInfo
associated with model, from
which this class was derived.Exception
public static boolean isBindingClass(Class<?> cls)
cls
- Class to checkpublic static boolean isNotificationCallback(Method method)
method
- method to checkpublic static boolean isNotification(Class<?> potentialNotification)
Notification
.potentialNotification
- class to examinepublic static com.google.common.collect.ImmutableSet<YangModuleInfo> loadModuleInfos()
YangModuleInfo
infos available on current classloader. This method is shorthand for
loadModuleInfos(ClassLoader)
with Thread.getContextClassLoader()
for current thread.YangModuleInfo
available for current classloader.public static com.google.common.collect.ImmutableSet<YangModuleInfo> loadModuleInfos(ClassLoader loader)
YangModuleInfo
infos available on supplied classloader.
YangModuleInfo
are discovered using ServiceLoader
for YangModelBindingProvider
.
YangModelBindingProvider
are simple classes which holds only pointers to actual instance
YangModuleInfo
.
When YangModuleInfo
is available, all dependencies are recursively collected into returning set by
collecting results of YangModuleInfo.getImportedModules()
.
loader
- Classloader for which YangModuleInfo
should be
retrieved.YangModuleInfo
available for supplied classloader.public static boolean isRpcType(Class<? extends DataObject> targetType)
targetType
- Class to be checkedpublic static Iterable<Class<? extends DataObject>> getChildrenClasses(Class<? extends DataContainer> type)
type
- YANG Modeled Entity derived from DataContainerpublic static Map<Class<?>,Method> getChildrenClassToMethod(Class<?> type)
type
- YANG Modeled Entity derived from DataContainer@Beta public static Map<Class<?>,Method> getChildrenClassToNonnullMethod(Class<?> type)
public static Map<Class<? extends Augmentation<?>>,Augmentation<?>> getAugmentations(Augmentable<?> input)
input
- Instance of DataObject which is augmentable and may contain
augmentationpublic static boolean isSubstitutionFor(Class potential, Class target)
Two augmentations or cases could be substituted only if and if:
Explanation: Binding Specification reuses classes generated for groupings as part of normal data tree, this classes from grouping could be used at various locations and user may not be aware of it and may use incorrect case or augmentation in particular subtree (via copy constructors, etc).
potential
- Class which is potential substitutiontarget
- Class which should be used at particular subtreeCopyright © 2019 OpenDaylight. All rights reserved.