Class Binding<V,B extends Binding<V,B>>
- Type Parameters:
V
- the type of aBinding
's value and of its attribute valuesB
- the type of the subclass
- All Implemented Interfaces:
Comparable<B>
,Constable
- Direct Known Subclasses:
Qualifier
- Author:
- Laird Nelson
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
Returns anint
representing a comparison of thisBinding
with the suppliedBinding
, by considering the names, values and attributes of bothBinding
s.Optional<? extends ConstantDesc>
Returns anOptional
housing aConstantDesc
describing thisBinding
, if thisBinding
is capable of being represented as a dynamic constant, or an emptyOptional
if not.protected MethodHandleDesc
Returns aMethodHandleDesc
describing the constructor orstatic
method that will be used to create a dynamic constant representing thisBinding
.boolean
int
hashCode()
info()
final String
name()
Returns the name of thisBinding
.toString()
final V
value()
Returns the value of thisBinding
, which may benull
.
-
Constructor Details
-
Binding
protected Binding(String name, V value, Map<? extends String, ?> attributes, Map<? extends String, ?> info) Creates a newBinding
.- Parameters:
name
- the name; must not benull
value
- the value; may benull
attributes
- further describing thisBinding
; may benull
info
- informational attributes further describing thisBinding
that are not considered by itsequals(Object)
implementation; may benull
- See Also:
-
-
Method Details
-
name
Returns the name of thisBinding
.- Returns:
- the name of this
Binding
- 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.
-
value
Returns the value of thisBinding
, which may benull
.- Returns:
- the value of this
Binding
- 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.
-
attributes
Returns an immutableSortedMap
representing any attributes further describing thisBinding
.The attributes are considered by the
equals(Object)
method.- Returns:
- the attributes of this
Binding
- 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.
-
info
Returns an immutableSortedMap
representing any informational-only attributes further describing thisBinding
.The attributes are not considered by the
equals(Object)
method.- Returns:
- the informational attributes of this
Binding
- 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.
-
describeConstable
Returns anOptional
housing aConstantDesc
describing thisBinding
, if thisBinding
is capable of being represented as a dynamic constant, or an emptyOptional
if not.- Specified by:
describeConstable
in interfaceConstable
- Returns:
- an
Optional
housing aConstantDesc
describing thisBinding
, if thisBinding
is capable of being represented as a dynamic constant, or an emptyOptional
if not - See Also:
- 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.
-
describeConstructor
Returns aMethodHandleDesc
describing the constructor orstatic
method that will be used to create a dynamic constant representing thisBinding
.- Returns:
- a
MethodHandleDesc
describing the constructor orstatic
method that will be used to create a dynamic constant representing thisBinding
- Idempotency:
- This method is, and its overrides must be, idempotent and deterministic.
- Nullability:
- This method does not, and its overrides must not, return
null
. - Thread Safety:
- This method is, and its overrides must be, safe for concurrent use by multiple threads.
-
hashCode
Returns a hashcode for thisBinding
that represents its name, value and attributes.A subclass that overrides this method must also override the
equals(Object)
andcompareTo(Binding)
methods accordingly. -
compareTo
Returns anint
representing a comparison of thisBinding
with the suppliedBinding
, by considering the names, values and attributes of bothBinding
s.Any attribute values that are not
Comparable
instances will be compared based on their string representations. It is strongly recommended that attribute values implementComparable
.This method is, and its overrides must be, consistent with equals.
A subclass that overrides this method must also override the
hashCode()
andequals(Object)
methods accordingly.- Specified by:
compareTo
in interfaceComparable<V>
- Parameters:
other
- the otherBinding
; may benull
in which case a negative value will be returned- Returns:
- an
int
representing a comparison of thisBinding
with the suppliedBinding
- See Also:
- Idempotency:
- This method is, and its overrides must be, idempotent and deterministic.
- Thread Safety:
- This method is, and its overrides must be, safe for concurrent use by multiple threads.
-
equals
Returnstrue
if the suppliedObject
is equal to thisBinding
.The supplied
Object
is considered to be equal to thisBinding
if and only if:- Its class is identical to this
Binding
's class, and - Its name is equal to this
Binding
's name, and - Its value is equal to this
Binding
's value, and - Its attributes are equal to this
Binding
's attributes
A subclass that overrides this method must also override the
hashCode()
andcompareTo(Binding)
methods accordingly.- 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 thisBinding
- See Also:
- Idempotency:
- This method is, and its overrides must be, idempotent and deterministic.
- Thread Safety:
- This method is, and its overrides must be, safe for concurrent use by multiple threads.
- Its class is identical to this
-
toString
Returns aString
representation of thisBinding
.The format of the returned
String
is deliberately undefined and may change between versions of this class without prior notice.- Overrides:
toString
in classObject
- Returns:
- a
String
representation of thisBinding
- Idempotency:
- This method is, and its overrides must be, idempotent and deterministic.
- Nullability:
- This method does not, and its overrides must not, return
null
. - Thread Safety:
- This method is, and its overrides must be, safe for concurrent use by multiple threads.
-