@Beta 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
This method uses first generic argument of implemented
Augmentation interface. |
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 TreeNode>> |
getChildrenClasses(Class<? extends Instantiable<?>> 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 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)
Returns name of module info class.
|
static org.opendaylight.yangtools.yang.common.QName |
getModuleQName(YangModuleInfo moduleInfo)
Given a
YangModuleInfo , create a QName representing it. |
static org.opendaylight.yangtools.yang.common.QName |
getQName(Class<? extends BaseIdentity> context)
Find qname of base identity context.
|
static org.opendaylight.yangtools.yang.common.QNameModule |
getQNameModule(Class<?> clz)
Get QName module of specific Binding object class.
|
static org.opendaylight.yangtools.yang.common.QNameModule |
getQNameModule(YangModuleInfo modInfo)
Returns module QName.
|
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)
Check if supplied class is Notification.
|
static boolean |
isNotificationCallback(Method method)
Checks if supplied method is callback for notifications.
|
static boolean |
isOperationMethod(Method possibleMethod)
Checks if method is RPC or Action invocation
|
static boolean |
isOperationType(Class<? extends TreeNode> targetType)
Checks if supplied class represents RPC or Action input/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 info available on current classloader. |
static com.google.common.collect.ImmutableSet<YangModuleInfo> |
loadModuleInfos(ClassLoader loader)
Loads
YangModuleInfo info available on supplied classloader. |
static Optional<Class<? extends Instantiable<?>>> |
resolveOperationInputClass(Method targetMethod)
Extracts input class for RPC or Action
|
static Optional<Class<?>> |
resolveOperationOutputClass(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 org.opendaylight.yangtools.yang.common.QName findQName(Class<?> dataType)
dataType
- - type of datapublic static boolean isOperationMethod(Method possibleMethod)
possibleMethod
- - method to checkpublic static Optional<Class<?>> resolveOperationOutputClass(Method targetMethod)
targetMethod
- method to scanpublic static Optional<Class<? extends Instantiable<?>>> resolveOperationInputClass(Method targetMethod)
targetMethod
- - method to scanpublic static org.opendaylight.yangtools.yang.common.QName getQName(Class<? extends BaseIdentity> context)
context
- - base identity type contextpublic static boolean isAugmentationChild(Class<?> clazz)
clazz
- - class to checkpublic 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 packagepublic static final org.opendaylight.yangtools.yang.common.QNameModule getQNameModule(Class<?> clz)
clz
- - class of binding objectpublic static final org.opendaylight.yangtools.yang.common.QNameModule getQNameModule(YangModuleInfo modInfo)
modInfo
- - module infoQNameModule
from module infopublic static YangModuleInfo getModuleInfo(Class<?> cls) throws Exception
YangModuleInfo
of declaring model for
specific class.cls
- - class for getting infoYangModuleInfo
associated with model, from
which this class was derived.Exception
public static String getModuleInfoClassName(String packageName)
packageName
- - package namepublic static boolean isBindingClass(Class<?> cls)
cls
- - class to checkpublic static boolean isNotificationCallback(Method method)
method
- - method for checkpublic static boolean isNotification(Class<?> potentialNotification)
potentialNotification
- - class to checkpublic static com.google.common.collect.ImmutableSet<YangModuleInfo> loadModuleInfos()
YangModuleInfo
info 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
info 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
retrievedYangModuleInfo
available for supplied classloader.public static boolean isOperationType(Class<? extends TreeNode> targetType)
targetType
- - class to be checkedpublic static Iterable<Class<? extends TreeNode>> getChildrenClasses(Class<? extends Instantiable<?>> type)
type
- - YANG Modeled Entity derived from DataContainerpublic static Map<Class<?>,Method> getChildrenClassToMethod(Class<?> type)
type
- - YANG Modeled Entity derived from DataContainerpublic static org.opendaylight.yangtools.yang.common.QName getModuleQName(YangModuleInfo moduleInfo)
YangModuleInfo
, create a QName representing it. The QName
is formed by reusing the module's namespace and revision using the
module's name as the QName's local name.moduleInfo
- module informationpublic 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.