Add Empty.value() 05/98505/2
authorRobert Varga <robert.varga@pantheon.tech>
Sun, 14 Nov 2021 18:32:58 +0000 (19:32 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Sun, 14 Nov 2021 18:58:22 +0000 (19:58 +0100)
Introduce a more friendly name for returning the empty instance. The new
method is 'value()' and 'getInstance()' is deprecated.

JIRA: YANGTOOLS-1363
Change-Id: Ie74754655247fcf74c1689bbb246fb4035999bb3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
29 files changed:
codec/yang-data-codec-binfmt/src/main/java/org/opendaylight/yangtools/yang/data/codec/binfmt/AbstractLithiumDataInput.java
codec/yang-data-codec-binfmt/src/main/java/org/opendaylight/yangtools/yang/data/codec/binfmt/AbstractMagnesiumDataInput.java
codec/yang-data-codec-binfmt/src/test/java/org/opendaylight/yangtools/yang/data/codec/binfmt/NormalizedNodeStreamReaderWriterTest.java
codec/yang-data-codec-gson/src/main/java/org/opendaylight/yangtools/yang/data/codec/gson/EmptyJSONCodec.java
codec/yang-data-codec-gson/src/test/java/org/opendaylight/yangtools/yang/data/codec/gson/AbstractComplexJsonTest.java
codec/yang-data-codec-xml/src/main/java/org/opendaylight/yangtools/yang/data/codec/xml/EmptyXmlCodec.java
common/yang-common/src/main/java/org/opendaylight/yangtools/yang/common/Empty.java
common/yang-common/src/test/java/org/opendaylight/yangtools/yang/common/EmptyTest.java
data/yang-data-impl/src/main/java/org/opendaylight/yangtools/yang/data/impl/codec/EmptyStringCodec.java
data/yang-data-impl/src/main/java/org/opendaylight/yangtools/yang/data/impl/schema/InstanceIdToSimpleNodes.java
data/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/codec/EmptyCodecStringTest.java
data/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/codec/UnionCodecStringTest.java
data/yang-data-util/src/main/java/org/opendaylight/yangtools/yang/data/util/LeafListEntryContextNode.java
model/yang-model-ri/src/main/java/org/opendaylight/yangtools/yang/model/ri/stmt/impl/decl/UnrecognizedStatementImpl.java
model/yang-model-spi/src/main/java/org/opendaylight/yangtools/yang/model/spi/meta/AbstractDeclaredStatement.java
parser/rfc8040-parser-support/src/main/java/org/opendaylight/yangtools/rfc8040/parser/YangDataStatementSupport.java
parser/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/augment/AbstractAugmentStatementSupport.java
parser/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/augment/AugmentInferenceAction.java
parser/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/import_/ImportStatementSupport.java
parser/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/import_/RevisionImport.java
parser/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/import_/SemanticVersionImport.java
parser/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/module/ModuleStatementSupport.java
parser/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/refine/RefineStatementSupport.java
parser/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/type/AbstractTypeStatementSupport.java
parser/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/uses/UsesStatementSupport.java
parser/yang-parser-rfc7950/src/test/java/org/opendaylight/yangtools/yang/stmt/Bug1412Test.java
parser/yang-parser-rfc7950/src/test/java/org/opendaylight/yangtools/yang/thirdparty/plugin/ThirdPartyExtensionEffectiveStatementImpl.java
parser/yang-parser-rfc7950/src/test/java/org/opendaylight/yangtools/yang/thirdparty/plugin/ThirdPartyExtensionSupport.java
parser/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/meta/AbstractEmptyStatementSupport.java

index c052dbf2d1242e831c3106a57806952513dd7130..b056ca07a6a6a6f78642ab5bd6425b1ba4089cc6 100644 (file)
@@ -389,7 +389,7 @@ abstract class AbstractLithiumDataInput extends AbstractNormalizedNodeDataInput
             // very low. We'd have to know the yang type but, even if we did, we can't let a null value pass upstream
             // so we'd have to drop the leaf which might cause other issues.
             case LithiumValue.NULL_TYPE:
-                return Empty.getInstance();
+                return Empty.value();
 
             default:
                 return null;
index 87182a70c253e7238f3de71d3bb618e032874091..6c3f2c59eb3245e51fa15d8f74ea9fdba6f53664 100644 (file)
@@ -703,7 +703,7 @@ abstract class AbstractMagnesiumDataInput extends AbstractNormalizedNodeDataInpu
             case MagnesiumValue.BOOLEAN_TRUE:
                 return Boolean.TRUE;
             case MagnesiumValue.EMPTY:
-                return Empty.getInstance();
+                return Empty.value();
             case MagnesiumValue.INT8:
                 return input.readByte();
             case MagnesiumValue.INT8_0:
index 29e96a7fc78f816f0c3065e94f1baa9253ccf451..eb418cd76ca2997cb1846495450436b17c4fe511 100644 (file)
@@ -158,7 +158,7 @@ public class NormalizedNodeStreamReaderWriterTest {
                         new NodeIdentifier(TestModel.BINARY_LEAF_LIST_QNAME))
                         .withChild(entry1).withChild(entry2).build())
                 .withChild(ImmutableNodes.leafNode(TestModel.SOME_BINARY_DATA_QNAME, new byte[]{1, 2, 3, 4}))
-                .withChild(ImmutableNodes.leafNode(TestModel.EMPTY_QNAME, Empty.getInstance()))
+                .withChild(ImmutableNodes.leafNode(TestModel.EMPTY_QNAME, Empty.value()))
                 .withChild(Builders.orderedMapBuilder()
                       .withNodeIdentifier(new NodeIdentifier(TestModel.ORDERED_LIST_QNAME))
                       .withChild(ImmutableNodes.mapEntry(TestModel.ORDERED_LIST_ENTRY_QNAME,
index e5f3371843cef247f6d4f7878170a8d6bf7fc773..3165ad072bfee59a5d5956ce5bdf47a34c993e68 100644 (file)
@@ -27,7 +27,7 @@ final class EmptyJSONCodec implements JSONCodec<Empty> {
 
     @Override
     public Empty parseValue(final Object ctx, final String input) {
-        return Empty.getInstance();
+        return Empty.value();
     }
 
     @Override
index 3c1a8bb9580fb8f5e9cca3ec0fb5d4d3ea48c95d..a8815f56ff5e81e016b06315f61a9b5c433d776b 100644 (file)
@@ -24,7 +24,7 @@ public abstract class AbstractComplexJsonTest {
 
     static final ContainerNode CONT1_WITH_EMPTYLEAF = Builders.containerBuilder()
             .withNodeIdentifier(new NodeIdentifier(CONT_1))
-            .addChild(ImmutableNodes.leafNode(EMPTY_LEAF, Empty.getInstance()))
+            .addChild(ImmutableNodes.leafNode(EMPTY_LEAF, Empty.value()))
             .build();
 
     static EffectiveModelContext schemaContext;
index b598c80af87499eb4cd304d2c67b29d5f5a6576b..72c481c6cdc150076f8f98731087768bd740f012 100644 (file)
@@ -29,7 +29,7 @@ final class EmptyXmlCodec implements XmlCodec<Empty> {
 
     @Override
     public Empty parseValue(final NamespaceContext ctx, final String str) {
-        return Empty.getInstance();
+        return Empty.value();
     }
 
     @Override
index af85eb0547316cd378c488b635d6fed56fc47b5d..b5d09f62098a2c14301974b3d48f746030ae7e6c 100644 (file)
@@ -24,10 +24,26 @@ public final class Empty implements Immutable, Serializable {
     private static final Empty INSTANCE = new Empty();
 
     private Empty() {
-
+        // Hidden on purpose
     }
 
+    /**
+     * Return the singleton {@link Empty} value.
+     *
+     * @return Empty value.
+     * @deprecated Use {@link #value()} instead.
+     */
+    @Deprecated(since = "7.0.10", forRemoval = true)
     public static Empty getInstance() {
+        return value();
+    }
+
+    /**
+     * Return the singleton {@link Empty} value.
+     *
+     * @return Empty value.
+     */
+    public static Empty value()  {
         return INSTANCE;
     }
 
index 4df61f90e6b388d74848d34c99021834429a6729..a32d54b1ad67c7dfc375828558b77d863750c7bb 100644 (file)
@@ -22,19 +22,19 @@ public class EmptyTest {
 
     @Test
     public void testInstanceNotNull() {
-        assertNotNull(Empty.getInstance());
+        assertNotNull(Empty.value());
     }
 
     @Test
     public void testToString() {
-        assertEquals("empty", Empty.getInstance().toString());
+        assertEquals("empty", Empty.value().toString());
     }
 
     @Test
     public void testSerialization() throws IOException, ClassNotFoundException {
         final ByteArrayOutputStream bos = new ByteArrayOutputStream();
         try (ObjectOutputStream oos = new ObjectOutputStream(bos)) {
-            oos.writeObject(Empty.getInstance());
+            oos.writeObject(Empty.value());
         }
 
         final Object read;
@@ -42,6 +42,6 @@ public class EmptyTest {
             read = ois.readObject();
         }
 
-        assertSame(Empty.getInstance(), read);
+        assertSame(Empty.value(), read);
     }
 }
index 3810ce9bfeaa45b62fe5ee44581194b516eef8a0..62655f9c6f88137567e5446174201d42efbacb72 100644 (file)
@@ -25,7 +25,7 @@ final class EmptyStringCodec extends TypeDefinitionAwareCodec<Empty, EmptyTypeDe
     @Override
     protected Empty deserializeImpl(final String product) {
         checkArgument(product.isEmpty(), "The value must be empty");
-        return Empty.getInstance();
+        return Empty.value();
     }
 
     @Override
index d1b2b5d85f149c8379204567f82afa3836eb2063..420e2203a3c6c1565548105bd3dcc25fd73dd4d0 100644 (file)
@@ -71,7 +71,7 @@ abstract class InstanceIdToSimpleNodes<T extends PathArgument> extends InstanceI
     static final class LeafListEntryNormalization extends InstanceIdToSimpleNodes<NodeWithValue> {
         LeafListEntryNormalization(final LeafListSchemaNode potential) {
             // We are fudging a value here
-            super(new NodeWithValue<>(potential.getQName(), Empty.getInstance()));
+            super(new NodeWithValue<>(potential.getQName(), Empty.value()));
         }
 
         @Override
index 24a2b78d374d7327ea5b770d63dc2eda0a6f2670..8463474b665fb6eade6f318cc250b73d5ba167f1 100644 (file)
@@ -26,7 +26,7 @@ public class EmptyCodecStringTest {
     public void testSerialize() {
         EmptyCodec<String> codec = TypeDefinitionAwareCodecTestHelper.getCodec(BaseTypes.emptyType(), EmptyCodec.class);
 
-        assertEquals("serialize", "", codec.serialize(Empty.getInstance()));
+        assertEquals("serialize", "", codec.serialize(Empty.value()));
     }
 
     @SuppressWarnings("unchecked")
@@ -34,7 +34,7 @@ public class EmptyCodecStringTest {
     public void testDeserialize() {
         EmptyCodec<String> codec = TypeDefinitionAwareCodecTestHelper.getCodec(BaseTypes.emptyType(), EmptyCodec.class);
 
-        assertEquals("deserialize", Empty.getInstance(), codec.deserialize(""));
+        assertEquals("deserialize", Empty.value(), codec.deserialize(""));
 
         TypeDefinitionAwareCodecTestHelper.deserializeWithExpectedIllegalArgEx(codec, "foo");
     }
index 44d8e5f61b1e465655179ae6901f7c230e489ea7..bb02423d26b7adeff26a694c8b51741e8831a4e9 100644 (file)
@@ -61,7 +61,7 @@ public class UnionCodecStringTest {
         assertEquals("deserialize", 123, codec.deserialize("123"));
         assertEquals("deserialize", -123, codec.deserialize("-123"));
         assertEquals("deserialize", 41234567890L, codec.deserialize("41234567890"));
-        assertEquals("deserialize", Empty.getInstance(), codec.deserialize(""));
+        assertEquals("deserialize", Empty.value(), codec.deserialize(""));
 
         deserializeWithExpectedIllegalArgEx(codec, "enum3");
         deserializeWithExpectedIllegalArgEx(codec, "123o");
index 641758c3e73084aab3e57ea781e767f40a9c683d..dc313f4dd5ca940a2f3e71a37335276110b563bf 100644 (file)
@@ -13,7 +13,7 @@ import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode;
 
 final class LeafListEntryContextNode extends AbstractLeafNodeContext<NodeWithValue<?>, LeafListSchemaNode> {
     LeafListEntryContextNode(final LeafListSchemaNode potential) {
-        super(new NodeWithValue<>(potential.getQName(), Empty.getInstance()), potential);
+        super(new NodeWithValue<>(potential.getQName(), Empty.value()), potential);
     }
 
     @Override
index 2066c14fedf23087efa5914bc6d3899237dcb9fd..eabd840f8c02b208fa0b391c69c33449b45508da 100644 (file)
@@ -34,6 +34,6 @@ public final class UnrecognizedStatementImpl extends WithSubstatements<Object> i
     @Override
     public Object argument() {
         final String raw = rawArgument();
-        return raw != null ? raw : Empty.getInstance();
+        return raw != null ? raw : Empty.value();
     }
 }
index b88bbadbc081914609fdd15cecda9ef229731a31..3c3ecdf3cc53cb0c6e26a8f65085703f9a3b4d10 100644 (file)
@@ -215,7 +215,7 @@ public abstract class AbstractDeclaredStatement<A> extends AbstractModelStatemen
 
         @Override
         public final Empty argument() {
-            return Empty.getInstance();
+            return Empty.value();
         }
 
         @Override
index 98a22df30c8b87ec760478da82f0bc318ce16e82..dc21a0eae12f55080ef818245079b75ee050d80f 100644 (file)
@@ -59,7 +59,7 @@ public final class YangDataStatementSupport
         // Parse and populate our argument to be picked up when we build the effecitve statement
         final String argument = SourceException.throwIfNull(ctx.argument(), ctx, "yang-data requires an argument");
         final QName qname = StmtContextUtils.parseIdentifier(ctx, argument);
-        ctx.addToNs(YangDataArgumentNamespace.class, Empty.getInstance(), qname);
+        ctx.addToNs(YangDataArgumentNamespace.class, Empty.value(), qname);
     }
 
     @Override
@@ -100,6 +100,6 @@ public final class YangDataStatementSupport
         }
 
         return new YangDataEffectiveStatementImpl(stmt, substatements,
-            verifyNotNull(stmt.namespaceItem(YangDataArgumentNamespace.class, Empty.getInstance())));
+            verifyNotNull(stmt.namespaceItem(YangDataArgumentNamespace.class, Empty.value())));
     }
 }
index a6df68789296ad7c0fd7b9a744d04367320c4f5d..48b9fb40a0a95b0709420a5dec176ef061833629 100644 (file)
@@ -129,7 +129,7 @@ abstract class AbstractAugmentStatementSupport
         // Pick up the marker left by onFullDefinitionDeclared() inference action. If it is present we need to pass our
         // children through target's implicit wrapping.
         final StatementContextBase<?, ?, ?> implicitDef = stmt.getFromNamespace(AugmentImplicitHandlingNamespace.class,
-            Empty.getInstance());
+            Empty.value());
         return implicitDef == null ? substatements : Lists.transform(substatements, subCtx -> {
             verify(subCtx instanceof StatementContextBase);
             return implicitDef.wrapWithImplicit((StatementContextBase<?, ?, ?>) subCtx);
index 9877dd692441d9c5cf45a9ecbf5ff497ffc933f0..2f19c1a1cdafe0e34f32d866af6c361c88cad4b1 100644 (file)
@@ -72,7 +72,7 @@ final class AugmentInferenceAction implements InferenceAction {
         // We are targeting a context which is creating implicit nodes. In order to keep things consistent,
         // we will need to circle back when creating effective statements.
         if (augmentTargetCtx.hasImplicitParentSupport()) {
-            augmentNode.addToNs(AugmentImplicitHandlingNamespace.class, Empty.getInstance(), augmentTargetCtx);
+            augmentNode.addToNs(AugmentImplicitHandlingNamespace.class, Empty.value(), augmentTargetCtx);
         }
 
         copyFromSourceToTarget((StatementContextBase<?, ?, ?>) augmentNode, augmentTargetCtx);
index 39c3930feb569dd02af19d499cd5c6b9f19dd1f0..72801070f40d9278801da8d1e03fb7b872f60b8a 100644 (file)
@@ -156,6 +156,6 @@ public final class ImportStatementSupport
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
         InferenceException.throwIf(substatements.isEmpty(), stmt, "Unexpected empty effective import statement");
         return EffectiveStatements.createImport(stmt.declared(), substatements,
-            verifyNotNull(stmt.getFromNamespace(ImportedVersionNamespace.class, Empty.getInstance())));
+            verifyNotNull(stmt.getFromNamespace(ImportedVersionNamespace.class, Empty.value())));
     }
 }
index 57f95eefe68fe4d8983b428179e02d298b749b58..ccc24d7175dba87fae79d507b40a624cb2f4247f 100644 (file)
@@ -65,7 +65,7 @@ final class RevisionImport {
 
                 final SourceIdentifier importedModuleIdentifier =
                     stmt.getFromNamespace(ModuleCtxToSourceIdentifier.class, importedModule);
-                stmt.addToNs(ImportedVersionNamespace.class, Empty.getInstance(), importedModuleIdentifier);
+                stmt.addToNs(ImportedVersionNamespace.class, Empty.value(), importedModuleIdentifier);
 
                 final QNameModule mod = InferenceException.throwIfNull(stmt.getFromNamespace(
                     ModuleCtxToModuleQName.class, importedModule), stmt, "Failed to find module of %s", importedModule);
index d69022f98bdad50f9f0a47568de88099f7499b65..48c78e54fb189d9c5f65f8ca8c49b9f60a09742b 100644 (file)
@@ -139,7 +139,7 @@ final class SemanticVersionImport {
                     ModuleCtxToSourceIdentifier.class, importedModule);
                 final SemVerSourceIdentifier semVerModuleIdentifier = createSemVerModuleIdentifier(
                     importedModuleIdentifier, importedVersion);
-                stmt.addToNs(ImportedVersionNamespace.class, Empty.getInstance(), semVerModuleIdentifier);
+                stmt.addToNs(ImportedVersionNamespace.class, Empty.value(), semVerModuleIdentifier);
 
                 linkageTarget.resolve(ctx).addToNs(ImportedModuleContext.class, importedModuleIdentifier,
                     importedModule);
index 4522b063c9e1e614092d3e92044fc5d8ef8d4f50..a2215ef97f75c2e35c0ab024ffc73fe75cec94fc 100644 (file)
@@ -205,7 +205,7 @@ public final class ModuleStatementSupport
             firstAttributeOf(stmt.declaredSubstatements(), PrefixStatement.class), stmt,
             "Prefix of the module [%s] is missing", stmt.argument());
 
-        stmt.addToNs(QNameModuleNamespace.class, Empty.getInstance(), qNameModule);
+        stmt.addToNs(QNameModuleNamespace.class, Empty.value(), qNameModule);
         stmt.addToNs(PrefixToModule.class, modulePrefix, qNameModule);
         stmt.addToNs(ModuleNameToModuleQName.class, moduleName, qNameModule);
         stmt.addToNs(ModuleCtxToModuleQName.class, stmt, qNameModule);
@@ -274,8 +274,7 @@ public final class ModuleStatementSupport
             submodules.add((Submodule) submodule);
         }
 
-        final QNameModule qnameModule = verifyNotNull(stmt.namespaceItem(QNameModuleNamespace.class,
-            Empty.getInstance()));
+        final QNameModule qnameModule = verifyNotNull(stmt.namespaceItem(QNameModuleNamespace.class, Empty.value()));
         try {
             return new ModuleEffectiveStatementImpl(stmt, substatements, submodules, qnameModule);
         } catch (SubstatementIndexingException e) {
index ce26204b21c1a1ef221633f6e2e0c38335a7d7ad..c09c3bb66d43ea6d6c702e6a1b9bb11dc6a50e58 100644 (file)
@@ -91,7 +91,7 @@ public final class RefineStatementSupport
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
         // Empty refine is exceedingly unlikely: let's be lazy and reuse the implementation
         return new RefineEffectiveStatementImpl(stmt.declared(), substatements,
-            (SchemaNode) verifyNotNull(stmt.namespaceItem(RefineTargetNamespace.class, Empty.getInstance()))
+            (SchemaNode) verifyNotNull(stmt.namespaceItem(RefineTargetNamespace.class, Empty.value()))
                 .buildEffective());
     }
 }
index 32978a7fe6bea85b20e81a98a0d9507985f473dc..34e3a236ecf294391139a2825f1576d88d966c25 100644 (file)
@@ -138,7 +138,7 @@ abstract class AbstractTypeStatementSupport extends AbstractTypeSupport<TypeStat
 
         final BuiltinEffectiveStatement builtin = STATIC_BUILT_IN_TYPES.get(stmt.getRawArgument());
         if (builtin != null) {
-            stmt.addToNs(BaseTypeNamespace.class, Empty.getInstance(), builtin);
+            stmt.addToNs(BaseTypeNamespace.class, Empty.value(), builtin);
             return;
         }
 
@@ -156,7 +156,7 @@ abstract class AbstractTypeStatementSupport extends AbstractTypeSupport<TypeStat
             @Override
             public void apply(final InferenceContext ctx) {
                 // Note: do not attempt to call buildEffective() here
-                stmt.addToNs(BaseTypeNamespace.class, Empty.getInstance(), typePrereq.resolve(ctx));
+                stmt.addToNs(BaseTypeNamespace.class, Empty.value(), typePrereq.resolve(ctx));
             }
 
             @Override
@@ -270,7 +270,7 @@ abstract class AbstractTypeStatementSupport extends AbstractTypeSupport<TypeStat
      * @throws SourceException if the target type cannot be found
      */
     private static @NonNull TypeEffectiveStatement<TypeStatement> resolveType(final Current<QName, ?> ctx) {
-        final Object obj = verifyNotNull(ctx.namespaceItem(BaseTypeNamespace.class, Empty.getInstance()));
+        final Object obj = verifyNotNull(ctx.namespaceItem(BaseTypeNamespace.class, Empty.value()));
         if (obj instanceof BuiltinEffectiveStatement) {
             return (BuiltinEffectiveStatement) obj;
         } else if (obj instanceof StmtContext) {
index 1718bc3218400b7439b401d42953e09ae200838f..22986ca4c00ca02afcba61df02292e1355b52dd6 100644 (file)
@@ -117,7 +117,7 @@ public final class UsesStatementSupport
                 copyFromSourceToTarget(sourceGrpStmtCtx, targetNodeStmtCtx, usesNode);
                 resolveUsesNode(usesNode, targetNodeStmtCtx);
                 StmtContextUtils.validateIfFeatureAndWhenOnListKeys(usesNode);
-                usesNode.addToNs(SourceGroupingNamespace.class, Empty.getInstance(), sourceGrpStmtCtx);
+                usesNode.addToNs(SourceGroupingNamespace.class, Empty.value(), sourceGrpStmtCtx);
             }
 
             @Override
@@ -144,7 +144,7 @@ public final class UsesStatementSupport
     protected UsesEffectiveStatement createEffective(final Current<QName, UsesStatement> stmt,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
         final EffectiveStatement<?, ?> source =
-            verifyNotNull(stmt.getFromNamespace(SourceGroupingNamespace.class, Empty.getInstance())).buildEffective();
+            verifyNotNull(stmt.getFromNamespace(SourceGroupingNamespace.class, Empty.value())).buildEffective();
         verify(source instanceof GroupingDefinition, "Unexpected source %s", source);
         final GroupingDefinition sourceGrouping = (GroupingDefinition) source;
 
@@ -318,7 +318,7 @@ public final class UsesStatementSupport
         // Target is a prerequisite for the 'refine', hence if the target is not supported, the refine is not supported
         // as well. Otherwise add a pointer to the target into refine's local namespace.
         if (refineTargetNodeCtx.isSupportedToBuildEffective()) {
-            subStmtCtx.addToNs(RefineTargetNamespace.class, Empty.getInstance(), refineTargetNodeCtx);
+            subStmtCtx.addToNs(RefineTargetNamespace.class, Empty.value(), refineTargetNodeCtx);
         } else {
             subStmtCtx.setIsSupportedToBuildEffective(false);
         }
index 5911ea0ba9f3df2c3f0816b8c16eafd5b2715d68..668e93dfa17eb85d128ed61ecaf81bd986208b18 100644 (file)
@@ -81,6 +81,6 @@ public class Bug1412Test extends AbstractYangTest {
         assertNotNull(output);
         assertEquals(QName.create("urn:test:bug1412:ext:definitions", "2014-07-25", "output"),
             output.statementDefinition().getStatementName());
-        assertEquals(Empty.getInstance(), output.argument());
+        assertEquals(Empty.value(), output.argument());
     }
 }
index ed50798131bfb84cf9917773f4d306654da98164..d17a74e273cc417506b395071abb79bde962c6ef 100644 (file)
@@ -22,7 +22,7 @@ final class ThirdPartyExtensionEffectiveStatementImpl
     ThirdPartyExtensionEffectiveStatementImpl(final Current<String, ThirdPartyExtensionStatement> stmt,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
         super(stmt.declared(), stmt.argument(), stmt.history(), substatements);
-        valueFromNamespace = stmt.getFromNamespace(ThirdPartyNamespace.class, Empty.getInstance());
+        valueFromNamespace = stmt.getFromNamespace(ThirdPartyNamespace.class, Empty.value());
     }
 
     @Override
index 180b528e5be92ce9eac8ae4102960d00b226ce54..f66de742faa1d95f337642cd113c0d256f5db140 100644 (file)
@@ -28,7 +28,7 @@ public final class ThirdPartyExtensionSupport
     public void onFullDefinitionDeclared(
             final Mutable<String, ThirdPartyExtensionStatement, ThirdPartyExtensionEffectiveStatement> stmt) {
         super.onFullDefinitionDeclared(stmt);
-        stmt.addToNs(ThirdPartyNamespace.class, Empty.getInstance(), "Third-party namespace test.");
+        stmt.addToNs(ThirdPartyNamespace.class, Empty.value(), "Third-party namespace test.");
     }
 
     @Override
index 3b48c1e880b2d09695e17706d4d1b48b3dd7777d..407a475936237d606b55f910065387239e2e95ab 100644 (file)
@@ -27,6 +27,6 @@ public abstract class AbstractEmptyStatementSupport<D extends DeclaredStatement<
     @Override
     public final Empty parseArgumentValue(final StmtContext<?, ?, ?> ctx, final String value) {
         InferenceException.throwIf(value != null, ctx, "Unexpected argument value %s", value);
-        return Empty.getInstance();
+        return Empty.value();
     }
 }