public class Value extends Object implements Supplier<String>
Supplier of Strings and hence an abstraction of a
(definitionally) String-typed setting
value, additionally encompassing the setting
name for which it is applicable and the Source whence
it originated.Settings,
Source,
Source.getValue(String, Set)| Constructor and Description |
|---|
Value(Source source,
String name,
Set<Annotation> qualifiers,
boolean authoritative,
String value)
Creates a new
Value. |
Value(Source source,
String name,
Set<Annotation> qualifiers,
boolean authoritative,
Supplier<? extends String> valueSupplier)
Creates a new
Value. |
Value(Source source,
String name,
Set<Annotation> qualifiers,
String value)
Creates a new
Value. |
Value(Source source,
String name,
Set<Annotation> qualifiers,
Supplier<? extends String> valueSupplier)
Creates a new
Value. |
Value(Value other)
Creates a new
Value. |
Value(Value other,
String value)
Creates a new
Value. |
Value(Value other,
Supplier<? extends String> valueSupplier)
Creates a new
Value. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object other)
|
String |
get()
|
String |
getName()
Returns the name of the
setting for which this is a
Value. |
Set<Annotation> |
getQualifiers()
|
Source |
getSource()
|
int |
hashCode()
|
boolean |
isAuthoritative()
Returns
true if this Value is to be treated as
coming from an authoritative source. |
String |
toString()
|
public Value(Value other)
Value.other - the Value to copy; must not be nullNullPointerException - if other is nullpublic Value(Value other, String value)
Value.other - the Value to copy; must not be nullvalue - the String to be returned by the get() method; may be nullNullPointerException - if other is nullpublic Value(Value other, Supplier<? extends String> valueSupplier)
Value.other - the Value to copy; must not be nullvalueSupplier - a Supplier of Strings whose
Supplier.get() method will be called by this Value's get() method; may be null; if
non-null, must be safe for concurrent access by multiple
threadsNullPointerException - if other is nullpublic Value(Source source, String name, Set<Annotation> qualifiers, String value)
Value.source - the Source that created this Value;
may be null to indicate that the Value was
synthesizedname - the name of the
setting for which this is a Value; must not be nullqualifiers - a Set of Annotations qualifying
this Value; may be null; will be iterated over by
this constructor without any extra synchronization; will be
copied shallowly by this constructor if it is non-nullvalue - the String to be returned by the get() method; may be nullNullPointerException - if name is nullpublic Value(Source source, String name, Set<Annotation> qualifiers, Supplier<? extends String> valueSupplier)
Value.source - the Source that created this Value;
may be null to indicate that the Value was
synthesizedname - the name of the
setting for which this is a Value; must not be nullqualifiers - a Set of Annotations qualifying
this Value; may be null; will be iterated over by
this constructor without any extra synchronization; will be
copied shallowly by this constructor if it is non-nullvalueSupplier - a Supplier of Strings whose
Supplier.get() method will be called by this Value's get() method; may be null; if
non-null, must be safe for concurrent access by multiple
threadsNullPointerException - if name is nullpublic Value(Source source, String name, Set<Annotation> qualifiers, boolean authoritative, String value)
Value.source - the Source that created this Value;
may be null to indicate that the Value was
synthesizedname - the name of the
setting for which this is a Value; must not be nullqualifiers - a Set of Annotations qualifying
this Value; may be null; will be iterated over by
this constructor without any extra synchronization; will be
copied shallowly by this constructor if it is non-nullauthoritative - whether this Value is to be treated
as coming from an authoritative sourcevalue - the String to be returned by the get() method; may be nullNullPointerException - if name is nullpublic Value(Source source, String name, Set<Annotation> qualifiers, boolean authoritative, Supplier<? extends String> valueSupplier)
Value.source - the Source that created this Value;
may be null to indicate that the Value was
synthesizedname - the name of the
setting for which this is a Value; must not be nullqualifiers - a Set of Annotations qualifying
this Value; may be null; will be iterated over by
this constructor without any extra synchronization; will be
copied shallowly by this constructor if it is non-nullauthoritative - whether this Value is to be treated
as coming from an authoritative sourcevalueSupplier - a Supplier of Strings whose
Supplier.get() method will be called by this Value's get() method; may be null; if
non-null, must be safe for concurrent access by multiple
threadsNullPointerException - if name is nullpublic final String get()
get in interface Supplier<String>String representation of this Value,
which may be nullnull.public final boolean isAuthoritative()
true if this Value is to be treated as
coming from an authoritative source.true if this Value is to be treated as
coming from an authoritative source; false otherwisepublic final String getName()
Value.Value; never nullnull.public final Set<Annotation> getQualifiers()
null, unmodifiable Set
of Annotations qualifying
this Valuenull.public int hashCode()
Value based off the return
value of the get() method and nothing else.
Note that because the return value of invocations of a Value's get() method can change over time, in general
Value hashcodes should be treated with great care.
hashCode in class ObjectValueequals(Object)public boolean equals(Object other)
true if the supplied Object is a Value and has a get() method implementation that
returns a value equal to the return value of an invocation of
this Value's get() method.
Note that because the return value of invocations of a Value's get() method can change over time, in general
Value equality comparisons should be treated with great
care.
equals in class Objectother - the Object to compare; may be nulltrue if the supplied Object is a Value and has a get() method implementation that
returns a value equal to the return value of an invocation of
this Value's get() method; false
otherwisehashCode()public String toString()
String representation of this Value as
of the current moment by returning the result of invoking the
get() method.
This method may return null.
toString in class ObjectString representation of this Value as
of the current moment, or nullget()null.Copyright © 2019–2020, microBean™. All rights reserved.