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. Theses 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.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:
LocalNameOnly/openig/config/config.json+_Router/openig/config/config.json+_Router+/openig/config/routes/openid-connect.json+OAuth2Filter
- Returns:
- a String representation of this Name that includes the full Name hierarchy.
-
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:
LocalNameOnly/openig/config/config.json+_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()
-
-