Class Namespace

java.lang.Object
org.apache.juneau.xml.Namespace

@Bean(sort=true) public final class Namespace extends Object
Represents a simple namespace mapping between a simple name and URI.

In general, the simple name will be used as the XML prefix mapping unless there are conflicts or prefix re-mappings in the serializer.

See Also:
  • Method Details

    • of

      public static Namespace of(String name, String uri)
      Create a Namespace with the specified name and URI.

      Previously-encountered name/uri pairs return a cached copy.

      Parameters:
      name - The namespace name. See getName().
      uri - The namespace URI. See getUri().
      Returns:
      The namespace object.
    • of

      public static Namespace of(String key)
      Create a Namespace from a "name:uri" string pair.
      Parameters:
      key - The key/pair string.
      Returns:
      The namespace object.
    • create

      public static Namespace create(Object o)
      Converts the specified object into a Namespace object.

      Can be any of following types:

      • A Namespace object
      • A string containing a name/value pair of the form "name:uri".
      Parameters:
      o - The input.
      Returns:
      The namespace object, or null if the input was null or an empty JSON object.
    • createArray

      public static Namespace[] createArray(Object o)
      Converts the specified object into an array of Namespace object.

      Can be any of following types:

      • A Namespace array
      • A comma-delimited string with key/value pairs of the form "name:uri".
      • A Collection containing any of object that can be passed to createArray(Object).
      Parameters:
      o - The input.
      Returns:
      The namespace objects, or null if the input was null or an empty JSON object.
    • getName

      public String getName()
      Returns the namespace name.
      Returns:
      The namespace name.
    • getUri

      public String getUri()
      Returns the namespace URI.
      Returns:
      The namespace URI.
    • toString

      public String toString()
      Overrides:
      toString in class Object