BUG-865: remove QName(Module).cachedReference()
[yangtools.git] / yang / yang-common / src / main / java / org / opendaylight / yangtools / yang / common / QName.java
index 6a8ebe2042184c912a5ccf811cc2cfbb53f4a64b..97a9aaab1ae16d167c0f532572c298b8af65c86d 100644 (file)
@@ -10,6 +10,7 @@ package org.opendaylight.yangtools.yang.common;
 import static org.opendaylight.yangtools.yang.common.SimpleDateFormatUtil.getRevisionFormat;
 
 import com.google.common.base.Preconditions;
+import com.google.common.base.Strings;
 import com.google.common.collect.Interner;
 import com.google.common.collect.Interners;
 import java.io.Serializable;
@@ -70,19 +71,6 @@ public final class QName implements Immutable, Serializable, Comparable<QName> {
         this.module = module;
     }
 
-    /**
-     * Look up specified QName in the global cache and return a shared reference.
-     *
-     * @param qname QName instance
-     * @return Cached instance, according to {@link org.opendaylight.yangtools.objcache.ObjectCache} policy.
-     *
-     * @deprecated Use {@link #intern()} instead.
-     */
-    @Deprecated
-    public static QName cachedReference(final QName qname) {
-        return qname.intern();
-    }
-
     /**
      * QName Constructor.
      *
@@ -96,12 +84,8 @@ public final class QName implements Immutable, Serializable, Comparable<QName> {
     }
 
     private static String checkLocalName(final String localName) {
-        if (localName == null) {
-            throw new IllegalArgumentException("Parameter 'localName' may not be null.");
-        }
-        if (localName.length() == 0) {
-            throw new IllegalArgumentException("Parameter 'localName' must be a non-empty string.");
-        }
+        Preconditions.checkArgument(localName != null, "Parameter 'localName' may not be null.");
+               Preconditions.checkArgument(!Strings.isNullOrEmpty(localName), "Parameter 'localName' must be a non-empty string.");
 
         for (final char c : ILLEGAL_CHARACTERS) {
             if (localName.indexOf(c) != -1) {