Class Namespace

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

@Marshalled public 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

    • 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.
      Can be null (returns null).
      Returns:
      The namespace object, or null if the input was null.
    • 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.
      Must not be null.
      Returns:
      The namespace objects.
    • of

      public static Namespace of(String key)
      Create a Namespace from a "name:uri" string pair.
      Parameters:
      key - The key/pair string.
      Must not be null.
      Returns:
      The namespace object.
    • 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().
      Can be null (the namespace has no name).
      uri - The namespace URI. See getUri().
      Can be null (the namespace has no URI).
      Returns:
      The namespace object.
    • getName

      public String getName()
      Returns the namespace name.
      Returns:
      The namespace name, or null if it was not specified.
    • getUri

      public String getUri()
      Returns the namespace URI.
      Returns:
      The namespace URI, or null if it was not specified.
    • toString

      public String toString()
      Overrides:
      toString in class Object