public final class Name extends Object
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.
Modifier and Type | Method and Description |
---|---|
Name |
child(String name)
Creates a new Name, relative to this Name with the given leaf name.
|
Name |
decorated(String decorator)
Returns this name with the last segment adapted to include the decorator name.
|
boolean |
equals(Object o) |
String |
getFullyQualifiedName()
Returns a String representation of this Name that includes the full Name hierarchy.
|
String |
getHierarchicalLeaf()
Returns a String representation of this leaf's Name that is compliant with the hierarchical naming,
i.e.
|
String |
getHierarchicalName()
Returns a String representation of this Name that includes the full Name hierarchy,
with each segment name being 'slugged'.
|
String |
getLeaf()
Returns the leaf name (cannot be
null ). |
Name |
getParent()
Returns the parent Name (can be
null ). |
String |
getScopedName()
Returns a String representation of this Name that includes only the first parent and the leaf name.
|
int |
hashCode() |
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.
|
String |
toString()
Returns the fully qualified name of this Name (format: (parent '+')* leaf).
|
public static Name of(String... parts)
parts
- ordered fragments of the namepublic static Name of(Class<?> type)
type
- typ used to generate a namepublic Name getParent()
null
).null
).public String getLeaf()
null
).public Name child(String name)
name
- relative leaf namepublic Name decorated(String decorator)
decorator
- decorator name.public String getFullyQualifiedName()
The following format has to be expected:
(parent '+')* leaf
Examples:
LocalNameOnly
gateway+_Router
gateway+_Router+OAuth2ResourceServerFilter
public String getHierarchicalName()
The following format has to be expected:
(parent '.')* slug(leaf)
Examples:
localnameonly
gateway._router
gateway._router.oauth2resourceserverfilter
StringUtil.slug(String)
public String getHierarchicalLeaf()
StringUtil.slug(String)
public String getScopedName()
The following format has to be expected:
(parent '+')? leaf
Examples:
LocalNameOnly
gateway+_Router
public String toString()
toString
in class Object
getFullyQualifiedName()
Copyright 2011-2017 ForgeRock AS.