Propagate EffectiveModelContext to more places
[yangtools.git] / yang / yang-data-codec-gson / src / main / java / org / opendaylight / yangtools / yang / data / codec / gson / JSONCodecFactory.java
index 87ee320406e2d368874b458ebc3d04b97b512b81..159ecfbf56f286ba4b344e78e8684e36541df0ca 100644 (file)
@@ -21,7 +21,7 @@ import org.opendaylight.yangtools.yang.data.impl.codec.StringStringCodec;
 import org.opendaylight.yangtools.yang.data.util.codec.AbstractCodecFactory;
 import org.opendaylight.yangtools.yang.data.util.codec.CodecCache;
 import org.opendaylight.yangtools.yang.data.util.codec.LazyCodecCache;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
 import org.opendaylight.yangtools.yang.model.api.type.BinaryTypeDefinition;
 import org.opendaylight.yangtools.yang.model.api.type.BitsTypeDefinition;
 import org.opendaylight.yangtools.yang.model.api.type.BooleanTypeDefinition;
@@ -44,11 +44,11 @@ import org.opendaylight.yangtools.yang.model.api.type.UnknownTypeDefinition;
 
 /**
  * Factory for creating JSON equivalents of codecs. Each instance of this object is bound to
- * a particular {@link SchemaContext}, but can be reused by multiple {@link JSONNormalizedNodeStreamWriter}s.
+ * a particular {@link EffectiveModelContext}, but can be reused by multiple {@link JSONNormalizedNodeStreamWriter}s.
  */
 @Beta
 public abstract class JSONCodecFactory extends AbstractCodecFactory<JSONCodec<?>> {
-    JSONCodecFactory(final @NonNull SchemaContext context, final @NonNull CodecCache<JSONCodec<?>> cache) {
+    JSONCodecFactory(final @NonNull EffectiveModelContext context, final @NonNull CodecCache<JSONCodec<?>> cache) {
         super(context, cache);
     }
 
@@ -84,7 +84,7 @@ public abstract class JSONCodecFactory extends AbstractCodecFactory<JSONCodec<?>
 
     @Override
     protected final JSONCodec<?> identityRefCodec(final IdentityrefTypeDefinition type, final QNameModule module) {
-        return new IdentityrefJSONCodec(getSchemaContext(), module);
+        return new IdentityrefJSONCodec(getEffectiveModelContext(), module);
     }
 
     @Override
@@ -147,18 +147,18 @@ public abstract class JSONCodecFactory extends AbstractCodecFactory<JSONCodec<?>
 
     // Returns a one-off factory for the purposes of normalizing an anydata tree.
     //
-    // FIXME: 5.0.0: this is really ugly, as we should be able to tell if the new context is the same as ours and
+    // FIXME: 6.0.0: this is really ugly, as we should be able to tell if the new context is the same as ours and
     //               whether our cache is thread-safe -- in which case we should just return this.
     //               The supplier/cache/factory layout needs to be reworked so that this call ends up being equivalent
     //               to JSONCodecFactorySupplier.getShared() in case this factory is not thread safe.
     //
     //               The above is not currently possible, as we cannot reference JSONCodecFactorySupplier from the
     //               factory due to that potentially creating a circular reference.
-    final JSONCodecFactory rebaseTo(final SchemaContext newSchemaContext) {
+    final JSONCodecFactory rebaseTo(final EffectiveModelContext newSchemaContext) {
         return rebaseTo(newSchemaContext, new LazyCodecCache<>());
     }
 
-    abstract JSONCodecFactory rebaseTo(SchemaContext newSchemaContext, CodecCache<JSONCodec<?>> newCache);
+    abstract JSONCodecFactory rebaseTo(EffectiveModelContext newSchemaContext, CodecCache<JSONCodec<?>> newCache);
 
     abstract JSONCodec<?> wrapDecimalCodec(DecimalStringCodec decimalCodec);