Hide DataContainerCodecContext.getType()
authorRobert Varga <robert.varga@pantheon.tech>
Thu, 15 Jun 2023 14:08:37 +0000 (16:08 +0200)
committerAnil Belur <abelur@linuxfoundation.org>
Wed, 19 Jun 2024 00:41:46 +0000 (10:41 +1000)
This method is used only internally, hide it from public view.

Change-Id: Id1700333937155fb5eff6cecca630fcff7c6bced
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
binding/mdsal-binding-dom-codec/src/main/java/org/opendaylight/mdsal/binding/dom/codec/impl/AbstractDataObjectCodecContext.java
binding/mdsal-binding-dom-codec/src/main/java/org/opendaylight/mdsal/binding/dom/codec/impl/ChoiceCodecContext.java
binding/mdsal-binding-dom-codec/src/main/java/org/opendaylight/mdsal/binding/dom/codec/impl/DataContainerCodecContext.java
binding/mdsal-binding-dom-codec/src/main/java/org/opendaylight/mdsal/binding/dom/codec/impl/RootCodecContext.java

index c749d5906a275262439d34a7b829bcf073dab57c..93ecf67bf58e51f2d25a630271e7cecc2ab0e95b 100644 (file)
@@ -65,7 +65,7 @@ public abstract sealed class AbstractDataObjectCodecContext<D extends DataObject
     @Override
     public final WithStatus getSchema() {
         // FIXME: Bad cast, we should be returning an EffectiveStatement perhaps?
-        return (WithStatus) getType().statement();
+        return (WithStatus) type().statement();
     }
 
     @Override
index 14af5365fe561fe76967793cf388486939cc916f..f111721f99126d594a4fd4b23483f492f64c306d 100644 (file)
@@ -200,7 +200,7 @@ final class ChoiceCodecContext<D extends DataObject> extends DataContainerCodecC
     @Override
     public WithStatus getSchema() {
         // FIXME: Bad cast, we should be returning an EffectiveStatement perhaps?
-        return (WithStatus) getType().statement();
+        return (WithStatus) type().statement();
     }
 
     @Override
index 342c5cc12890a0bee2df77fa5cb3a5113971f247..2c37161b9a6aaba157418b57ea39206214978517 100644 (file)
@@ -80,10 +80,6 @@ abstract sealed class DataContainerCodecContext<D extends DataObject, T extends
         this.prototype = requireNonNull(prototype);
     }
 
-    public final @NonNull T getType() {
-        return prototype.getType();
-    }
-
     @Override
     public final ChildAddressabilitySummary getChildAddressabilitySummary() {
         return prototype.getChildAddressabilitySummary();
@@ -97,6 +93,10 @@ abstract sealed class DataContainerCodecContext<D extends DataObject, T extends
         return prototype.getFactory();
     }
 
+    protected final @NonNull T type() {
+        return prototype.getType();
+    }
+
     @Override
     protected NodeIdentifier getDomPathArgument() {
         return prototype.getYangArg();
index 83677ae389e6c82a724d3dc77f498fab6b0ee8c0..6008732b64aa43710c6d49ef14e30ea83d197b2c 100644 (file)
@@ -37,7 +37,6 @@ import org.opendaylight.mdsal.binding.runtime.api.CompositeRuntimeType;
 import org.opendaylight.mdsal.binding.runtime.api.ContainerLikeRuntimeType;
 import org.opendaylight.mdsal.binding.runtime.api.DataRuntimeType;
 import org.opendaylight.mdsal.binding.runtime.api.NotificationRuntimeType;
-import org.opendaylight.mdsal.binding.runtime.api.RuntimeType;
 import org.opendaylight.mdsal.binding.spec.reflect.BindingReflections;
 import org.opendaylight.yangtools.util.ClassLoaderUtils;
 import org.opendaylight.yangtools.yang.binding.Action;
@@ -119,7 +118,7 @@ final class RootCodecContext<D extends DataObject> extends DataContainerCodecCon
 
                 // TODO: we should be able to work with bindingChild() instead of schemaTreeChild() here
                 final var qname = BindingReflections.findQName(key);
-                if (getType().schemaTreeChild(qname) instanceof NotificationRuntimeType type) {
+                if (type().schemaTreeChild(qname) instanceof NotificationRuntimeType type) {
                     return new NotificationCodecContext<>(key, type, factory());
                 }
                 throw new IllegalArgumentException("Supplied " + key + " is not valid notification");
@@ -177,7 +176,7 @@ final class RootCodecContext<D extends DataObject> extends DataContainerCodecCon
         CacheBuilder.newBuilder().build(new CacheLoader<>() {
             @Override
             public DataContainerCodecContext<?, ?> load(final QName qname) throws ClassNotFoundException {
-                final var type = getType();
+                final var type = type();
                 final var child = childNonNull(type.schemaTreeChild(qname), qname,
                     "Argument %s is not valid child of %s", qname, type);
                 if (!(child instanceof DataRuntimeType)) {
@@ -230,7 +229,7 @@ final class RootCodecContext<D extends DataObject> extends DataContainerCodecCon
 
     @Override
     public WithStatus getSchema() {
-        return getType().getEffectiveModelContext();
+        return type().getEffectiveModelContext();
     }
 
     @Override
@@ -287,7 +286,7 @@ final class RootCodecContext<D extends DataObject> extends DataContainerCodecCon
     }
 
     DataContainerCodecContext<?, ?> createDataTreeChildContext(final Class<? extends DataObject> key) {
-        final RuntimeType childSchema = childNonNull(getType().bindingChild(JavaTypeName.create(key)), key,
+        final var childSchema = childNonNull(type().bindingChild(JavaTypeName.create(key)), key,
             "%s is not top-level item.", key);
         if (childSchema instanceof CompositeRuntimeType composite && childSchema instanceof DataRuntimeType) {
             return DataContainerCodecPrototype.from(key, composite, factory()).get();