@Beta public class BindingRuntimeContext extends Object implements org.opendaylight.yangtools.concepts.Immutable
Runtime Context provides additional insight in Java YANG Binding, binding
classes and underlying YANG schema, it contains runtime information, which
could not be derived from generated classes alone using
BindingReflections
.
Some of this information are for example list of all available children for
cases getChoiceCaseChildren(DataNodeContainer)
, since choices are
augmentable and new choices may be introduced by additional models.
Same goes for all possible augmentations.
Modifier and Type | Method and Description |
---|---|
static BindingRuntimeContext |
create(ClassLoadingStrategy strategy,
org.opendaylight.yangtools.yang.model.api.SchemaContext ctx)
Creates Binding Runtime Context from supplied class loading strategy and
schema context.
|
Method |
findOperationMethod(Class<?> key,
org.opendaylight.yangtools.yang.model.api.OperationDefinition operationDef) |
org.opendaylight.yangtools.yang.model.api.ActionDefinition |
getActionDefinition(Class<? extends Action<?,?,?,?>> cls) |
Map.Entry<Type,Collection<org.opendaylight.yangtools.yang.model.api.AugmentationSchemaNode>> |
getAugmentationDefinition(Class<?> augClass)
Returns schema of augmentation
|
com.google.common.collect.ImmutableMap<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.AugmentationIdentifier,Type> |
getAvailableAugmentationTypes(org.opendaylight.yangtools.yang.model.api.DataNodeContainer container) |
Set<Class<?>> |
getCases(Class<?> choice) |
Optional<org.opendaylight.yangtools.yang.model.api.CaseSchemaNode> |
getCaseSchemaDefinition(org.opendaylight.yangtools.yang.model.api.ChoiceSchemaNode schema,
Class<?> childClass)
Returns resolved case schema for supplied class
|
com.google.common.collect.ImmutableMap<Type,Map.Entry<Type,Type>> |
getChoiceCaseChildren(org.opendaylight.yangtools.yang.model.api.DataNodeContainer schema) |
Class<?> |
getClassForSchema(org.opendaylight.yangtools.yang.model.api.SchemaNode childSchema) |
com.google.common.collect.BiMap<String,String> |
getEnumMapping(Class<?> enumClass)
Map enum constants: yang - java
|
com.google.common.collect.BiMap<String,String> |
getEnumMapping(String enumClass)
|
Class<?> |
getIdentityClass(org.opendaylight.yangtools.yang.common.QName input) |
Map.Entry<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.AugmentationIdentifier,org.opendaylight.yangtools.yang.model.api.AugmentationSchemaNode> |
getResolvedAugmentationSchema(org.opendaylight.yangtools.yang.model.api.DataNodeContainer target,
Class<? extends Augmentation<?>> aug)
Returns defining
AugmentationSchemaNode of target for supplied class. |
org.opendaylight.yangtools.yang.model.api.RpcDefinition |
getRpcDefinition(Class<? extends Rpc<?,?>> cls) |
org.opendaylight.yangtools.yang.model.api.SchemaContext |
getSchemaContext()
Returns an stable immutable view of schema context associated with this Binding runtime context.
|
org.opendaylight.yangtools.yang.model.api.DataSchemaNode |
getSchemaDefinition(Class<?> cls)
Returns defining
DataSchemaNode for supplied class. |
ClassLoadingStrategy |
getStrategy()
Returns a class loading strategy associated with this binding runtime context
which is used to load classes.
|
Map.Entry<GeneratedType,Object> |
getTypeWithSchema(Class<?> type)
Returns schema (
DataSchemaNode , AugmentationSchemaNode or TypeDefinition )
from which supplied class was generated. |
Map.Entry<GeneratedType,Object> |
getTypeWithSchema(String type) |
public static final BindingRuntimeContext create(ClassLoadingStrategy strategy, org.opendaylight.yangtools.yang.model.api.SchemaContext ctx)
strategy
- - class loading strategy to retrieve generated Binding classesctx
- - schema context which describes YANG model and to which
Binding classes should be mappedpublic ClassLoadingStrategy getStrategy()
public org.opendaylight.yangtools.yang.model.api.SchemaContext getSchemaContext()
@Nullable public Map.Entry<Type,Collection<org.opendaylight.yangtools.yang.model.api.AugmentationSchemaNode>> getAugmentationDefinition(Class<?> augClass)
Returned schema is schema definition from which augmentation class was generated. This schema is isolated from other augmentations. This means it contains augmentation definition as was present in original YANG module.
Children of returned schema does not contain any additional augmentations, which may be present in runtime for them, thus returned schema is unsuitable for use for validation of data.
For retrieving AugmentationSchemaNode
, which will contains full model
for child nodes, you should use method
getResolvedAugmentationSchema(DataNodeContainer, Class)
which
will return augmentation schema derived from supplied augmentation target
schema.
augClass
- - ugmentation classIllegalArgumentException
- - if supplied class is not an augmentationpublic org.opendaylight.yangtools.yang.model.api.DataSchemaNode getSchemaDefinition(Class<?> cls)
DataSchemaNode
for supplied class.
Returned schema is schema definition from which class was generated. This schema may be isolated from augmentations, if supplied class represent node, which was child of grouping or augmentation.
For getting augmentation schema from augmentation class use
getAugmentationDefinition(Class)
instead.
cls
- - class which represents list, container, choice or case.public org.opendaylight.yangtools.yang.model.api.RpcDefinition getRpcDefinition(Class<? extends Rpc<?,?>> cls)
public org.opendaylight.yangtools.yang.model.api.ActionDefinition getActionDefinition(Class<? extends Action<?,?,?,?>> cls)
public Map.Entry<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.AugmentationIdentifier,org.opendaylight.yangtools.yang.model.api.AugmentationSchemaNode> getResolvedAugmentationSchema(org.opendaylight.yangtools.yang.model.api.DataNodeContainer target, Class<? extends Augmentation<?>> aug)
AugmentationSchemaNode
of target for supplied class.target
- - DataNodeContainer
aug
- - supplied classAugmentationSchemaNode
according to its identifier
YangInstanceIdentifier.AugmentationIdentifier
public Optional<org.opendaylight.yangtools.yang.model.api.CaseSchemaNode> getCaseSchemaDefinition(org.opendaylight.yangtools.yang.model.api.ChoiceSchemaNode schema, Class<?> childClass) throws IllegalArgumentException
schema
- - resolved parent choice schemachildClass
- - class representing case.IllegalArgumentException
- - if supplied class does not represent casepublic Map.Entry<GeneratedType,Object> getTypeWithSchema(Class<?> type)
DataSchemaNode
, AugmentationSchemaNode
or TypeDefinition
)
from which supplied class was generated. Returned schema may be augmented with
additional information, which was not available at compile type
(e.g. third party augmentations).type
- Binding Class for which schema should be retrieved.DataSchemaNode
, AugmentationSchemaNode
or TypeDefinition
which was used to generate supplied class.public Map.Entry<GeneratedType,Object> getTypeWithSchema(String type)
public com.google.common.collect.ImmutableMap<Type,Map.Entry<Type,Type>> getChoiceCaseChildren(org.opendaylight.yangtools.yang.model.api.DataNodeContainer schema)
public com.google.common.collect.BiMap<String,String> getEnumMapping(Class<?> enumClass)
enumClass
- enum generated classpublic com.google.common.collect.BiMap<String,String> getEnumMapping(String enumClass)
public Class<?> getClassForSchema(org.opendaylight.yangtools.yang.model.api.SchemaNode childSchema)
public com.google.common.collect.ImmutableMap<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.AugmentationIdentifier,Type> getAvailableAugmentationTypes(org.opendaylight.yangtools.yang.model.api.DataNodeContainer container)
public Class<?> getIdentityClass(org.opendaylight.yangtools.yang.common.QName input)
public Method findOperationMethod(Class<?> key, org.opendaylight.yangtools.yang.model.api.OperationDefinition operationDef) throws NoSuchMethodException
NoSuchMethodException
Copyright © 2019 OpenDaylight. All rights reserved.