import org.opendaylight.mdsal.binding.model.api.Type;
import org.opendaylight.mdsal.binding.runtime.api.AugmentRuntimeType;
import org.opendaylight.mdsal.binding.runtime.api.AugmentableRuntimeType;
-import org.opendaylight.mdsal.binding.runtime.api.BindingRuntimeContext;
import org.opendaylight.mdsal.binding.runtime.api.CompositeRuntimeType;
import org.opendaylight.yangtools.yang.binding.Augmentable;
import org.opendaylight.yangtools.yang.binding.Augmentation;
// Final bits: generate the appropriate class, As a side effect we identify what Augmentations are possible
final List<AugmentRuntimeType> possibleAugmentations;
+ final var loader = prototype().contextFactory().getLoader();
if (Augmentable.class.isAssignableFrom(bindingClass)) {
// Verify we have the appropriate backing runtimeType
- final var runtimeType = prototype.getType();
+ final var runtimeType = prototype.runtimeType();
if (!(runtimeType instanceof AugmentableRuntimeType augmentableRuntimeType)) {
throw new VerifyException(
"Unexpected type %s backing augmenable %s".formatted(runtimeType, bindingClass));
}
possibleAugmentations = augmentableRuntimeType.augments();
- generatedClass = CodecDataObjectGenerator.generateAugmentable(factory().getLoader(), bindingClass,
- analysis.leafContexts, analysis.daoProperties, keyMethod);
+ generatedClass = CodecDataObjectGenerator.generateAugmentable(loader, bindingClass, analysis.leafContexts,
+ analysis.daoProperties, keyMethod);
} else {
possibleAugmentations = List.of();
- generatedClass = CodecDataObjectGenerator.generate(factory().getLoader(), bindingClass,
- analysis.leafContexts, analysis.daoProperties, keyMethod);
+ generatedClass = CodecDataObjectGenerator.generate(loader, bindingClass, analysis.leafContexts,
+ analysis.daoProperties, keyMethod);
}
// All done: acquire the constructor: it is supposed to be public
for (var augment : possibleAugmentations) {
final var augProto = loadAugmentPrototype(augment);
if (augProto != null) {
- final var augBindingClass = augProto.getBindingClass();
+ final var augBindingClass = augProto.javaClass();
for (var childPath : augProto.getChildArgs()) {
augPathToBinding.putIfAbsent(childPath, augBindingClass);
}
// context would load.
if (getBindingClass().equals(augTarget) && belongsToRuntimeContext(childClass)) {
for (var realChild : augmentToPrototype.values()) {
- if (Augmentation.class.isAssignableFrom(realChild.getBindingClass())
- && isSubstitutionFor(childClass, realChild.getBindingClass())) {
+ final var realClass = realChild.javaClass();
+ if (Augmentation.class.isAssignableFrom(realClass) && isSubstitutionFor(childClass, realClass)) {
return cacheMismatched(oldMismatched, childClass, realChild);
}
}
}
private boolean belongsToRuntimeContext(final Class<?> cls) {
- final BindingRuntimeContext ctx = factory().getRuntimeContext();
+ final var ctx = prototype().contextFactory().getRuntimeContext();
final Class<?> loaded;
try {
loaded = ctx.loadClass(Type.of(cls));
return null;
}
- final var factory = factory();
+ final var factory = prototype().contextFactory();
final GeneratedType javaType = augment.javaType();
final Class<? extends Augmentation<?>> augClass;
try {
final var bindingClass = entry.getKey();
final var codecProto = augmentToPrototype.get(bindingClass);
if (codecProto != null) {
- final var bindingObj = codecProto.get().deserializeObject(entry.getValue().build());
+ final var bindingObj = codecProto.getCodecContext().deserializeObject(entry.getValue().build());
if (bindingObj != null) {
map.put(bindingClass, bindingObj);
}