BUG-6533: add immutable implementations of yang.model.api 57/44657/8
authorRobert Varga <rovarga@cisco.com>
Thu, 25 Aug 2016 11:14:27 +0000 (13:14 +0200)
committerRobert Varga <nite@hq.sk>
Thu, 22 Dec 2016 12:45:10 +0000 (12:45 +0000)
This patch introduces Immutables.org annotations to generate
immutable/builder implementation of yang.model.api interfaces.

These are contained in a separate artifact and not available
as a feature, since they currently do not have a user.

Change-Id: I98a9969138a702b67139f323e77fa955162c3d74
Signed-off-by: Robert Varga <rovarga@cisco.com>
28 files changed:
common/artifacts/pom.xml
yang/pom.xml
yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/ChoiceCaseNode.java
yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/ContainerSchemaNode.java
yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/DocumentedNode.java
yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/ListSchemaNode.java
yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/RpcDefinition.java
yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/SchemaContext.java
yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/UsesNode.java
yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/package-info.java
yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/type/BinaryTypeDefinition.java
yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/type/BooleanTypeDefinition.java
yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/type/DecimalTypeDefinition.java
yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/type/EnumTypeDefinition.java
yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/type/IdentityrefTypeDefinition.java
yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/type/PatternConstraint.java
yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/type/StringTypeDefinition.java
yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/type/UnionTypeDefinition.java
yang/yang-model-immutable/pom.xml [new file with mode: 0644]
yang/yang-model-immutable/src/main/java/org/opendaylight/yangtools/yang/model/immutable/AbstractChoiceCaseNode.java [new file with mode: 0644]
yang/yang-model-immutable/src/main/java/org/opendaylight/yangtools/yang/model/immutable/AbstractContainerSchemaNode.java [new file with mode: 0644]
yang/yang-model-immutable/src/main/java/org/opendaylight/yangtools/yang/model/immutable/AbstractDataNodeContainer.java [new file with mode: 0644]
yang/yang-model-immutable/src/main/java/org/opendaylight/yangtools/yang/model/immutable/AbstractListSchemaNode.java [new file with mode: 0644]
yang/yang-model-immutable/src/main/java/org/opendaylight/yangtools/yang/model/immutable/AbstractModule.java [new file with mode: 0644]
yang/yang-model-immutable/src/main/java/org/opendaylight/yangtools/yang/model/immutable/AbstractNotificationDefinition.java [new file with mode: 0644]
yang/yang-model-immutable/src/main/java/org/opendaylight/yangtools/yang/model/immutable/AbstractSchemaContext.java [new file with mode: 0644]
yang/yang-model-immutable/src/main/java/org/opendaylight/yangtools/yang/model/immutable/CommonContainerSchemaNode.java [new file with mode: 0644]
yang/yang-model-immutable/src/main/java/org/opendaylight/yangtools/yang/model/immutable/package-info.java [new file with mode: 0644]

index fdfa06544e9e16f3063dc9711a5c5e8bb27b1287..289c44e4943d88c565df8f7b0b96843861cbc886 100644 (file)
                 <artifactId>yang-model-export</artifactId>
                 <version>${project.version}</version>
             </dependency>
+            <dependency>
+                <groupId>org.opendaylight.yangtools</groupId>
+                <artifactId>yang-model-immutable</artifactId>
+                <version>${project.version}</version>
+            </dependency>
             <dependency>
                 <groupId>org.opendaylight.yangtools</groupId>
                 <artifactId>yang-model-util</artifactId>
index e52383c526c3a6b1a18462b373d0a98596b8f3bf..f729e2424fb6ea0a1cb30786797ab5fb668fa30d 100644 (file)
         <module>yang-data-transform</module>
         <module>yang-data-codec-gson</module>
         <module>yang-data-codec-xml</module>
-        <module>yang-model-api</module>
         <module>yang-maven-plugin</module>
         <module>yang-maven-plugin-it</module>
         <module>yang-maven-plugin-spi</module>
+        <module>yang-model-api</module>
+        <module>yang-model-export</module>
+        <module>yang-model-immutable</module>
         <module>yang-model-util</module>
         <module>yang-parser-api</module>
         <module>yang-parser-impl</module>
-        <module>yang-model-export</module>
         <module>yang-data-jaxen</module>
         <module>yang-system-test</module>
         <module>yang-test-util</module>
index e38df949bf5046272b305bdd23dc7e525a4cd72d..5b129689299a774759003e40e1365638b97a8086 100644 (file)
@@ -10,7 +10,6 @@ package org.opendaylight.yangtools.yang.model.api;
 /**
  * The ChoiceCaseNode interface is used to define branches of the ChoiceNode.
  */
-public interface ChoiceCaseNode extends DataSchemaNode, DataNodeContainer,
-        AugmentationTarget {
+public interface ChoiceCaseNode extends DataSchemaNode, DataNodeContainer, AugmentationTarget {
 
 }
index e7ebc0e186bf40ad265ead77c7e29664d7479daf..cd4996e8f951977c4003c2b94d683f231627183b 100644 (file)
@@ -7,7 +7,6 @@
  */
 package org.opendaylight.yangtools.yang.model.api;
 
-
 /**
  * The ContainerSchemaNode is used to define an interior data node in the schema
  * tree. There are two styles of containers, those that exist only for
index a3b031a08cc454e010c80e22038aacd930c43ded..353a817c3723624e649785a313ea4a3c34fc55e2 100644 (file)
@@ -13,9 +13,7 @@ import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 
 /**
- *
  * Node which can have documentation assigned.
- *
  */
 public interface DocumentedNode {
 
index b2e1a321b8ce5d27342a32339c3c7f7cd3d298fe..217b4a2f16f693fd77578aca375d79435017966a 100644 (file)
@@ -21,8 +21,8 @@ import org.opendaylight.yangtools.yang.common.QName;
  * if defined.
  * </p>
  */
-public interface ListSchemaNode extends DataNodeContainer, AugmentationTarget, DataSchemaNode, NotificationNodeContainer,
-        ActionNodeContainer {
+public interface ListSchemaNode extends DataNodeContainer, AugmentationTarget, DataSchemaNode,
+        NotificationNodeContainer, ActionNodeContainer {
 
     /**
      * @return List of QNames of leaf identifiers of this list
index 375be863739fab7990806e6d4146f6257f6bfc0b..42b49cc237707f126e704351195cd865d53aa427 100644 (file)
@@ -9,11 +9,11 @@ package org.opendaylight.yangtools.yang.model.api;
 
 /**
  * Interface describing YANG 'rpc' statement.
+ *
  * <p>
  * The rpc statement defines an rpc node in the schema tree. Under the rpc node,
  * a schema node with the name 'input', and a schema node with the name 'output'
  * are also defined.
- * </p>
  */
 public interface RpcDefinition extends OperationDefinition {
 
index 707fa11504bef8a16bbe7c2caa0e95f3ba38e613..770a5841256cbc1e248d5315a5cf03908b5cc0ef 100644 (file)
@@ -8,6 +8,7 @@
 package org.opendaylight.yangtools.yang.model.api;
 
 import com.google.common.base.Optional;
+import com.google.common.collect.Sets;
 import java.net.URI;
 import java.util.Date;
 import java.util.Set;
@@ -88,7 +89,9 @@ public interface SchemaContext extends ContainerSchemaNode {
      * @return module instance which has namespace equal to the
      *         <code>namespace</code> or <code>null</code> in other cases
      */
-    Set<Module> findModuleByNamespace(final URI namespace);
+    default Set<Module> findModuleByNamespace(final URI namespace) {
+        return Sets.filter(getModules(), m -> namespace.equals(m.getNamespace()));
+    }
 
     /**
      * Returns module instance based on given namespace and revision. If
@@ -96,10 +99,19 @@ public interface SchemaContext extends ContainerSchemaNode {
      *
      * @param namespace
      * @param revision
-     * @return
+     * @return Matching module or null if a match is not found
      */
-    Module findModuleByNamespaceAndRevision(final URI namespace, final Date revision);
-
+    default Module findModuleByNamespaceAndRevision(final URI namespace, final Date revision) {
+        if (namespace == null) {
+            return null;
+        }
+        for (Module module : findModuleByNamespace(namespace)) {
+            if (revision == null || revision.equals(module.getRevision())) {
+                return module;
+            }
+        }
+        return null;
+    }
 
     /**
      * Get yang source code represented as string for matching
index d0106cff66bf8e3f7da0740331a0196120149dd9..86acdf68e4b3853c54c5a970693cbedd53412314 100644 (file)
@@ -15,7 +15,6 @@ import javax.annotation.Nonnull;
 /**
  * Contains the methods for getting data and checking properties of the YANG
  * <code>uses</code> substatement.
- *
  */
 public interface UsesNode extends DocumentedNode.WithStatus {
 
index 424c64b081ebff70b0841a2bcba368f2c9c02194..9c8fc6245671055c38857832a1daa4cd0c98c6c5 100644 (file)
@@ -36,7 +36,6 @@
  * <dt>argument
  *   <dd>{@link org.opendaylight.yangtools.yang.model.api.ExtensionDefinition#getArgument()}
  *
- *
  * <dt>augment
  *   <dd>{@link org.opendaylight.yangtools.yang.model.api.AugmentationSchema}
  *
@@ -44,7 +43,7 @@
  *   <dd>{@link org.opendaylight.yangtools.yang.model.api.type.IdentityrefTypeDefinition#getIdentity()}
  *
  * <dt>belongs-to
- *   <dd>
+ *   <dd>{@link org.opendaylight.yangtools.yang.model.api.stmt.SubmoduleStatement#getBelongsTo()}
  *
  * <dt>bit
  *   <dd>{@link org.opendaylight.yangtools.yang.model.api.type.BitsTypeDefinition.Bit}
@@ -66,7 +65,7 @@
  *   <dd>{@link org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode}
  *
  * <dt>default
- *   <dd>
+ *   <dd>{@link org.opendaylight.yangtools.yang.model.api.LeafSchemaNode#getDefault()}
  *
  * <dt>description
  *   <dd>{@link org.opendaylight.yangtools.yang.model.api.SchemaNode#getDescription()}
@@ -89,7 +88,7 @@
  *   <dd>{@link org.opendaylight.yangtools.yang.model.api.Deviation}
  *
  * <dt>deviate
- *   <dd>
+ *   <dd>{@link org.opendaylight.yangtools.yang.model.api.DeviateKind}
  *
  * <dt>feature
  *   <dd>{@link org.opendaylight.yangtools.yang.model.api.FeatureDefinition}
  *   <dd>{@link org.opendaylight.yangtools.yang.model.api.GroupingDefinition}
  *
  * <dt>identity
- *   <dd>
+ *   <dd>{@link org.opendaylight.yangtools.yang.model.api.IdentitySchemaNode}
  *
  * <dt>if-feature
- *   <dd>
+ *   <dd>{@link org.opendaylight.yangtools.yang.model.api.stmt.IfFeatureStatement}
  *
  * <dt>import
  *   <dd>{@link org.opendaylight.yangtools.yang.model.api.ModuleImport}
  *
  * <dt>include
- *   <dd>
+ *   <dd>{@link org.opendaylight.yangtools.yang.model.api.stmt.IncludeStatement}
  *
  * <dt>input
  *   <dd>{@link org.opendaylight.yangtools.yang.model.api.RpcDefinition#getInput()}
  *   <dd>{@link org.opendaylight.yangtools.yang.model.api.SchemaNode#getReference()}
  *
  * <dt>refine
- *   <dd>
+ *   <dd>{@link org.opendaylight.yangtools.yang.model.api.stmt.RefineStatement}
  *
  * <dt>require-instance
  *   <dd>{@link org.opendaylight.yangtools.yang.model.api.type.InstanceIdentifierTypeDefinition#requireInstance()}
  *   <dd>{@link org.opendaylight.yangtools.yang.model.api.SchemaNode#getStatus()}
  *
  * <dt>submodule
- *   <dd>
+ *   <dd>{@link org.opendaylight.yangtools.yang.model.api.stmt.SubmoduleStatement}
  *
  * <dt>type
  *   <dd>{@link org.opendaylight.yangtools.yang.model.api.TypeDefinition}
  *   <dd>{@link org.opendaylight.yangtools.yang.model.api.TypeDefinition}
  *
  * <dt>unique
- *   <dd>
+ *   <dd>{@link org.opendaylight.yangtools.yang.model.api.UniqueConstraint}
  *
  * <dt>units
  *   <dd>{@link org.opendaylight.yangtools.yang.model.api.TypeDefinition#getUnits()}
  *   <dd>{@link org.opendaylight.yangtools.yang.model.api.ConstraintDefinition#getWhenCondition()}
  *
  * <dt>yang-version
+ *   <dd>{@link org.opendaylight.yangtools.yang.model.api.Module#getYangVersion()}
  *
  * <dt>yin-element
- *   <dd>
- *
- *
- *
+ *   <dd>{@link org.opendaylight.yangtools.yang.model.api.ExtensionDefinition#isYinElement()}
  *
  * <dt>add
- *   <dd>
+ *   <dd>{@link org.opendaylight.yangtools.yang.model.api.DeviateKind#ADD}
  *
  * <dt>current
- *   <dd>
+ *   <dd>{@link org.opendaylight.yangtools.yang.model.api.Status#CURRENT}
  *
  * <dt>delete
- *   <dd>
+ *   <dd>{@link org.opendaylight.yangtools.yang.model.api.DeviateKind#DELETE}
  *
  * <dt>deprecated
- *   <dd>
+ *   <dd>{@link org.opendaylight.yangtools.yang.model.api.Status#DEPRECATED}
  *
  * <dt>false
- *   <dd>
+ *   <dd>{@link java.lang.Boolean#FALSE}
  *
  * <dt>max
- *   <dd>
+ *   <dd>Not exposed
  *
  * <dt>min
- *   <dd>
+ *   <dd>Not exposed
  *
  * <dt>not-supported
- *   <dd>
+ *   <dd>{@link org.opendaylight.yangtools.yang.model.api.DeviateKind#NOT_SUPPORTED}
  *
  * <dt>obsolete
- *   <dd>
+ *   <dd>{@link org.opendaylight.yangtools.yang.model.api.Status#OBSOLETE}
  *
  * <dt>replace
- *   <dd>
+ *   <dd>{@link org.opendaylight.yangtools.yang.model.api.DeviateKind#REPLACE}
  *
  * <dt>system
- *   <dd>
+ *   <dd>{@link org.opendaylight.yangtools.yang.model.api.ListSchemaNode#isUserOrdered()}
  *
  * <dt>true
- *   <dd>
+ *   <dd>{@link java.lang.Boolean#TRUE}
  *
  * <dt>unbounded
- *   <dd>
+ *   <dd>Not exposed
  *
  * <dt>user
- *   <dd>
+ *   <dd>{@link org.opendaylight.yangtools.yang.model.api.ListSchemaNode#isUserOrdered()}
  * </dl>
  *
  *
index b097fd3d87d6ae81e822ae306fa8fc66bfd7fb70..94eca2b9e4c5014c240b7545d404a4b4a08e5b15 100644 (file)
@@ -12,7 +12,7 @@ import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
 
 /**
  * The binary built-in type represents any binary data, i.e., a sequence of
- * octets. <br>
+ * octets.
  * <br>
  * Binary values are encoded with the base64 encoding scheme (see <a
  * href="https://tools.ietf.org/html/rfc4648#section-4">[RFC4648], Section
@@ -21,7 +21,6 @@ import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
  * href="https://tools.ietf.org/html/rfc4648">[RFC4648]</a>.
  *
  * <br>
- * <br>
  * This interface was modeled according to definition in <a
  * href="https://tools.ietf.org/html/rfc6020#section-9.8">[RFC-6020] The binary
  * Built-In Type</a>
index dd20aacc5f6da9f6e5a28b5b7068546f50f80138..503dbd69b838612b12fc4511b1f60675ba5cafe8 100644 (file)
@@ -10,10 +10,8 @@ package org.opendaylight.yangtools.yang.model.api.type;
 import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
 
 /**
- *
  * Marker interface which marks that type definition represents the built-in
  * YANG <code>boolean</code> type.
- *
  */
 public interface BooleanTypeDefinition extends TypeDefinition<BooleanTypeDefinition> {
 
index 66bc99fc80e5b7894e64fb4a70ecda7f3b658479..75f6f434445a2b6f3734521bf776c10fc4340a3e 100644 (file)
@@ -14,7 +14,6 @@ import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
 /**
  * Contains methods for getting data from the YANG <code>type</code>
  * substatement for <code>decimal64</code> built-in type.
- *
  */
 public interface DecimalTypeDefinition extends TypeDefinition<DecimalTypeDefinition> {
 
index d27e2ba3d18f0e1b42cbb69f0184becc4d1ee6bd..402d7135d9f8eb5be3ea0766d2873fddcf196e65 100644 (file)
@@ -27,7 +27,6 @@ public interface EnumTypeDefinition extends TypeDefinition<EnumTypeDefinition> {
     @Nonnull List<EnumPair> getValues();
 
     /**
-     *
      * Contains the methods for accessing the data about the concrete
      * enumeration item which represents <code>enum</code> YANG type.
      */
index 1ab5370d5f03c988fc52e43628128663103de129..30d48b7627bbeb0fd515678e13883027ba8ed5d5 100644 (file)
@@ -11,13 +11,10 @@ import org.opendaylight.yangtools.yang.model.api.IdentitySchemaNode;
 import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
 
 /**
- *
  * Contains method for getting data from <code>identityref</code> built-in YANG
  * type.
- *
  */
 public interface IdentityrefTypeDefinition extends TypeDefinition<IdentityrefTypeDefinition> {
-
     /**
      * Returns identity to which the instance of this type refers.
      *
@@ -25,5 +22,4 @@ public interface IdentityrefTypeDefinition extends TypeDefinition<IdentityrefTyp
      *         statement
      */
     IdentitySchemaNode getIdentity();
-
 }
index 07af97cc5cb6f88a88327917bc30bc6008f3321a..14844c64a9d776aeabcc78d86dc0a1694bac6bfb 100644 (file)
@@ -13,7 +13,6 @@ import org.opendaylight.yangtools.yang.model.api.ConstraintMetaDefinition;
 /**
  * Contains the method for getting the data from the YANG <code>pattern</code>
  * which is substatement of <code>type</code> statement.
- *
  */
 public interface PatternConstraint extends ConstraintMetaDefinition {
 
index 958e796e517912f32bb75342d6d0d5d0c273ba60..c5784be50500146fbd9f56c1aad2da20145d5de9 100644 (file)
@@ -11,7 +11,6 @@ import java.util.List;
 import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
 
 /**
- *
  * Contains method for getting data from the <code>string</code> YANG built-in
  * type.
  */
index 6b2897f588fbccce006d21b310a6ce8985271831..c08cc7602dd439ff28477bf394874bea2ccd82bf 100644 (file)
@@ -8,12 +8,10 @@
 package org.opendaylight.yangtools.yang.model.api.type;
 
 import java.util.List;
-
 import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
 
 /**
  * Contains the method which access union item in the union type.
- *
  */
 public interface UnionTypeDefinition extends TypeDefinition<UnionTypeDefinition> {
 
diff --git a/yang/yang-model-immutable/pom.xml b/yang/yang-model-immutable/pom.xml
new file mode 100644 (file)
index 0000000..1b275f8
--- /dev/null
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- vi: set et smarttab sw=4 tabstop=4: -->
+<!--
+ Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+
+ This program and the accompanying materials are made available under the
+ terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ and is available at http://www.eclipse.org/legal/epl-v10.html
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+    <parent>
+        <groupId>org.opendaylight.odlparent</groupId>
+        <artifactId>bundle-parent</artifactId>
+        <version>1.8.0-SNAPSHOT</version>
+        <relativePath/>
+    </parent>
+
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.opendaylight.yangtools</groupId>
+    <artifactId>yang-model-immutable</artifactId>
+    <version>1.1.0-SNAPSHOT</version>
+    <packaging>bundle</packaging>
+    <name>${project.artifactId}</name>
+    <description>${project.artifactId}</description>
+
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId>org.opendaylight.yangtools</groupId>
+                <artifactId>yangtools-artifacts</artifactId>
+                <version>1.1.0-SNAPSHOT</version>
+                <scope>import</scope>
+                <type>pom</type>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
+
+    <dependencies>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>yang-model-api</artifactId>
+        </dependency>
+
+        <dependency>
+          <groupId>org.immutables</groupId>
+          <artifactId>value</artifactId>
+          <version>2.3.9</version>
+          <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.mockito</groupId>
+            <artifactId>mockito-core</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>ch.qos.logback</groupId>
+            <artifactId>logback-classic</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+    <!--
+        Maven Site Configuration
+
+        The following configuration is necessary for maven-site-plugin to
+        correctly identify the correct deployment path for OpenDaylight Maven
+        sites.
+    -->
+    <url>${odl.site.url}/${project.groupId}/${stream}/${project.artifactId}/</url>
+    <distributionManagement>
+        <site>
+            <id>opendaylight-site</id>
+            <url>${nexus.site.url}/${project.artifactId}/</url>
+        </site>
+    </distributionManagement>
+</project>
diff --git a/yang/yang-model-immutable/src/main/java/org/opendaylight/yangtools/yang/model/immutable/AbstractChoiceCaseNode.java b/yang/yang-model-immutable/src/main/java/org/opendaylight/yangtools/yang/model/immutable/AbstractChoiceCaseNode.java
new file mode 100644 (file)
index 0000000..3731f4a
--- /dev/null
@@ -0,0 +1,16 @@
+/*
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.model.immutable;
+
+import org.immutables.value.Value;
+import org.opendaylight.yangtools.yang.model.api.ChoiceCaseNode;
+
+@Value.Immutable
+abstract class AbstractChoiceCaseNode extends AbstractDataNodeContainer implements ChoiceCaseNode {
+
+}
diff --git a/yang/yang-model-immutable/src/main/java/org/opendaylight/yangtools/yang/model/immutable/AbstractContainerSchemaNode.java b/yang/yang-model-immutable/src/main/java/org/opendaylight/yangtools/yang/model/immutable/AbstractContainerSchemaNode.java
new file mode 100644 (file)
index 0000000..b492463
--- /dev/null
@@ -0,0 +1,16 @@
+/*
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.model.immutable;
+
+import org.immutables.value.Value;
+import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
+
+@Value.Immutable
+abstract class AbstractContainerSchemaNode extends CommonContainerSchemaNode implements ContainerSchemaNode {
+
+}
diff --git a/yang/yang-model-immutable/src/main/java/org/opendaylight/yangtools/yang/model/immutable/AbstractDataNodeContainer.java b/yang/yang-model-immutable/src/main/java/org/opendaylight/yangtools/yang/model/immutable/AbstractDataNodeContainer.java
new file mode 100644 (file)
index 0000000..030df61
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.model.immutable;
+
+import java.util.Collection;
+import java.util.Map;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.model.api.DataNodeContainer;
+import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
+
+abstract class AbstractDataNodeContainer implements DataNodeContainer {
+
+    abstract Map<QName, DataSchemaNode> children();
+
+    @Override
+    public final Collection<DataSchemaNode> getChildNodes() {
+        return children().values();
+    }
+
+    @Override
+    public final DataSchemaNode getDataChildByName(final QName name) {
+        return children().get(name);
+    }
+}
diff --git a/yang/yang-model-immutable/src/main/java/org/opendaylight/yangtools/yang/model/immutable/AbstractListSchemaNode.java b/yang/yang-model-immutable/src/main/java/org/opendaylight/yangtools/yang/model/immutable/AbstractListSchemaNode.java
new file mode 100644 (file)
index 0000000..ce2c246
--- /dev/null
@@ -0,0 +1,16 @@
+/*
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.model.immutable;
+
+import org.immutables.value.Value;
+import org.opendaylight.yangtools.yang.model.api.ListSchemaNode;
+
+@Value.Immutable
+abstract class AbstractListSchemaNode extends AbstractDataNodeContainer implements ListSchemaNode {
+
+}
diff --git a/yang/yang-model-immutable/src/main/java/org/opendaylight/yangtools/yang/model/immutable/AbstractModule.java b/yang/yang-model-immutable/src/main/java/org/opendaylight/yangtools/yang/model/immutable/AbstractModule.java
new file mode 100644 (file)
index 0000000..f01ac25
--- /dev/null
@@ -0,0 +1,16 @@
+/*
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.model.immutable;
+
+import org.immutables.value.Value;
+import org.opendaylight.yangtools.yang.model.api.Module;
+
+@Value.Immutable
+abstract class AbstractModule extends AbstractDataNodeContainer implements Module {
+
+}
diff --git a/yang/yang-model-immutable/src/main/java/org/opendaylight/yangtools/yang/model/immutable/AbstractNotificationDefinition.java b/yang/yang-model-immutable/src/main/java/org/opendaylight/yangtools/yang/model/immutable/AbstractNotificationDefinition.java
new file mode 100644 (file)
index 0000000..3a2d54e
--- /dev/null
@@ -0,0 +1,16 @@
+/*
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.model.immutable;
+
+import org.immutables.value.Value;
+import org.opendaylight.yangtools.yang.model.api.NotificationDefinition;
+
+@Value.Immutable
+abstract class AbstractNotificationDefinition extends AbstractDataNodeContainer implements NotificationDefinition {
+
+}
diff --git a/yang/yang-model-immutable/src/main/java/org/opendaylight/yangtools/yang/model/immutable/AbstractSchemaContext.java b/yang/yang-model-immutable/src/main/java/org/opendaylight/yangtools/yang/model/immutable/AbstractSchemaContext.java
new file mode 100644 (file)
index 0000000..fabfd76
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.model.immutable;
+
+import com.google.common.base.Optional;
+import java.util.Date;
+import org.immutables.value.Value;
+import org.opendaylight.yangtools.yang.model.api.Module;
+import org.opendaylight.yangtools.yang.model.api.ModuleIdentifier;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+
+@Value.Immutable
+abstract class AbstractSchemaContext extends CommonContainerSchemaNode implements SchemaContext {
+
+    @Override
+    public final Optional<String> getModuleSource(final ModuleIdentifier moduleIdentifier) {
+        throw new UnsupportedOperationException("Not implemented");
+    }
+
+    @Override
+    public Module findModuleByName(final String name, final Date revision) {
+        throw new UnsupportedOperationException("Not implemented");
+    }
+}
diff --git a/yang/yang-model-immutable/src/main/java/org/opendaylight/yangtools/yang/model/immutable/CommonContainerSchemaNode.java b/yang/yang-model-immutable/src/main/java/org/opendaylight/yangtools/yang/model/immutable/CommonContainerSchemaNode.java
new file mode 100644 (file)
index 0000000..83f39f0
--- /dev/null
@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.yangtools.yang.model.immutable;
+
+import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
+
+/**
+ * Common abstract class capturing {@link AbstractDataNodeContainer} and {@link ContainerSchemaNode}.
+ *
+ * @author Robert Varga
+ */
+abstract class CommonContainerSchemaNode extends AbstractDataNodeContainer implements ContainerSchemaNode {
+
+}
diff --git a/yang/yang-model-immutable/src/main/java/org/opendaylight/yangtools/yang/model/immutable/package-info.java b/yang/yang-model-immutable/src/main/java/org/opendaylight/yangtools/yang/model/immutable/package-info.java
new file mode 100644 (file)
index 0000000..df049d5
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+/**
+ * Generated immutable implementations for org.opendaylight.yangtools.yang.model.api interfaces.
+ *
+ * @author Robert Varga
+ */
+@Include(value = {
+        org.opendaylight.yangtools.yang.model.api.ActionDefinition.class,
+        org.opendaylight.yangtools.yang.model.api.AnyDataSchemaNode.class,
+        org.opendaylight.yangtools.yang.model.api.AnyXmlSchemaNode.class,
+        org.opendaylight.yangtools.yang.model.api.ExtensionDefinition.class,
+        org.opendaylight.yangtools.yang.model.api.FeatureDefinition.class,
+        org.opendaylight.yangtools.yang.model.api.IdentitySchemaNode.class,
+        org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode.class,
+        org.opendaylight.yangtools.yang.model.api.LeafSchemaNode.class,
+        org.opendaylight.yangtools.yang.model.api.ModuleImport.class,
+        org.opendaylight.yangtools.yang.model.api.RpcDefinition.class,
+        org.opendaylight.yangtools.yang.model.api.type.BinaryTypeDefinition.class,
+        org.opendaylight.yangtools.yang.model.api.type.BitsTypeDefinition.class,
+        org.opendaylight.yangtools.yang.model.api.type.BitsTypeDefinition.Bit.class,
+        org.opendaylight.yangtools.yang.model.api.type.BooleanTypeDefinition.class,
+        org.opendaylight.yangtools.yang.model.api.type.DecimalTypeDefinition.class,
+        org.opendaylight.yangtools.yang.model.api.type.EmptyTypeDefinition.class,
+        org.opendaylight.yangtools.yang.model.api.type.EnumTypeDefinition.class,
+        org.opendaylight.yangtools.yang.model.api.type.EnumTypeDefinition.EnumPair.class,
+        org.opendaylight.yangtools.yang.model.api.type.IdentityrefTypeDefinition.class,
+        org.opendaylight.yangtools.yang.model.api.type.IntegerTypeDefinition.class,
+        org.opendaylight.yangtools.yang.model.api.type.InstanceIdentifierTypeDefinition.class,
+        org.opendaylight.yangtools.yang.model.api.type.LeafrefTypeDefinition.class,
+        org.opendaylight.yangtools.yang.model.api.type.LengthConstraint.class,
+        org.opendaylight.yangtools.yang.model.api.type.PatternConstraint.class,
+        org.opendaylight.yangtools.yang.model.api.type.RangeConstraint.class,
+        org.opendaylight.yangtools.yang.model.api.type.StringTypeDefinition.class,
+        org.opendaylight.yangtools.yang.model.api.type.UnionTypeDefinition.class,
+        org.opendaylight.yangtools.yang.model.api.type.UnsignedIntegerTypeDefinition.class,
+})
+@Style(
+    builderVisibility =  BuilderVisibility.PUBLIC,
+    strictBuilder = true,
+    visibility = ImplementationVisibility.PRIVATE)
+package org.opendaylight.yangtools.yang.model.immutable;
+
+import org.immutables.value.Value.Include;
+import org.immutables.value.Value.Style;
+import org.immutables.value.Value.Style.BuilderVisibility;
+import org.immutables.value.Value.Style.ImplementationVisibility;