public final 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.
|
org.opendaylight.yangtools.yang.model.api.ActionDefinition |
getActionDefinition(Class<? extends Action<?,?,?>> cls) |
@Nullable 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 enumClassName)
Map enum constants: yang - java.
|
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) |
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,org.opendaylight.yangtools.yang.model.api.DocumentedNode.WithStatus> |
getTypeWithSchema(Class<?> type)
Returns schema (
DataSchemaNode , AugmentationSchemaNode or TypeDefinition )
from which supplied class was generated. |
String |
toString() |
public static 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()
public @Nullable 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
- Augmentation 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.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)
public Optional<org.opendaylight.yangtools.yang.model.api.CaseSchemaNode> getCaseSchemaDefinition(org.opendaylight.yangtools.yang.model.api.ChoiceSchemaNode schema, Class<?> childClass)
schema
- Resolved parent choice schemachildClass
- Class representing case.IllegalArgumentException
- If supplied class does not represent case.public Map.Entry<GeneratedType,org.opendaylight.yangtools.yang.model.api.DocumentedNode.WithStatus> 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 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 enumClassName)
enumClassName
- enum generated class namepublic 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)
Copyright © 2019 OpenDaylight. All rights reserved.