YangNamespaceContext should not have a default namespace
[yangtools.git] / yang / yang-common / src / main / java / org / opendaylight / yangtools / yang / common / YangNamespaceContext.java
index 584e9ecc70e39ee5f1fec0bb937a8e7f3710087a..9986eb8e786409421f676b109af7ea86beb46f1a 100644 (file)
@@ -8,8 +8,6 @@
 package org.opendaylight.yangtools.yang.common;
 
 import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkState;
-import static java.util.Objects.requireNonNull;
 
 import com.google.common.annotations.Beta;
 import java.io.Serializable;
@@ -23,23 +21,13 @@ import org.opendaylight.yangtools.concepts.Immutable;
  * statements and detailed in <a href="https://tools.ietf.org/html/rfc7950#section-7.1.4">RFC7950 Section 7.1.4</a>.
  *
  * <p>
- * Each namespace context can have a default namespace and a set of prefix/namespace mappings. A namespace can be bound
- * to multiple prefixes at the same time. The default namespace must also have a prefix assigned.
+ * Each namespace context has a set of prefix/namespace mappings. A namespace can be bound to multiple prefixes at the
+ * same time.
  *
  * @author Robert Varga
  */
 @Beta
 public interface YangNamespaceContext extends Immutable, Serializable {
-
-
-
-    /**
-     * Return the default namespace in this context.
-     *
-     * @return Default namespace, if supported.
-     */
-    @NonNull Optional<QNameModule> getDefaultNamespace();
-
     /**
      * Return QNameModule to which a particular prefix is bound.
      *
@@ -59,21 +47,6 @@ public interface YangNamespaceContext extends Immutable, Serializable {
      */
     @NonNull Optional<String> findPrefixForNamespace(QNameModule namespace);
 
-    /**
-     * Create a {@link QName} in the default namespace.
-     *
-     * @param localName QName local name
-     * @return A QName.
-     * @throws NullPointerException if {@code localName} is null
-     * @throws IllegalArgumentException if {@code localName} does not conform to local name requirements
-     * @throws IllegalStateException if this context does not have default namespace
-     */
-    default @NonNull QName createQName(final String localName) {
-        final Optional<QNameModule> namespace = getDefaultNamespace();
-        checkState(namespace.isPresent(), "%s does not have a default namespace", this);
-        return QName.create(namespace.get(), requireNonNull(localName));
-    }
-
     /**
      * Create a {@link QName} by resolving a prefix against currently-bound prefixes and combining it with specified
      * local name.