.<Class<?>, CommonDataObjectCodecPrototype<?>>build();
// Load case statements valid in this choice and keep track of their names
- final var choiceType = prototype.getType();
- final var factory = prototype.getFactory();
+ final var choiceType = prototype.runtimeType();
+ final var factory = prototype.contextFactory();
final var localCases = new HashSet<JavaTypeName>();
for (var caseType : choiceType.validCaseChildren()) {
@SuppressWarnings("unchecked")
if (cases.size() != 1) {
// Sort all possibilities by their FQCN to retain semi-predictable results
final var list = new ArrayList<>(entry.getValue());
- list.sort(Comparator.comparing(proto -> proto.getBindingClass().getCanonicalName()));
+ list.sort(Comparator.comparing(proto -> proto.javaClass().getCanonicalName()));
ambiguousByCaseBuilder.putAll(entry.getKey(), list);
} else {
unambiguousByCaseBuilder.put(entry.getKey(), cases.iterator().next());
@Override
public WithStatus getSchema() {
// FIXME: Bad cast, we should be returning an EffectiveStatement perhaps?
- return (WithStatus) type().statement();
+ return (WithStatus) prototype().runtimeType().statement();
}
@Override
return null;
}
final var caze = byYangCaseChild.get(first.name());
- return ((CaseCodecContext<D>) caze.get()).deserialize(data);
+ return ((CaseCodecContext<D>) caze.getCodecContext()).deserialize(data);
}
@Override
return createCachingCodec(this, cacheSpecifier);
}
- DataContainerCodecContext<?, ?> getCaseByChildClass(final @NonNull Class<? extends DataObject> type) {
+ DataContainerCodecContext<?, ?, ?> getCaseByChildClass(final @NonNull Class<? extends DataObject> type) {
var result = byCaseChildClass.get(type);
if (result == null) {
// We have not found an unambiguous result, try ambiguous ones
Ambiguous reference {} to child of {} resolved to {}, the first case in {} This mapping is \
not guaranteed to be stable and is subject to variations based on runtime circumstances. \
Please see the stack trace for hints about the source of ambiguity.""",
- type, bindingArg(), result.getBindingClass(),
- Lists.transform(inexact, CommonDataObjectCodecPrototype::getBindingClass), new Throwable());
+ type, bindingArg(), result.javaClass(),
+ Lists.transform(inexact, CommonDataObjectCodecPrototype::javaClass), new Throwable());
}
}
}
- return childNonNull(result, type, "Class %s is not child of any cases for %s", type, bindingArg()).get();
+ return childNonNull(result, type, "Class %s is not child of any cases for %s", type, bindingArg())
+ .getCodecContext();
}
/**
checkArgument(DataContainer.class.isAssignableFrom(type), "Supplied type must be derived from DataContainer");
final var ret = new LinkedList<Class<? extends DataObject>>();
for (var method : type.getMethods()) {
- AbstractDataContainerAnalysis.getYangModeledReturnType(method, Naming.GETTER_PREFIX)
+ DataContainerAnalysis.getYangModeledReturnType(method, Naming.GETTER_PREFIX)
.ifPresent(entity -> ret.add((Class<? extends DataObject>) entity));
}
return ret;