import org.opendaylight.yangtools.yang.binding.Action;
import org.opendaylight.yangtools.yang.binding.Augmentation;
import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.common.QNameModule;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.AugmentationIdentifier;
import org.opendaylight.yangtools.yang.model.api.ActionDefinition;
import org.opendaylight.yangtools.yang.model.api.AugmentationSchemaNode;
import org.opendaylight.yangtools.yang.model.api.EffectiveModelContextProvider;
import org.opendaylight.yangtools.yang.model.api.SchemaNode;
import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
+import org.opendaylight.yangtools.yang.model.api.stmt.SchemaNodeIdentifier.Absolute;
/**
* Runtime Context for Java YANG Binding classes. It provides information derived from the backing effective model,
* by additional models. Same goes for all possible augmentations.
*/
@Beta
+// FIXME: refactor return to follow foo()/getFoo()/findFoo() naming
public interface BindingRuntimeContext extends EffectiveModelContextProvider, Immutable {
- /**
- * Returns a class loading strategy associated with this binding runtime context
- * which is used to load classes.
- *
- * @return Class loading strategy.
- */
- @NonNull ClassLoadingStrategy getStrategy();
-
@NonNull BindingRuntimeTypes getTypes();
+ @NonNull <T> Class<T> loadClass(Type type) throws ClassNotFoundException;
+
@Override
default EffectiveModelContext getEffectiveModelContext() {
return getTypes().getEffectiveModelContext();
* schema.
*
* @param augClass Augmentation class
- * @return Schema of augmentation or null if augmentaiton is not known in this context
- * @throws IllegalArgumentException If supplied class is not an augmentation
+ * @return Schema of augmentation or null if augmentation is not known in this context
*/
- @Nullable AugmentationSchemaNode getAugmentationDefinition(Class<?> augClass);
+ <T extends Augmentation<?>> @Nullable AugmentationSchemaNode getAugmentationDefinition(Class<T> augClass);
/**
* Returns defining {@link DataSchemaNode} for supplied class.
*/
@Nullable DataSchemaNode getSchemaDefinition(Class<?> cls);
+ // FIXME: document this thing and perhaps move it to BindingRuntimeTypes?
+ @Nullable DataSchemaNode findChildSchemaDefinition(DataNodeContainer parentSchema, QNameModule parentNamespace,
+ Class<?> childClass);
+
@Nullable ActionDefinition getActionDefinition(Class<? extends Action<?, ?, ?>> cls);
+ @Deprecated(forRemoval = true)
+ @Nullable Absolute getActionIdentifier(Class<? extends Action<?, ?, ?>> cls);
+
@NonNull Entry<AugmentationIdentifier, AugmentationSchemaNode> getResolvedAugmentationSchema(
DataNodeContainer target, Class<? extends Augmentation<?>> aug);
@NonNull Class<?> getClassForSchema(SchemaNode childSchema);
+ /**
+ * Return the mapping of a particular {@link DataNodeContainer}'s available augmentations. This method deals with
+ * resolving {@code uses foo { augment bar { ... } } } scenarios by returning the augmentation created for
+ * {@code grouping foo}'s Binding representation.
+ *
+ * @param container {@link DataNodeContainer} to examine
+ * @return a mapping from local {@link AugmentationIdentifier}s to their corresponding Binding augmentations
+ */
@NonNull ImmutableMap<AugmentationIdentifier, Type> getAvailableAugmentationTypes(DataNodeContainer container);
@NonNull Class<?> getIdentityClass(QName input);