Class Name

java.lang.Object
org.forgerock.openig.heap.Name

public final class Name extends Object
A Name uniquely identify an object within a hierarchy. It is composed of a (possible null parent Name) and a leaf name (never null).

Consumers of that API are free to do their own Name rendering (they have access to the whole Name's chain with getParent() method) or use the pre-defined getFullyQualifiedName() and getScopedName() methods. These methods use the plus (+) character as separator.

The Name instances are immutable.

  • Method Summary

    Modifier and Type
    Method
    Description
    child(String name)
    Creates a new Name, relative to this Name with the given leaf name.
    decorated(String decorator)
    Returns this name with the last segment adapted to include the decorator name.
    boolean
     
    Returns a String representation of this Name that includes the full Name hierarchy.
    Returns a String representation of this leaf's Name that is compliant with the hierarchical naming, i.e.
    Returns a String representation of this Name that includes the full Name hierarchy, with each segment name being 'slugged'.
    Returns the leaf name (cannot be null).
    Returns the parent Name (can be null).
    Returns a String representation of this Name that includes only the first parent and the leaf name.
    int
     
    static Name
    of(Class<?> type)
    Builds a new Name for the given type.
    static Name
    of(String... parts)
    Builds a new Name using the given name parts.
    Returns the fully qualified name of this Name (format: (parent '+')* leaf).

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Method Details

    • of

      public static Name of(String... parts)
      Builds a new Name using the given name parts. They are ordered in descending order (ancestors first, leaf last)
      Parameters:
      parts - ordered fragments of the name
      Returns:
      a new Name using the given name parts.
    • of

      public static Name of(Class<?> type)
      Builds a new Name for the given type. The generated name will use the given type's short name as leaf and will have no parent.
      Parameters:
      type - typ used to generate a name
      Returns:
      a new Name for the given type
    • getParent

      public Name getParent()
      Returns the parent Name (can be null).
      Returns:
      the parent Name (can be null).
    • getLeaf

      public String getLeaf()
      Returns the leaf name (cannot be null).
      Returns:
      the leaf name.
    • child

      public Name child(String name)
      Creates a new Name, relative to this Name with the given leaf name.
      Parameters:
      name - relative leaf name
      Returns:
      a new Name, relative to this Name.
    • decorated

      public Name decorated(String decorator)
      Returns this name with the last segment adapted to include the decorator name. The last segment is changed to follow this pattern: @decorator[last-segment].
      Parameters:
      decorator - decorator name.
      Returns:
      a new decorated name based on this name
    • getFullyQualifiedName

      public String getFullyQualifiedName()
      Returns a String representation of this Name that includes the full Name hierarchy.

      The following format has to be expected:

           
           (parent '+')* leaf
           
       

      Examples:

      • LocalNameOnly
      • gateway+_Router
      • gateway+_Router+OAuth2ResourceServerFilter
      Returns:
      a String representation of this Name that includes the full Name hierarchy.
    • getHierarchicalName

      public String getHierarchicalName()
      Returns a String representation of this Name that includes the full Name hierarchy, with each segment name being 'slugged'.

      The following format has to be expected:

           
           (parent '.')* slug(leaf)
           
       

      Examples:

      • localnameonly
      • gateway._router
      • gateway._router.oauth2resourceserverfilter
      Returns:
      a String representation of this Name that includes the full Name hierarchy.
      See Also:
    • getHierarchicalLeaf

      public String getHierarchicalLeaf()
      Returns a String representation of this leaf's Name that is compliant with the hierarchical naming, i.e. the value being 'slugged'.
      Returns:
      a String representation of this Name that includes the full Name hierarchy.
      See Also:
    • getScopedName

      public String getScopedName()
      Returns a String representation of this Name that includes only the first parent and the leaf name.

      The following format has to be expected:

           
           (parent '+')? leaf
           
       

      Examples:

      • LocalNameOnly
      • gateway+_Router
      Returns:
      a String representation of this Name that includes only the first parent and the leaf name.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Returns the fully qualified name of this Name (format: (parent '+')* leaf).
      Overrides:
      toString in class Object
      Returns:
      the fully qualified name of this Name.
      See Also: