Klasse Namespace

java.lang.Object
org.apache.torque.generator.qname.Namespace

public final class Namespace extends Object
An instance of this class represents a hierarchical namespace. The hierarchy parts are separated by dots. A namespace is in another namespace if it starts with all the components of the the other namespace (it may contain other components afterwards). For example, the namespace "org.apache.torque" is in the namespace "org.apache". Note that the components and their order need to be equal, it does not suffice if a namespace starts with another namespace. For example, the namespace "org.apache.torque" is not in the namespace "org.ap". Instances of this class are immutable. To guard against mutable subclasses, this class is final.
  • Feldübersicht

    Felder
    Modifizierer und Typ
    Feld
    Beschreibung
    static final Namespace
    The root namespace.
    static final char
    The separator between the hierachical parts of a namespace.
  • Konstruktorübersicht

    Konstruktoren
    Konstruktor
    Beschreibung
    Namespace(String namespace)
    Constructs a namespace from its string representation.
    Namespace(List<String> namespaceParts)
    Creates a namespace from a hierarchical List of namespace parts.
    Copy-Contructor.
  • Methodenübersicht

    Modifizierer und Typ
    Methode
    Beschreibung
    boolean
    Returns if this object is equal to another object.
    Returns the parent of the given namespace.
    Returns the parts of the namespace in hierachical order.
    int
    Returns a hash code for this namespace.
    boolean
    Returns whether this namespace is the root namespace.
    boolean
    isVisibleFrom(Namespace otherNamespace)
    Returns if this namespace is visible from another namespace.
    boolean
    isVisibleTo(Namespace otherNamespace)
    Returns if this namespace is visible to another namespace.
    Returns a String representation of this namespace.

    Von Klasse geerbte Methoden java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Felddetails

    • SEPARATOR

      public static final char SEPARATOR
      The separator between the hierachical parts of a namespace.
      Siehe auch:
    • ROOT_NAMESPACE

      public static final Namespace ROOT_NAMESPACE
      The root namespace.
  • Konstruktordetails

    • Namespace

      public Namespace(String namespace)
      Constructs a namespace from its string representation.
      Parameter:
      namespace - teh string representation of the namespace. May not be null, and may not contain colons(:).
      Löst aus:
      NullPointerException - if namespace is null.
      IllegalArgumentException - if namespace contains colons.
    • Namespace

      public Namespace(Namespace toCopy)
      Copy-Contructor.
      Parameter:
      toCopy - the namespace to copy, not null.
      Löst aus:
      NullPointerException - if toCopy is null.
    • Namespace

      public Namespace(List<String> namespaceParts)
      Creates a namespace from a hierarchical List of namespace parts.
      Parameter:
      namespaceParts - the parts of the namespace.
  • Methodendetails

    • getParts

      public List<String> getParts()
      Returns the parts of the namespace in hierachical order. The most significant part, i.e the leftmost side, is returned first.
      Gibt zurück:
      the parts of the namespace, never null. An empty list is returned for the root namespace.
    • getParent

      public Namespace getParent()
      Returns the parent of the given namespace. If this namespace's parent namespace is the root namespace, or this namespace is the root namespace, the root namespace is returned.
      Gibt zurück:
      the parent namespace of the namespace, never null
    • isVisibleTo

      public boolean isVisibleTo(Namespace otherNamespace)
      Returns if this namespace is visible to another namespace. This is true if this namespace is a "child" of the other namespace or equal to the other namespace. Note that for being a child, all the parts of the namespace separated by a dot must be equal. For example, "org.apache.torque" is visible to the namespace quot;org.apache" and "org" but not to "org.ap", as the second parts, "apache" and "ap" are not equal.
      Parameter:
      otherNamespace - the namespace against this namespace should be checked, not null.
      Gibt zurück:
      true if this namespace is visible to the given namespace, false otherwise.
      Löst aus:
      NullPointerException - if otherNamespace is null.
    • isVisibleFrom

      public boolean isVisibleFrom(Namespace otherNamespace)
      Returns if this namespace is visible from another namespace. This is true if the other namespace is a "child" of this namespace. Note that for being a child, all the parts of the namespace separated by a dot must be equal. For example, "org.apache.torque" is visible from the namespace "org.apache.torque.generator", but not from "org.apache"
      Parameter:
      otherNamespace - the namespace against this namespace should be checked, not null.
      Gibt zurück:
      true if this namespace is visible from the other namespace, false otherwise.
      Löst aus:
      NullPointerException - if otherNamespace is null.
    • isRoot

      public boolean isRoot()
      Returns whether this namespace is the root namespace.
      Gibt zurück:
      true if this namespace is the root namespace, false otherwise.
    • equals

      public boolean equals(Object o)
      Returns if this object is equal to another object. This is true if and only if the other object is a namespace, and their string representations are equal.
      Setzt außer Kraft:
      equals in Klasse Object
      Parameter:
      o - the object to check equality.
      Gibt zurück:
      true if the object is equal to this namespace, false otherwise.
      Siehe auch:
    • hashCode

      public int hashCode()
      Returns a hash code for this namespace. The hash code is consistent with equals().
      Setzt außer Kraft:
      hashCode in Klasse Object
      Gibt zurück:
      a hach code for this object.
      Siehe auch:
    • toString

      public String toString()
      Returns a String representation of this namespace.
      Setzt außer Kraft:
      toString in Klasse Object
      Gibt zurück:
      a String representation of this namespace.
      Siehe auch: