java.lang.Object
org.microbean.path.Path.Element<T>
- Type Parameters:
T
- the type of thisPath.Element
An element normally within a
Path
, consisting of a Qualifiers
, a
name, and an optional thing that it designates or points to.- Author:
- Laird Nelson
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.microbean.qualifier.Qualified
Qualified.Record<K extends Comparable<? super K>,
V extends Object, T extends Object> -
Constructor Summary
ConstructorDescriptionCreates a newPath.Element
.Element
(Qualifiers<? extends String, ?> qualifiers, String name) Creates a newPath.Element
.Element
(Qualifiers<? extends String, ?> qualifiers, T qualified, String name) Creates a newPath.Element
.Creates a newPath.Element
. -
Method Summary
Modifier and TypeMethodDescriptionfinal Optional<? extends ConstantDesc>
final boolean
final int
hashCode()
Returns a hashcode for thisPath.Element
.final boolean
isRoot()
Returnstrue
if thisPath.Element
is a root element, which is true when thequalified()
method returnsnull
and thename()
method returns an emptyString
.final String
name()
Returns the name of thisPath.Element
.static final <T> Path.Element<T>
Returns aPath.Element
representing the supplied arguments.static final <T> Path.Element<T>
of
(Qualifiers<? extends String, ?> qualifiers, T qualified, String name) Returns aPath.Element
representing the supplied arguments.static final <T> Path.Element<T>
Returns aPath.Element
representing the supplied arguments.final T
Returns the thing that thisPath.Element
describes (which may be nothing).final Qualifiers<String,
Object> Returns theQualifiers
that qualifies thisPath.Element
.static final Path.Element<?>
root()
Returns aPath.Element
that is a root element.final String
toString()
final Path.Element<T>
withQualifiersPrefix
(String prefix) Returns aPath.Element
, usually newly created, whose qualifiers have keys that are prefixed with the suppliedprefix
.
-
Constructor Details
-
Element
Creates a newPath.Element
.- Parameters:
name
- the name of thisPath.Element
; must not benull
or empty- Throws:
NullPointerException
- ifname
isnull
IllegalArgumentException
- ifname
is empty- See Also:
-
Element
Creates a newPath.Element
.- Parameters:
qualified
- the thing thisPath.Element
describes; may benull
name
- the name of thisPath.Element
; may benull
only ifqualified
is notnull
- Throws:
NullPointerException
- ifqualified
isnull
andname
isnull
IllegalArgumentException
- ifqualified
isnull
andname
is empty- See Also:
-
Element
Creates a newPath.Element
.- Parameters:
qualifiers
- the qualifiers qualifying thisPath.Element
; may benull
in which case an emptyQualifiers
will be used insteadname
- the name of thisPath.Element
; may benull
only ifqualified
is notnull
- Throws:
NullPointerException
- ifname
isnull
IllegalArgumentException
- ifname
is empty- See Also:
-
Element
Creates a newPath.Element
.- Parameters:
qualifiers
- the qualifiers qualifying thisPath.Element
; may benull
in which case an emptyQualifiers
will be used insteadqualified
- the thing thisPath.Element
describes; may benull
name
- the name of thisPath.Element
; may benull
only ifqualified
is notnull
- Throws:
NullPointerException
- ifqualified
isnull
andname
isnull
IllegalArgumentException
- ifqualified
isnull
andname
is empty
-
-
Method Details
-
describeConstable
- Specified by:
describeConstable
in interfaceConstable
- Specified by:
describeConstable
in interfaceQualified<String,
Object, T> - Returns:
- an
Optional
containing aConstantDesc
representing thisPath.Element
; nevernull
; possibly empty - Idempotency:
- This method is idempotent and deterministic.
- Nullability:
- This method never returns
null
. - Thread Safety:
- This method is safe for concurrent use by multiple threads.
-
qualifiers
Returns theQualifiers
that qualifies thisPath.Element
.- Specified by:
qualifiers
in interfaceQualified<String,
Object, T> - Returns:
- the
Qualifiers
that qualifies thisPath.Element
- Idempotency:
- This method is idempotent and deterministic.
- Nullability:
- This method never returns
null
. - Thread Safety:
- This method is safe for concurrent use by multiple threads.
-
qualified
Returns the thing that thisPath.Element
describes (which may be nothing).- Specified by:
qualified
in interfaceQualified<String,
Object, T> - Returns:
- the thing that this
Path.Element
describes, which may be nothing, in which casenull
will be returned - Idempotency:
- This method is idempotent and deterministic.
- Nullability:
- This method may return
null
. - Thread Safety:
- This method is safe for concurrent use by multiple threads.
-
name
Returns the name of thisPath.Element
.- Returns:
- the name of this
Path.Element
- Idempotency:
- This method is idempotent and deterministic.
- Nullability:
- This method never returns
null
. - Thread Safety:
- This method is safe for concurrent use by multiple threads.
-
isRoot
Returnstrue
if thisPath.Element
is a root element, which is true when thequalified()
method returnsnull
and thename()
method returns an emptyString
.- Returns:
true
if and only if thisPath.Element
is a root element- Idempotency:
- This method is idempotent and deterministic.
- Thread Safety:
- This method is safe for concurrent use by multiple threads.
-
withQualifiersPrefix
Returns aPath.Element
, usually newly created, whose qualifiers have keys that are prefixed with the suppliedprefix
.- Parameters:
prefix
- the prefix to apply; may benull
or empty in which casethis
will be returned- Returns:
- a
Path.Element
, usually newly created, whose qualifiers have keys that are prefixed with the suppliedprefix
- Idempotency:
- This method is idempotent and deterministic.
- Nullability:
- This method never returns
null
. - Thread Safety:
- This method is safe for concurrent use by multiple threads.
-
hashCode
Returns a hashcode for thisPath.Element
.- Overrides:
hashCode
in classObject
- Returns:
- a hashcode for this
Path.Element
- Idempotency:
- This method is idempotent.
- Thread Safety:
- This method is safe for concurrent use by multiple threads.
-
equals
- Overrides:
equals
in classObject
- Parameters:
other
- theObject
to test; may benull
in which casefalse
will be returned- Returns:
true
if the suppliedObject
is equal to thisPath.Element
;false
otherwise- Idempotency:
- This method is idempotent and deterministic.
- Thread Safety:
- This method is safe for concurrent use by multiple threads.
-
toString
Returns a non-null
String
representation of thisPath.Element
.The format of the
String
that is returned is deliberately unspecified and subject to change without notice from version to version of this class.- Overrides:
toString
in classObject
- Returns:
- a
String
representation of thisPath.Element
- Idempotency:
- This method is idempotent and deterministic.
- Nullability:
- This method never returns
null
- Thread Safety:
- This method is safe for concurrent use by multiple threads.
-
root
Returns aPath.Element
that is a root element.- Returns:
- a
Path.Element
that is a root element - Idempotency:
- This method is idempotent and deterministic.
- Nullability:
- This method never returns
null
. - Thread Safety:
- This method is safe for concurrent use by multiple threads.
-
of
public static final <T> Path.Element<T> of(Qualifiers<? extends String, ?> qualifiers, T qualified, String name) Returns aPath.Element
representing the supplied arguments.The returned
Path.Element
may be newly created or it may be cached. No assumption must be made about its identity.- Type Parameters:
T
- the type of thisPath.Element
- Parameters:
qualifiers
- theQualifiers
qualifying thisPath.Element
; may benull
in which case an emptyQualifiers
will be used insteadqualified
- the thing thisPath.Element
describes; may benull
name
- the name of thisPath.Element
; may benull
only ifqualified
is notnull
- Returns:
- a
Path.Element
representing the supplied arguments - Throws:
NullPointerException
- ifqualified
isnull
andname
isnull
IllegalArgumentException
- ifqualified
isnull
andname
is empty- Idempotency:
- This method is idempotent and deterministic.
- Nullability:
- This method never returns
null
. - Thread Safety:
- This method is safe for concurrent use by multiple threads.
-
of
Returns aPath.Element
representing the supplied arguments.The returned
Path.Element
may be newly created or it may be cached. No assumption must be made about its identity.- Type Parameters:
T
- the type of thisPath.Element
- Parameters:
qualified
- the thing thisPath.Element
describes; may benull
name
- the name of thisPath.Element
; may benull
only ifqualified
is notnull
- Returns:
- a
Path.Element
representing the supplied arguments - Throws:
NullPointerException
- ifqualified
isnull
andname
isnull
IllegalArgumentException
- ifqualified
isnull
andname
is empty- Idempotency:
- This method is idempotent and deterministic.
- Nullability:
- This method never returns
null
. - Thread Safety:
- This method is safe for concurrent use by multiple threads.
-
of
Returns aPath.Element
representing the supplied arguments.The returned
Path.Element
may be newly created or it may be cached. No assumption must be made about its identity.- Type Parameters:
T
- the type of thisPath.Element
- Parameters:
name
- the name of thisPath.Element
; may benull
only ifqualified
is notnull
- Returns:
- a
Path.Element
representing the supplied arguments - Throws:
NullPointerException
- ifqualified
isnull
andname
isnull
IllegalArgumentException
- ifqualified
isnull
andname
is empty- Idempotency:
- This method is idempotent and deterministic.
- Nullability:
- This method never returns
null
. - Thread Safety:
- This method is safe for concurrent use by multiple threads.
-