Package org.forgerock.openig.heap
Class Name
java.lang.Object
org.forgerock.openig.heap.Name
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 TypeMethodDescriptionCreates a new Name, relative to this Name with the given leaf name.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'.getLeaf()
Returns the leaf name (cannot benull
).Returns the parent Name (can benull
).Returns a String representation of this Name that includes only the first parent and the leaf name.int
hashCode()
static Name
Builds a new Name for the given type.static Name
Builds a new Name using the given name parts.toString()
Returns the fully qualified name of this Name (format: (parent '+')* leaf).
-
Method Details
-
of
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
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
Returns the parent Name (can benull
).- Returns:
- the parent Name (can be
null
).
-
getLeaf
Returns the leaf name (cannot benull
).- Returns:
- the leaf name.
-
child
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
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
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
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
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
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
-
hashCode
public int hashCode() -
toString
Returns the fully qualified name of this Name (format: (parent '+')* leaf).
-