Package org.forgerock.openig.heap
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 (possiblenullparent Name) and a leaf name (nevernull).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-definedgetFullyQualifiedName()andgetScopedName()methods. These methods use the plus (+) character as separator.The Name instances are immutable.
 
- 
- 
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Namechild(String name)Creates a new Name, relative to this Name with the given leaf name.Namedecorated(String decorator)Returns this name with the last segment adapted to include the decorator name.booleanequals(Object o)StringgetFullyQualifiedName()Returns a String representation of this Name that includes the full Name hierarchy.StringgetHierarchicalLeaf()Returns a String representation of this leaf's Name that is compliant with the hierarchical naming, i.e.StringgetHierarchicalName()Returns a String representation of this Name that includes the full Name hierarchy, with each segment name being 'slugged'.StringgetLeaf()Returns the leaf name (cannot benull).NamegetParent()Returns the parent Name (can benull).StringgetScopedName()Returns a String representation of this Name that includes only the first parent and the leaf name.inthashCode()static Nameof(Class<?> type)Builds a new Name for the given type.static Nameof(String... parts)Builds a new Name using the given name parts.StringtoString()Returns the fully qualified name of this Name (format: (parent '+')* leaf). 
 - 
 
- 
- 
Method Detail
- 
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 benull).- Returns:
 - the parent Name (can be 
null). 
 
- 
getLeaf
public String getLeaf()
Returns the leaf name (cannot benull).- 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 '+')* leafExamples:
LocalNameOnlygateway+_Routergateway+_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:
localnameonlygateway._routergateway._router.oauth2resourceserverfilter
- Returns:
 - a String representation of this Name that includes the full Name hierarchy.
 - See Also:
 StringUtil.slug(String)
 
- 
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:
 StringUtil.slug(String)
 
- 
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 '+')? leafExamples:
LocalNameOnlygateway+_Router
- Returns:
 - a String representation of this Name that includes only the first parent and the leaf name.
 
 
- 
toString
public String toString()
Returns the fully qualified name of this Name (format: (parent '+')* leaf).- Overrides:
 toStringin classObject- Returns:
 - the fully qualified name of this Name.
 - See Also:
 getFullyQualifiedName()
 
 - 
 
 -