- DataObjectCodecContext(final DataContainerCodecPrototype<T> prototype, final Method keyMethod) {
- super(prototype);
-
- final Class<D> bindingClass = getBindingClass();
-
- final ImmutableMap<Method, ValueNodeCodecContext> tmpLeaves = factory().getLeafNodes(bindingClass,
- getType().statement());
- final Map<Class<? extends DataContainer>, Method> clsToMethod =
- BindingReflections.getChildrenClassToMethod(bindingClass);
-
- final Map<YangInstanceIdentifier.PathArgument, NodeContextSupplier> byYangBuilder = new HashMap<>();
- final Map<Class<?>, DataContainerCodecPrototype<?>> byStreamClassBuilder = new HashMap<>();
- final Map<Class<?>, DataContainerCodecPrototype<?>> byBindingArgClassBuilder = new HashMap<>();
-
- // Adds leaves to mapping
- final Builder<String, ValueNodeCodecContext> leafChildBuilder =
- ImmutableMap.builderWithExpectedSize(tmpLeaves.size());
- for (final ValueNodeCodecContext leaf : tmpLeaves.values()) {
- leafChildBuilder.put(leaf.getSchema().getQName().getLocalName(), leaf);
- byYangBuilder.put(leaf.getDomPathArgument(), leaf);
- }
- this.leafChild = leafChildBuilder.build();
-
- final Map<Method, Class<?>> tmpDataObjects = new HashMap<>();
- for (final Entry<Class<? extends DataContainer>, Method> childDataObj : clsToMethod.entrySet()) {
- final Method method = childDataObj.getValue();
- verify(!method.isDefault(), "Unexpected default method %s in %s", method, bindingClass);
-
- final Class<? extends DataContainer> retClass = childDataObj.getKey();
- if (OpaqueObject.class.isAssignableFrom(retClass)) {
- // Filter OpaqueObjects, they are not containers
- continue;
- }