BUG-4688: eliminate QName(Module).getFormattedRevision() 17/64717/2
authorRobert Varga <robert.varga@pantheon.tech>
Wed, 25 Oct 2017 13:42:34 +0000 (15:42 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Wed, 25 Oct 2017 16:53:22 +0000 (18:53 +0200)
Since we are capturing revisions in their objects, these methods do not
really serve a purpose, remove them.

Change-Id: Iac1601fd5e049472d3cda77db9ff306b0443d4ab
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
yang/yang-common/src/main/java/org/opendaylight/yangtools/yang/common/QName.java
yang/yang-common/src/main/java/org/opendaylight/yangtools/yang/common/QNameModule.java

index ce3c1f305cf5ddbbaae86f1c668ec8d33fe1a00d..5ff45e0ad7efd1e01460846a76e954c843da215c 100644 (file)
@@ -340,8 +340,9 @@ public final class QName implements Immutable, Serializable, Comparable<QName> {
         if (getNamespace() != null) {
             sb.append(QNAME_LEFT_PARENTHESIS).append(getNamespace());
 
-            if (getFormattedRevision() != null) {
-                sb.append(QNAME_REVISION_DELIMITER).append(getFormattedRevision());
+            final Optional<Revision> rev = getRevision();
+            if (rev.isPresent()) {
+                sb.append(QNAME_REVISION_DELIMITER).append(rev.get());
             }
             sb.append(QNAME_RIGHT_PARENTHESIS);
         }
@@ -349,21 +350,6 @@ public final class QName implements Immutable, Serializable, Comparable<QName> {
         return sb.toString();
     }
 
-    /**
-     * Return string representation of revision in format <code>YYYY-mm-dd</code>
-     *
-     * <p>
-     * YANG Specification defines format for <code>revision</code> as
-     * YYYY-mm-dd. This format for revision is reused accross multiple places
-     * such as capabilities URI, YANG modules, etc.
-     *
-     * @return String representation of revision or null, if revision is not
-     *         set.
-     */
-    public String getFormattedRevision() {
-        return module.getFormattedRevision();
-    }
-
     /**
      * Creates copy of this with revision and prefix unset.
      *
index 31a4b85212ea434cef116b2c8453aa837b8e6c5f..886d8eedd82eee09dc8e17fa85d4c6159238d7f9 100644 (file)
@@ -77,10 +77,6 @@ public final class QNameModule implements Immutable, Serializable {
         return new QNameModule(namespace, revision);
     }
 
-    public String getFormattedRevision() {
-        return revision == null ? null : revision.toString();
-    }
-
     /**
      * Returns the namespace of the module which is specified as argument of
      * YANG Module <b><font color="#00FF00">namespace</font></b> keyword.