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
ConstructorsConstructorDescriptionCreates 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 booleanfinal inthashCode()Returns a hashcode for thisPath.Element.final booleanisRoot()Returnstrueif thisPath.Elementis a root element, which is true when thequalified()method returnsnulland thename()method returns an emptyString.final Stringname()Returns the name of thisPath.Element.static final <T> Path.Element<T>Returns aPath.Elementrepresenting the supplied arguments.static final <T> Path.Element<T>of(Qualifiers<? extends String, ?> qualifiers, T qualified, String name) Returns aPath.Elementrepresenting the supplied arguments.static final <T> Path.Element<T>Returns aPath.Elementrepresenting the supplied arguments.final TReturns the thing that thisPath.Elementdescribes (which may be nothing).final Qualifiers<String,Object> Returns theQualifiersthat qualifies thisPath.Element.static final Path.Element<?>root()Returns aPath.Elementthat is a root element.final StringtoString()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 benullor empty- Throws:
NullPointerException- ifnameisnullIllegalArgumentException- ifnameis empty- See Also:
-
Element
Creates a newPath.Element.- Parameters:
qualified- the thing thisPath.Elementdescribes; may benullname- the name of thisPath.Element; may benullonly ifqualifiedis notnull- Throws:
NullPointerException- ifqualifiedisnullandnameisnullIllegalArgumentException- ifqualifiedisnullandnameis empty- See Also:
-
Element
Creates a newPath.Element.- Parameters:
qualifiers- the qualifiers qualifying thisPath.Element; may benullin which case an emptyQualifierswill be used insteadname- the name of thisPath.Element; may benullonly ifqualifiedis notnull- Throws:
NullPointerException- ifnameisnullIllegalArgumentException- ifnameis empty- See Also:
-
Element
Creates a newPath.Element.- Parameters:
qualifiers- the qualifiers qualifying thisPath.Element; may benullin which case an emptyQualifierswill be used insteadqualified- the thing thisPath.Elementdescribes; may benullname- the name of thisPath.Element; may benullonly ifqualifiedis notnull- Throws:
NullPointerException- ifqualifiedisnullandnameisnullIllegalArgumentException- ifqualifiedisnullandnameis empty
-
-
Method Details
-
describeConstable
- Specified by:
describeConstablein interfaceConstable- Specified by:
describeConstablein interfaceQualified<String,Object, T> - Returns:
- an
Optionalcontaining aConstantDescrepresenting 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 theQualifiersthat qualifies thisPath.Element.- Specified by:
qualifiersin interfaceQualified<String,Object, T> - Returns:
- the
Qualifiersthat 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.Elementdescribes (which may be nothing).- Specified by:
qualifiedin interfaceQualified<String,Object, T> - Returns:
- the thing that this
Path.Elementdescribes, which may be nothing, in which casenullwill 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
Returnstrueif thisPath.Elementis a root element, which is true when thequalified()method returnsnulland thename()method returns an emptyString.- Returns:
trueif and only if thisPath.Elementis 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 benullor empty in which casethiswill 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:
hashCodein 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:
equalsin classObject- Parameters:
other- theObjectto test; may benullin which casefalsewill be returned- Returns:
trueif the suppliedObjectis equal to thisPath.Element;falseotherwise- Idempotency:
- This method is idempotent and deterministic.
- Thread Safety:
- This method is safe for concurrent use by multiple threads.
-
toString
Returns a non-nullStringrepresentation of thisPath.Element.The format of the
Stringthat is returned is deliberately unspecified and subject to change without notice from version to version of this class.- Overrides:
toStringin classObject- Returns:
- a
Stringrepresentation 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.Elementthat is a root element.- Returns:
- a
Path.Elementthat 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.Elementrepresenting the supplied arguments.The returned
Path.Elementmay 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- theQualifiersqualifying thisPath.Element; may benullin which case an emptyQualifierswill be used insteadqualified- the thing thisPath.Elementdescribes; may benullname- the name of thisPath.Element; may benullonly ifqualifiedis notnull- Returns:
- a
Path.Elementrepresenting the supplied arguments - Throws:
NullPointerException- ifqualifiedisnullandnameisnullIllegalArgumentException- ifqualifiedisnullandnameis 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.Elementrepresenting the supplied arguments.The returned
Path.Elementmay 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.Elementdescribes; may benullname- the name of thisPath.Element; may benullonly ifqualifiedis notnull- Returns:
- a
Path.Elementrepresenting the supplied arguments - Throws:
NullPointerException- ifqualifiedisnullandnameisnullIllegalArgumentException- ifqualifiedisnullandnameis 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.Elementrepresenting the supplied arguments.The returned
Path.Elementmay 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 benullonly ifqualifiedis notnull- Returns:
- a
Path.Elementrepresenting the supplied arguments - Throws:
NullPointerException- ifqualifiedisnullandnameisnullIllegalArgumentException- ifqualifiedisnullandnameis 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.
-