@Typed(value=Settings.class) public class Settings extends Source
Please see the overview for necessary context.
The bulk of the methods that belong to the Settings
class can be placed into two categories:
get(String, Set, Converter, BiFunction)
method and its convenience forms, such as, simply, get(String)
, acquire values from Source
s, resolve ambiguities,
perform type conversion and
so on.configure(Object, Iterable, String, Set)
method and its convenience forms, such as, simply, configure(Object)
, fully configure Java Beans by using the value
acquisition methods above in conjunction with PropertyDescriptor
features from the Java Beans
specification.Modifier and Type | Field and Description |
---|---|
static BiFunction<? super String,? super Set<? extends Annotation>,? extends String> |
EMPTY
A convenient
BiFunction suitable for use as a default
value function normally provided to the get(String, Set,
Type, BiFunction) method and its ilk that returns an empty
String when invoked. |
static BiFunction<? super String,? super Set<? extends Annotation>,? extends String> |
NULL
A convenient
BiFunction suitable for use as a default
value function normally provided to the get(String, Set,
Type, BiFunction) method and its ilk that returns null
when invoked. |
Constructor and Description |
---|
Settings()
Creates a new
Settings . |
Settings(BiFunction<? super String,? super Set<Annotation>,? extends Set<? extends Source>> sourcesFunction,
ConverterProvider converterProvider,
Iterable<? extends Arbiter> arbiters)
Creates a new
Settings . |
Settings(Set<Annotation> qualifiers,
BiFunction<? super String,? super Set<Annotation>,? extends Set<? extends Source>> sourcesFunction,
ConverterProvider converterProvider,
Iterable<? extends Arbiter> arbiters)
Creates a new
Settings . |
Modifier and Type | Method and Description |
---|---|
protected Value |
arbitrate(Set<? extends Source> sources,
String name,
Set<Annotation> qualifiers,
Collection<? extends Value> values)
Performs value arbitration on a
Collection of
Value s that this Settings instance determined
were indistinguishable during value acquisition, and returns the
Value to be used instead (normally drawn from the Collection according to some heuristic). |
void |
configure(Object object)
Configures the supplied Java Bean by acquiring setting values named after
the supplied
PropertyDescriptor s and using their
affiliated write
methods to set the corresponding values. |
void |
configure(Object object,
BeanInfo beanInfo)
Configures the supplied Java Bean by acquiring setting values named after
the supplied
PropertyDescriptor s and using their
affiliated write
methods to set the corresponding values. |
void |
configure(Object object,
BeanInfo beanInfo,
Set<Annotation> qualifiers)
Configures the supplied Java Bean by acquiring setting values named after
the supplied
PropertyDescriptor s and using their
affiliated write
methods to set the corresponding values. |
void |
configure(Object object,
BeanInfo beanInfo,
String prefix)
Configures the supplied Java Bean by acquiring setting values named after
the supplied
PropertyDescriptor s and using their
affiliated write
methods to set the corresponding values. |
void |
configure(Object object,
BeanInfo beanInfo,
String prefix,
Set<Annotation> qualifiers)
Configures the supplied Java Bean by acquiring setting values named after
the supplied
PropertyDescriptor s and using their
affiliated write
methods to set the corresponding values. |
void |
configure(Object object,
Iterable<? extends PropertyDescriptor> propertyDescriptors)
Configures the supplied Java Bean by acquiring setting values named after
the supplied
PropertyDescriptor s and using their
affiliated write
methods to set the corresponding values. |
void |
configure(Object object,
Iterable<? extends PropertyDescriptor> propertyDescriptors,
String prefix)
Configures the supplied Java Bean by acquiring setting values named after
the supplied
PropertyDescriptor s and using their
affiliated write
methods to set the corresponding values. |
void |
configure(Object object,
Iterable<? extends PropertyDescriptor> propertyDescriptors,
String prefix,
Set<Annotation> qualifiers)
Configures the supplied Java Bean by acquiring setting values named after
the supplied
PropertyDescriptor s and using their
affiliated write
methods to set the corresponding values. |
void |
configure(Object object,
Set<Annotation> qualifiers)
Configures the supplied Java Bean by acquiring setting values named after
the supplied
PropertyDescriptor s and using their
affiliated write
methods to set the corresponding values. |
void |
configure(Object object,
String prefix)
Configures the supplied Java Bean by acquiring setting values named after
the supplied
PropertyDescriptor s and using their
affiliated write
methods to set the corresponding values. |
void |
configure(Object object,
String prefix,
Set<Annotation> qualifiers)
Configures the supplied Java Bean by acquiring setting values named after
the supplied
PropertyDescriptor s and using their
affiliated write
methods to set the corresponding values. |
String |
get(String name)
|
String |
get(String name,
BiFunction<? super String,? super Set<? extends Annotation>,? extends String> defaultValueFunction)
Returns a suitable
String value for a setting
named by the supplied name and with default value
semantics implemented by the optional supplied defaultValueFunction . |
<T> T |
get(String name,
Class<T> type)
Returns a suitable value for a setting
named by the supplied
name as converted by the Converter
located using
the supplied Class . |
<T> T |
get(String name,
Class<T> type,
BiFunction<? super String,? super Set<? extends Annotation>,? extends String> defaultValueFunction)
Returns a suitable value for a setting
named by the supplied
name as converted by the Converter
located using
the supplied Class , and with default value semantics
implemented by the optional supplied defaultValueFunction . |
<T> T |
get(String name,
Class<T> type,
String defaultValue)
Returns a suitable value for a setting
named by the supplied
name as converted by the Converter
located using
the supplied Class , and with default value semantics
implemented by the optional supplied defaultValueFunction . |
<T> T |
get(String name,
Converter<? extends T> converter)
Returns a suitable value for a setting
named by the supplied
name as converted by the supplied Converter . |
<T> T |
get(String name,
Converter<? extends T> converter,
BiFunction<? super String,? super Set<? extends Annotation>,? extends String> defaultValueFunction)
Returns a suitable value for a setting
named by the supplied
name as converted by the supplied Converter and with default value semantics implemented by the
optional supplied defaultValueFunction . |
String |
get(String name,
Set<Annotation> qualifiers)
Returns a suitable
String value for a setting
named by the supplied name and qualified
with the supplied qualifiers . |
String |
get(String name,
Set<Annotation> qualifiers,
BiFunction<? super String,? super Set<? extends Annotation>,? extends String> defaultValueFunction)
Returns a suitable
String value for a setting
named by the supplied name and qualified
with the supplied qualifiers and with default value
semantics implemented by the optional supplied defaultValueFunction . |
<T> T |
get(String name,
Set<Annotation> qualifiers,
Class<T> type,
BiFunction<? super String,? super Set<? extends Annotation>,? extends String> defaultValueFunction)
Returns a suitable value for a setting
named by the supplied
name and qualified
with the supplied qualifiers , as converted by the Converter
located using
the supplied Class , and with default value semantics
implemented by the optional supplied defaultValueFunction . |
<T> T |
get(String name,
Set<Annotation> qualifiers,
Class<T> type,
String defaultValue)
Returns a suitable value for a setting
named by the supplied
name and qualified
with the supplied qualifiers , as converted by the Converter
located using
the supplied Class , and with default value semantics
implemented by the optional supplied defaultValueFunction . |
<T> T |
get(String name,
Set<Annotation> qualifiers,
Converter<? extends T> converter)
Returns a suitable value for a setting
named by the supplied
name and qualified
with the supplied qualifiers , as converted by the supplied Converter . |
<T> T |
get(String name,
Set<Annotation> qualifiers,
Converter<? extends T> converter,
BiFunction<? super String,? super Set<? extends Annotation>,? extends String> defaultValueFunction)
Returns a suitable value for a setting
named by the supplied
name and qualified
with the supplied qualifiers , as converted by the supplied Converter and with default value semantics implemented by the
optional supplied defaultValueFunction . |
<T> T |
get(String name,
Set<Annotation> qualifiers,
Converter<? extends T> converter,
String defaultValue)
Returns a suitable value for a setting
named by the supplied
name and qualified
with the supplied qualifiers , as converted by the supplied Converter and with default value semantics implemented by the
optional supplied defaultValueFunction . |
String |
get(String name,
Set<Annotation> qualifiers,
String defaultValue)
Returns a suitable
String value for a setting
named by the supplied name and qualified
with the supplied qualifiers and with default value
semantics implemented by the optional supplied defaultValueFunction . |
Object |
get(String name,
Set<Annotation> qualifiers,
Type type)
Returns a suitable value for a setting
named by the supplied
name and qualified
with the supplied qualifiers , as converted by the Converter
located using
the supplied Type . |
Object |
get(String name,
Set<Annotation> qualifiers,
Type type,
BiFunction<? super String,? super Set<? extends Annotation>,? extends String> defaultValueFunction)
Returns a suitable value for a setting
named by the supplied
name and qualified
with the supplied qualifiers , as converted by the Converter
located using
the supplied Type , and with default value semantics
implemented by the optional supplied defaultValueFunction . |
<T> T |
get(String name,
Set<Annotation> qualifiers,
TypeLiteral<T> typeLiteral,
BiFunction<? super String,? super Set<? extends Annotation>,? extends String> defaultValueFunction)
Returns a suitable value for a setting
named by the supplied
name and qualified
with the supplied qualifiers , as converted by the Converter
located
using the supplied TypeLiteral , and with default value
semantics implemented by the optional supplied defaultValueFunction . |
String |
get(String name,
String defaultValue)
Returns a suitable
String value for a setting
named by the supplied name and with default value
semantics implemented by the optional supplied defaultValueFunction . |
Object |
get(String name,
Type type)
Returns a suitable value for a setting
named by the supplied
name as converted by the Converter
located using
the supplied Type . |
Object |
get(String name,
Type type,
BiFunction<? super String,? super Set<? extends Annotation>,? extends String> defaultValueFunction)
Returns a suitable value for a setting
named by the supplied
name as converted by the Converter
located using
the supplied Type , and with default value semantics
implemented by the optional supplied defaultValueFunction . |
<T> T |
get(String name,
TypeLiteral<T> typeLiteral)
Returns a suitable value for a setting
named by the supplied
name as converted by the Converter
located
using the supplied TypeLiteral . |
<T> T |
get(String name,
TypeLiteral<T> typeLiteral,
BiFunction<? super String,? super Set<? extends Annotation>,? extends String> defaultValueFunction)
Returns a suitable value for a setting
named by the supplied
name as converted by the Converter
located
using the supplied TypeLiteral , and with default value
semantics implemented by the optional supplied defaultValueFunction . |
<T> T |
get(String name,
TypeLiteral<T> typeLiteral,
String defaultValue)
Returns a suitable value for a setting
named by the supplied
name as converted by the Converter
located
using the supplied TypeLiteral , and with default value
semantics implemented by the optional supplied defaultValueFunction . |
protected Value |
getValue(Source source,
String name,
Set<Annotation> qualifiers)
Given a
Source , a name of a setting and a (possibly
null ) Set of qualifying Annotation s,
returns a Value for the supplied name originating
from the supplied Source . |
@Experimental Value |
getValue(String name,
Set<Annotation> qualifiers)
Implements the
Source.getValue(String, Set) method so
that this Settings can be conveniently used as a Source from a higher-order Settings . |
protected void |
handleMalformedValues(String name,
Set<Annotation> qualifiers,
Collection<? extends Value> badValues)
Processes a
Collection of Value instances that
were determined to be malformed in some way during the execution
of a get(String, Set, Converter, BiFunction) operation. |
public static final BiFunction<? super String,? super Set<? extends Annotation>,? extends String> NULL
BiFunction
suitable for use as a default
value function normally provided to the get(String, Set,
Type, BiFunction)
method and its ilk that returns null
when invoked.public static final BiFunction<? super String,? super Set<? extends Annotation>,? extends String> EMPTY
BiFunction
suitable for use as a default
value function normally provided to the get(String, Set,
Type, BiFunction)
method and its ilk that returns an empty
String
when invoked.public Settings()
Settings
.
The created instance will use an empty Set
of
qualifiers by default.
The created instance will source its values from System properties and environment variables, in that order.
The created instance will use a new Converters
instance as its underlying source of Converter
instances.
The created instance will use a single SourceOrderArbiter
as its mechanism for value arbitration.
public Settings(BiFunction<? super String,? super Set<Annotation>,? extends Set<? extends Source>> sourcesFunction, ConverterProvider converterProvider, Iterable<? extends Arbiter> arbiters)
Settings
.sourcesFunction
- a BiFunction
that accepts a setting
name and a Set
of qualifier
annotations and returns a Set
of Source
s
appropriate for the request represented by its inputs; may be
null
; may return null
; if non-null
and
this new Settings
will be used concurrently by multiple
threads, then this parameter value must be safe for concurrent
use by multiple threads; any Set
returned by this BiFunction
will be iterated
over by this Settings
instance without any
synchronizationconverterProvider
- a ConverterProvider
; must not be
null
; if this new Settings
will be used
concurrently by multiple threads, then this parameter value must
be safe for concurrent use by multiple threadsarbiters
- an Iterable
of Arbiter
s; may be
null
; if this new Settings
will be used
concurrently by multiple threads, then this parameter value must
be safe for concurrent use by multiple threads and Iterator
s produced by its iterator()
method must also be safe for concurrent iteration by multiple
threadsNullPointerException
- if converterProvider
is
null
Settings(Set, BiFunction, ConverterProvider, Iterable)
public Settings(Set<Annotation> qualifiers, BiFunction<? super String,? super Set<Annotation>,? extends Set<? extends Source>> sourcesFunction, ConverterProvider converterProvider, Iterable<? extends Arbiter> arbiters)
Settings
.qualifiers
- a Set
of annotations that can be used to further qualify the selection of
appropriate values; may be null
; will be iterated over
with no synchronization or locking and shallowly copied by this
constructorsourcesFunction
- a BiFunction
that accepts a setting
name and a Set
of qualifier
annotations and returns a Set
of Source
s
appropriate for the request represented by its inputs; may be
null
; may return null
; if non-null
and
this new Settings
will be used concurrently by multiple
threads, then this parameter value must be safe for concurrent
use by multiple threads; any Set
returned by this BiFunction
will be iterated
over by this Settings
instance without any
synchronizationconverterProvider
- a ConverterProvider
; must not be
null
; if this new Settings
will be used
concurrently by multiple threads, then this parameter value must
be safe for concurrent use by multiple threadsarbiters
- an Iterable
of Arbiter
s; may be
null
; if this new Settings
will be used
concurrently by multiple threads, then this parameter value must
be safe for concurrent use by multiple threads and Iterator
s produced by its iterator()
method must also be safe for concurrent iteration by multiple
threadsNullPointerException
- if converterProvider
is
null
public final String get(String name)
name
- the name of the setting for which a value is to be
returned; must not be null
null
)NullPointerException
- if name
is null
NoSuchElementException
- if no value could be sourcedValueAcquisitionException
- if there was a procedural
problem acquiring a valueArbitrationException
- if there was a problem performing
value arbitrationAmbiguousValuesException
- if arbitration completed but
could not resolve an ambiguity between potential return valuesMalformedValuesException
- if the handleMalformedValues(String, Set, Collection)
method was
overridden and the override throws a MalformedValuesException
ELException
- if there was an error related to
expression language parsing or evaluationConcurrentModificationException
- if the BiFunction
or Iterable
supplied at construction time throws oneget(String, Set, Converter, BiFunction)
null
.public final String get(String name, String defaultValue)
String
value for a setting
named by the supplied name
and with default value
semantics implemented by the optional supplied defaultValueFunction
.name
- the name of the setting for which a value is to be
returned; must not be null
defaultValue
- a String
representation of the
default value to be used in case setting
value acquisition does not yield a value; may be null
null
)NullPointerException
- if name
is null
NoSuchElementException
- if defaultValueFunction
was null
and no value could be sourcedValueAcquisitionException
- if there was a procedural
problem acquiring a valueArbitrationException
- if there was a problem performing
value arbitrationAmbiguousValuesException
- if arbitration completed but
could not resolve an ambiguity between potential return valuesMalformedValuesException
- if the handleMalformedValues(String, Set, Collection)
method was
overridden and the override throws a MalformedValuesException
ELException
- if there was an error related to
expression language parsing or evaluationConcurrentModificationException
- if the BiFunction
or Iterable
supplied at construction time throws oneget(String, Set, Converter, BiFunction)
null
.public final String get(String name, BiFunction<? super String,? super Set<? extends Annotation>,? extends String> defaultValueFunction)
String
value for a setting
named by the supplied name
and with default value
semantics implemented by the optional supplied defaultValueFunction
.name
- the name of the setting for which a value is to be
returned; must not be null
defaultValueFunction
- a BiFunction
accepting a setting
name and a Set
of qualifier Annotation
s that
returns a default String
-typed value when a value could
not sourced; may be null
in which case if no value can be
sourced a NoSuchElementException
will be thrown; may
return null
; must be safe for concurrent use by mulitple
threads; must not call any of this Settings
instance's
methods or undefined behavior will resultnull
)NullPointerException
- if name
is null
NoSuchElementException
- if defaultValueFunction
was null
and no value could be sourcedValueAcquisitionException
- if there was a procedural
problem acquiring a valueArbitrationException
- if there was a problem performing
value arbitrationAmbiguousValuesException
- if arbitration completed but
could not resolve an ambiguity between potential return valuesMalformedValuesException
- if the handleMalformedValues(String, Set, Collection)
method was
overridden and the override throws a MalformedValuesException
ELException
- if there was an error related to
expression language parsing or evaluationConcurrentModificationException
- if the BiFunction
or Iterable
supplied at construction time throws oneget(String, Set, Converter, BiFunction)
null
.public final String get(String name, Set<Annotation> qualifiers)
String
value for a setting
named by the supplied name
and qualified
with the supplied qualifiers
.name
- the name of the setting for which a value is to be
returned; must not be null
qualifiers
- a Set
of Annotation
s to further
qualify the selection of the value to be returned; may be null
; if non-null
then this parameter value must be safe
for concurrent iteration by multiple threadsnull
)NullPointerException
- if name
is null
NoSuchElementException
- if no value could be sourcedValueAcquisitionException
- if there was a procedural
problem acquiring a valueArbitrationException
- if there was a problem performing
value arbitrationAmbiguousValuesException
- if arbitration completed but
could not resolve an ambiguity between potential return valuesMalformedValuesException
- if the handleMalformedValues(String, Set, Collection)
method was
overridden and the override throws a MalformedValuesException
ELException
- if there was an error related to
expression language parsing or evaluationConcurrentModificationException
- if the BiFunction
or Iterable
supplied at construction time throws oneget(String, Set, Converter, BiFunction)
null
.public final String get(String name, Set<Annotation> qualifiers, String defaultValue)
String
value for a setting
named by the supplied name
and qualified
with the supplied qualifiers
and with default value
semantics implemented by the optional supplied defaultValueFunction
.name
- the name of the setting for which a value is to be
returned; must not be null
qualifiers
- a Set
of Annotation
s to further
qualify the selection of the value to be returned; may be null
; if non-null
then this parameter value must be safe
for concurrent iteration by multiple threadsdefaultValue
- a String
representation of the
default value to be used in case setting
value acquisition does not yield a value; may be null
null
)NullPointerException
- if name
is null
NoSuchElementException
- if defaultValueFunction
was null
and no value could be sourcedValueAcquisitionException
- if there was a procedural
problem acquiring a valueArbitrationException
- if there was a problem performing
value arbitrationAmbiguousValuesException
- if arbitration completed but
could not resolve an ambiguity between potential return valuesMalformedValuesException
- if the handleMalformedValues(String, Set, Collection)
method was
overridden and the override throws a MalformedValuesException
ELException
- if there was an error related to
expression language parsing or evaluationConcurrentModificationException
- if the BiFunction
or Iterable
supplied at construction time throws oneget(String, Set, Converter, BiFunction)
null
.public final String get(String name, Set<Annotation> qualifiers, BiFunction<? super String,? super Set<? extends Annotation>,? extends String> defaultValueFunction)
String
value for a setting
named by the supplied name
and qualified
with the supplied qualifiers
and with default value
semantics implemented by the optional supplied defaultValueFunction
.name
- the name of the setting for which a value is to be
returned; must not be null
qualifiers
- a Set
of Annotation
s to further
qualify the selection of the value to be returned; may be null
; if non-null
then this parameter value must be safe
for concurrent iteration by multiple threadsdefaultValueFunction
- a BiFunction
accepting a setting
name and a Set
of qualifier Annotation
s that
returns a default String
-typed value when a value could
not sourced; may be null
in which case if no value can be
sourced a NoSuchElementException
will be thrown; may
return null
; must be safe for concurrent use by mulitple
threads; must not call any of this Settings
instance's
methods or undefined behavior will resultnull
)NullPointerException
- if name
is null
NoSuchElementException
- if defaultValueFunction
was null
and no value could be sourcedValueAcquisitionException
- if there was a procedural
problem acquiring a valueArbitrationException
- if there was a problem performing
value arbitrationAmbiguousValuesException
- if arbitration completed but
could not resolve an ambiguity between potential return valuesMalformedValuesException
- if the handleMalformedValues(String, Set, Collection)
method was
overridden and the override throws a MalformedValuesException
ELException
- if there was an error related to
expression language parsing or evaluationConcurrentModificationException
- if the BiFunction
or Iterable
supplied at construction time throws oneget(String, Set, Converter, BiFunction)
null
.public final <T> T get(String name, Class<T> type)
name
as converted by the Converter
located using
the supplied Class
.T
- the type to which any value should be convertedname
- the name of the setting for which a value is to be
returned; must not be null
type
- a Class
used to locate an appropriate
Converter
; must not be null
null
)NullPointerException
- if either name
or class
is null
IllegalArgumentException
- if conversion could not occur for any
reason; see Converter.convert(Value)
ConversionException
- if conversion could not occur for any
reason other than bad inputsNoSuchElementException
- if no value could be sourcedValueAcquisitionException
- if there was a procedural
problem acquiring a valueArbitrationException
- if there was a problem performing
value arbitrationAmbiguousValuesException
- if arbitration completed but
could not resolve an ambiguity between potential return valuesMalformedValuesException
- if the handleMalformedValues(String, Set, Collection)
method was
overridden and the override throws a MalformedValuesException
ELException
- if there was an error related to
expression language parsing or evaluationConcurrentModificationException
- if the BiFunction
or Iterable
supplied at construction time throws oneget(String, Set, Converter, BiFunction)
null
.public final <T> T get(String name, Class<T> type, String defaultValue)
name
as converted by the Converter
located using
the supplied Class
, and with default value semantics
implemented by the optional supplied defaultValueFunction
.T
- the type to which any value should be convertedname
- the name of the setting for which a value is to be
returned; must not be null
type
- a Class
used to locate an appropriate
Converter
; must not be null
defaultValue
- a String
representation of the
default value to be used in case setting
value acquisition does not yield a value; may be null
null
)NullPointerException
- if either name
or class
is null
IllegalArgumentException
- if conversion could not occur for any
reason; see Converter.convert(Value)
ConversionException
- if conversion could not occur for any
reason other than bad inputsNoSuchElementException
- if defaultValueFunction
was null
and no value could be sourcedValueAcquisitionException
- if there was a procedural
problem acquiring a valueArbitrationException
- if there was a problem performing
value arbitrationAmbiguousValuesException
- if arbitration completed but
could not resolve an ambiguity between potential return valuesMalformedValuesException
- if the handleMalformedValues(String, Set, Collection)
method was
overridden and the override throws a MalformedValuesException
ELException
- if there was an error related to
expression language parsing or evaluationConcurrentModificationException
- if the BiFunction
or Iterable
supplied at construction time throws oneget(String, Set, Converter, BiFunction)
null
.public final <T> T get(String name, Class<T> type, BiFunction<? super String,? super Set<? extends Annotation>,? extends String> defaultValueFunction)
name
as converted by the Converter
located using
the supplied Class
, and with default value semantics
implemented by the optional supplied defaultValueFunction
.T
- the type to which any value should be convertedname
- the name of the setting for which a value is to be
returned; must not be null
type
- a Class
used to locate an appropriate
Converter
; must not be null
defaultValueFunction
- a BiFunction
accepting a setting
name and a Set
of qualifier Annotation
s that
returns a default String
-typed value when a value could
not sourced; may be null
in which case if no value can be
sourced a NoSuchElementException
will be thrown; may
return null
; must be safe for concurrent use by mulitple
threads; must not call any of this Settings
instance's
methods or undefined behavior will resultnull
)NullPointerException
- if either name
or class
is null
IllegalArgumentException
- if conversion could not occur for any
reason; see Converter.convert(Value)
ConversionException
- if conversion could not occur for any
reason other than bad inputsNoSuchElementException
- if defaultValueFunction
was null
and no value could be sourcedValueAcquisitionException
- if there was a procedural
problem acquiring a valueArbitrationException
- if there was a problem performing
value arbitrationAmbiguousValuesException
- if arbitration completed but
could not resolve an ambiguity between potential return valuesMalformedValuesException
- if the handleMalformedValues(String, Set, Collection)
method was
overridden and the override throws a MalformedValuesException
ELException
- if there was an error related to
expression language parsing or evaluationConcurrentModificationException
- if the BiFunction
or Iterable
supplied at construction time throws oneget(String, Set, Converter, BiFunction)
null
.public final <T> T get(String name, Set<Annotation> qualifiers, Class<T> type, String defaultValue)
name
and qualified
with the supplied qualifiers
, as converted by the Converter
located using
the supplied Class
, and with default value semantics
implemented by the optional supplied defaultValueFunction
.T
- the type to which any value should be convertedname
- the name of the setting for which a value is to be
returned; must not be null
qualifiers
- a Set
of Annotation
s to further
qualify the selection of the value to be returned; may be null
; if non-null
then this parameter value must be safe
for concurrent iteration by multiple threadstype
- a Class
used to locate an appropriate
Converter
; must not be null
defaultValue
- a String
representation of the
default value to be used in case setting
value acquisition does not yield a value; may be null
null
)NullPointerException
- if either name
or type
is null
IllegalArgumentException
- if conversion could not occur for any
reason; see Converter.convert(Value)
ConversionException
- if conversion could not occur for any
reason other than bad inputsNoSuchElementException
- if defaultValueFunction
was null
and no value could be sourcedValueAcquisitionException
- if there was a procedural
problem acquiring a valueArbitrationException
- if there was a problem performing
value arbitrationAmbiguousValuesException
- if arbitration completed but
could not resolve an ambiguity between potential return valuesMalformedValuesException
- if the handleMalformedValues(String, Set, Collection)
method was
overridden and the override throws a MalformedValuesException
ELException
- if there was an error related to
expression language parsing or evaluationConcurrentModificationException
- if the BiFunction
or Iterable
supplied at construction time throws oneget(String, Set, Converter, BiFunction)
null
.public final <T> T get(String name, Set<Annotation> qualifiers, Class<T> type, BiFunction<? super String,? super Set<? extends Annotation>,? extends String> defaultValueFunction)
name
and qualified
with the supplied qualifiers
, as converted by the Converter
located using
the supplied Class
, and with default value semantics
implemented by the optional supplied defaultValueFunction
.T
- the type to which any value should be convertedname
- the name of the setting for which a value is to be
returned; must not be null
qualifiers
- a Set
of Annotation
s to further
qualify the selection of the value to be returned; may be null
; if non-null
then this parameter value must be safe
for concurrent iteration by multiple threadstype
- a Class
used to locate an appropriate
Converter
; must not be null
defaultValueFunction
- a BiFunction
accepting a setting
name and a Set
of qualifier Annotation
s that
returns a default String
-typed value when a value could
not sourced; may be null
in which case if no value can be
sourced a NoSuchElementException
will be thrown; may
return null
; must be safe for concurrent use by mulitple
threads; must not call any of this Settings
instance's
methods or undefined behavior will resultnull
)NullPointerException
- if either name
or type
is null
IllegalArgumentException
- if conversion could not occur for any
reason; see Converter.convert(Value)
ConversionException
- if conversion could not occur for any
reason other than bad inputsNoSuchElementException
- if defaultValueFunction
was null
and no value could be sourcedValueAcquisitionException
- if there was a procedural
problem acquiring a valueArbitrationException
- if there was a problem performing
value arbitrationAmbiguousValuesException
- if arbitration completed but
could not resolve an ambiguity between potential return valuesMalformedValuesException
- if the handleMalformedValues(String, Set, Collection)
method was
overridden and the override throws a MalformedValuesException
ELException
- if there was an error related to
expression language parsing or evaluationConcurrentModificationException
- if the BiFunction
or Iterable
supplied at construction time throws oneget(String, Set, Converter, BiFunction)
null
.public final <T> T get(String name, TypeLiteral<T> typeLiteral)
name
as converted by the Converter
located
using the supplied TypeLiteral
.T
- the type to which any value should be convertedname
- the name of the setting for which a value is to be
returned; must not be null
typeLiteral
- a TypeLiteral
used to locate an
appropriate Converter
; must not be null
null
)NullPointerException
- if either name
or typeLiteral
is null
IllegalArgumentException
- if conversion could not occur for any
reason; see Converter.convert(Value)
ConversionException
- if conversion could not occur for any
reason other than bad inputsNoSuchElementException
- if no value could be sourcedValueAcquisitionException
- if there was a procedural
problem acquiring a valueArbitrationException
- if there was a problem performing
value arbitrationAmbiguousValuesException
- if arbitration completed but
could not resolve an ambiguity between potential return valuesMalformedValuesException
- if the handleMalformedValues(String, Set, Collection)
method was
overridden and the override throws a MalformedValuesException
ELException
- if there was an error related to
expression language parsing or evaluationConcurrentModificationException
- if the BiFunction
or Iterable
supplied at construction time throws oneget(String, Set, Converter, BiFunction)
null
.public final <T> T get(String name, TypeLiteral<T> typeLiteral, String defaultValue)
name
as converted by the Converter
located
using the supplied TypeLiteral
, and with default value
semantics implemented by the optional supplied defaultValueFunction
.T
- the type to which any value should be convertedname
- the name of the setting for which a value is to be
returned; must not be null
typeLiteral
- a TypeLiteral
used to locate an
appropriate Converter
; must not be null
defaultValue
- a String
representation of the
default value to be used in case setting
value acquisition does not yield a value; may be null
null
)NullPointerException
- if either name
or typeLiteral
is null
IllegalArgumentException
- if conversion could not occur for any
reason; see Converter.convert(Value)
ConversionException
- if conversion could not occur for any
reason other than bad inputsNoSuchElementException
- if defaultValueFunction
was null
and no value could be sourcedValueAcquisitionException
- if there was a procedural
problem acquiring a valueArbitrationException
- if there was a problem performing
value arbitrationAmbiguousValuesException
- if arbitration completed but
could not resolve an ambiguity between potential return valuesMalformedValuesException
- if the handleMalformedValues(String, Set, Collection)
method was
overridden and the override throws a MalformedValuesException
ELException
- if there was an error related to
expression language parsing or evaluationConcurrentModificationException
- if the BiFunction
or Iterable
supplied at construction time throws oneget(String, Set, Converter, BiFunction)
null
.public final <T> T get(String name, TypeLiteral<T> typeLiteral, BiFunction<? super String,? super Set<? extends Annotation>,? extends String> defaultValueFunction)
name
as converted by the Converter
located
using the supplied TypeLiteral
, and with default value
semantics implemented by the optional supplied defaultValueFunction
.T
- the type to which any value should be convertedname
- the name of the setting for which a value is to be
returned; must not be null
typeLiteral
- a TypeLiteral
used to locate an
appropriate Converter
; must not be null
defaultValueFunction
- a BiFunction
accepting a setting
name and a Set
of qualifier Annotation
s that
returns a default String
-typed value when a value could
not sourced; may be null
in which case if no value can be
sourced a NoSuchElementException
will be thrown; may
return null
; must be safe for concurrent use by mulitple
threads; must not call any of this Settings
instance's
methods or undefined behavior will resultnull
)NullPointerException
- if either name
or typeLiteral
is null
IllegalArgumentException
- if conversion could not occur for any
reason; see Converter.convert(Value)
ConversionException
- if conversion could not occur for any
reason other than bad inputsNoSuchElementException
- if defaultValueFunction
was null
and no value could be sourcedValueAcquisitionException
- if there was a procedural
problem acquiring a valueArbitrationException
- if there was a problem performing
value arbitrationAmbiguousValuesException
- if arbitration completed but
could not resolve an ambiguity between potential return valuesMalformedValuesException
- if the handleMalformedValues(String, Set, Collection)
method was
overridden and the override throws a MalformedValuesException
ELException
- if there was an error related to
expression language parsing or evaluationConcurrentModificationException
- if the BiFunction
or Iterable
supplied at construction time throws oneget(String, Set, Converter, BiFunction)
null
.public final <T> T get(String name, Set<Annotation> qualifiers, TypeLiteral<T> typeLiteral, BiFunction<? super String,? super Set<? extends Annotation>,? extends String> defaultValueFunction)
name
and qualified
with the supplied qualifiers
, as converted by the Converter
located
using the supplied TypeLiteral
, and with default value
semantics implemented by the optional supplied defaultValueFunction
.T
- the type to which any value should be convertedname
- the name of the setting for which a value is to be
returned; must not be null
qualifiers
- a Set
of Annotation
s to further
qualify the selection of the value to be returned; may be null
; if non-null
then this parameter value must be safe
for concurrent iteration by multiple threadstypeLiteral
- a TypeLiteral
used to locate an
appropriate Converter
; must not be null
defaultValueFunction
- a BiFunction
accepting a setting
name and a Set
of qualifier Annotation
s that
returns a default String
-typed value when a value could
not sourced; may be null
in which case if no value can be
sourced a NoSuchElementException
will be thrown; may
return null
; must be safe for concurrent use by mulitple
threads; must not call any of this Settings
instance's
methods or undefined behavior will resultnull
)NullPointerException
- if either name
or typeLiteral
is null
IllegalArgumentException
- if conversion could not occur for any
reason; see Converter.convert(Value)
ConversionException
- if conversion could not occur for any
reason other than bad inputsNoSuchElementException
- if defaultValueFunction
was null
and no value could be sourcedValueAcquisitionException
- if there was a procedural
problem acquiring a valueArbitrationException
- if there was a problem performing
value arbitrationAmbiguousValuesException
- if arbitration completed but
could not resolve an ambiguity between potential return valuesMalformedValuesException
- if the handleMalformedValues(String, Set, Collection)
method was
overridden and the override throws a MalformedValuesException
ELException
- if there was an error related to
expression language parsing or evaluationConcurrentModificationException
- if the BiFunction
or Iterable
supplied at construction time throws oneget(String, Set, Converter, BiFunction)
null
.public final Object get(String name, Type type)
name
as converted by the Converter
located using
the supplied Type
.name
- the name of the setting for which a value is to be
returned; must not be null
type
- a Type
used to locate an appropriate
Converter
; must not be null
null
)NullPointerException
- if either name
or type
is null
IllegalArgumentException
- if conversion could not occur for any
reason; see Converter.convert(Value)
ConversionException
- if conversion could not occur for any
reason other than bad inputsNoSuchElementException
- if no value could be sourcedValueAcquisitionException
- if there was a procedural
problem acquiring a valueArbitrationException
- if there was a problem performing
value arbitrationAmbiguousValuesException
- if arbitration completed but
could not resolve an ambiguity between potential return valuesMalformedValuesException
- if the handleMalformedValues(String, Set, Collection)
method was
overridden and the override throws a MalformedValuesException
ELException
- if there was an error related to
expression language parsing or evaluationConcurrentModificationException
- if the BiFunction
or Iterable
supplied at construction time throws oneget(String, Set, Converter, BiFunction)
null
.public final Object get(String name, Set<Annotation> qualifiers, Type type)
name
and qualified
with the supplied qualifiers
, as converted by the Converter
located using
the supplied Type
.name
- the name of the setting for which a value is to be
returned; must not be null
qualifiers
- a Set
of Annotation
s to further
qualify the selection of the value to be returned; may be null
; if non-null
then this parameter value must be safe
for concurrent iteration by multiple threadstype
- a Type
used to locate an appropriate
Converter
; must not be null
null
)NullPointerException
- if either name
or type
is null
IllegalArgumentException
- if conversion could not occur for any
reason; see Converter.convert(Value)
ConversionException
- if conversion could not occur for any reason
other than bad inputsNoSuchElementException
- if no value could be sourcedValueAcquisitionException
- if there was a procedural
problem acquiring a valueArbitrationException
- if there was a problem performing
value arbitrationAmbiguousValuesException
- if arbitration completed but
could not resolve an ambiguity between potential return valuesMalformedValuesException
- if the handleMalformedValues(String, Set, Collection)
method was
overridden and the override throws a MalformedValuesException
ELException
- if there was an error related to
expression language parsing or evaluationConcurrentModificationException
- if the BiFunction
or Iterable
supplied at construction time throws oneget(String, Set, Converter, BiFunction)
null
.public final Object get(String name, Type type, BiFunction<? super String,? super Set<? extends Annotation>,? extends String> defaultValueFunction)
name
as converted by the Converter
located using
the supplied Type
, and with default value semantics
implemented by the optional supplied defaultValueFunction
.name
- the name of the setting for which a value is to be
returned; must not be null
type
- a Type
used to locate an appropriate
Converter
; must not be null
defaultValueFunction
- a BiFunction
accepting a setting
name and a Set
of qualifier Annotation
s that
returns a default String
-typed value when a value could
not sourced; may be null
in which case if no value can be
sourced a NoSuchElementException
will be thrown; may
return null
; must be safe for concurrent use by mulitple
threads; must not call any of this Settings
instance's
methods or undefined behavior will resultnull
)NullPointerException
- if either name
or type
is null
IllegalArgumentException
- if conversion could not occur for any
reason; see Converter.convert(Value)
ConversionException
- if conversion could not occur for any reason
other than bad inputsNoSuchElementException
- if defaultValueFunction
was null
and no value could be sourcedValueAcquisitionException
- if there was a procedural
problem acquiring a valueArbitrationException
- if there was a problem performing
value arbitrationAmbiguousValuesException
- if arbitration completed but
could not resolve an ambiguity between potential return valuesMalformedValuesException
- if the handleMalformedValues(String, Set, Collection)
method was
overridden and the override throws a MalformedValuesException
ELException
- if there was an error related to
expression language parsing or evaluationConcurrentModificationException
- if the BiFunction
or Iterable
supplied at construction time throws oneget(String, Set, Converter, BiFunction)
null
.public final Object get(String name, Set<Annotation> qualifiers, Type type, BiFunction<? super String,? super Set<? extends Annotation>,? extends String> defaultValueFunction)
name
and qualified
with the supplied qualifiers
, as converted by the Converter
located using
the supplied Type
, and with default value semantics
implemented by the optional supplied defaultValueFunction
.name
- the name of the setting for which a value is to be
returned; must not be null
qualifiers
- a Set
of Annotation
s to further
qualify the selection of the value to be returned; may be null
; if non-null
then this parameter value must be safe
for concurrent iteration by multiple threadstype
- a Type
used to locate an appropriate
Converter
; must not be null
defaultValueFunction
- a BiFunction
accepting a setting
name and a Set
of qualifier Annotation
s that
returns a default String
-typed value when a value could
not sourced; may be null
in which case if no value can be
sourced a NoSuchElementException
will be thrown; may
return null
; must be safe for concurrent use by mulitple
threads; must not call any of this Settings
instance's
methods or undefined behavior will resultnull
)NullPointerException
- if either name
or type
is null
IllegalArgumentException
- if conversion could not occur for any
reason; see Converter.convert(Value)
ConversionException
- if conversion could not occur for any reason
other than bad inputsNoSuchElementException
- if defaultValueFunction
was null
and no value could be sourcedValueAcquisitionException
- if there was a procedural
problem acquiring a valueArbitrationException
- if there was a problem performing
value arbitrationAmbiguousValuesException
- if arbitration completed but
could not resolve an ambiguity between potential return valuesMalformedValuesException
- if the handleMalformedValues(String, Set, Collection)
method was
overridden and the override throws a MalformedValuesException
ELException
- if there was an error related to
expression language parsing or evaluationConcurrentModificationException
- if the BiFunction
or Iterable
supplied at construction time throws oneget(String, Set, Converter, BiFunction)
null
.public final <T> T get(String name, Converter<? extends T> converter)
name
as converted by the supplied Converter
.T
- the type to which any value should be convertedname
- the name of the setting for which a value is to be
returned; must not be null
converter
- a Converter
used to convert a String
value into a
setting
value of the appropriate type; must not be null
; must
either be safe for concurrent use by multiple threads or created
specially for this method invocation or supplied in a context
where it is known that only one thread is executing at a timenull
)NullPointerException
- if either name
or converter
is null
IllegalArgumentException
- if conversion could not occur for any
reason; see Converter.convert(Value)
ConversionException
- if conversion could not occur for any reason
other than bad inputsNoSuchElementException
- if no value could be sourcedValueAcquisitionException
- if there was a procedural
problem acquiring a valueArbitrationException
- if there was a problem performing
value arbitrationAmbiguousValuesException
- if arbitration completed but
could not resolve an ambiguity between potential return valuesMalformedValuesException
- if the handleMalformedValues(String, Set, Collection)
method was
overridden and the override throws a MalformedValuesException
ELException
- if there was an error related to
expression language parsing or evaluationConcurrentModificationException
- if the BiFunction
or Iterable
supplied at construction time throws oneget(String, Set, Converter, BiFunction)
null
.public final <T> T get(String name, Set<Annotation> qualifiers, Converter<? extends T> converter)
name
and qualified
with the supplied qualifiers
, as converted by the supplied Converter
.T
- the type to which any value should be convertedname
- the name of the setting for which a value is to be
returned; must not be null
qualifiers
- a Set
of Annotation
s to further
qualify the selection of the value to be returned; may be null
; if non-null
then this parameter value must be safe
for concurrent iteration by multiple threadsconverter
- a Converter
used to convert a String
value into a
setting
value of the appropriate type; must not be null
; must
either be safe for concurrent use by multiple threads or created
specially for this method invocation or supplied in a context
where it is known that only one thread is executing at a timenull
)NullPointerException
- if either name
or converter
is null
IllegalArgumentException
- if conversion could not occur for any
reason; see Converter.convert(Value)
ConversionException
- if conversion could not occur for any reason
other than bad inputsNoSuchElementException
- if no value could be sourcedValueAcquisitionException
- if there was a procedural
problem acquiring a valueArbitrationException
- if there was a problem performing
value arbitrationAmbiguousValuesException
- if arbitration completed but
could not resolve an ambiguity between potential return valuesMalformedValuesException
- if the handleMalformedValues(String, Set, Collection)
method was
overridden and the override throws a MalformedValuesException
ELException
- if there was an error related to
expression language parsing or evaluationConcurrentModificationException
- if the BiFunction
or Iterable
supplied at construction time throws oneget(String, Set, Converter, BiFunction)
null
.public final <T> T get(String name, Converter<? extends T> converter, BiFunction<? super String,? super Set<? extends Annotation>,? extends String> defaultValueFunction)
name
as converted by the supplied Converter
and with default value semantics implemented by the
optional supplied defaultValueFunction
.T
- the type to which any value should be convertedname
- the name of the setting for which a value is to be
returned; must not be null
converter
- a Converter
used to convert a String
value into a
setting
value of the appropriate type; must not be null
; must
either be safe for concurrent use by multiple threads or created
specially for this method invocation or supplied in a context
where it is known that only one thread is executing at a timedefaultValueFunction
- a BiFunction
accepting a setting
name and a Set
of qualifier Annotation
s that
returns a default String
-typed value when a value could
not sourced; may be null
in which case if no value can be
sourced a NoSuchElementException
will be thrown; may
return null
; must be safe for concurrent use by mulitple
threads; must not call any of this Settings
instance's
methods or undefined behavior will resultnull
)NullPointerException
- if either name
or converter
is null
IllegalArgumentException
- if conversion could not occur for any
reason; see Converter.convert(Value)
ConversionException
- if conversion could not occur for any reason
other than bad inputsNoSuchElementException
- if defaultValueFunction
was null
and no value could be sourcedValueAcquisitionException
- if there was a procedural
problem acquiring a valueArbitrationException
- if there was a problem performing
value arbitrationAmbiguousValuesException
- if arbitration completed but
could not resolve an ambiguity between potential return valuesMalformedValuesException
- if the handleMalformedValues(String, Set, Collection)
method was
overridden and the override throws a MalformedValuesException
ELException
- if there was an error related to
expression language parsing or evaluationConcurrentModificationException
- if the BiFunction
or Iterable
supplied at construction time throws oneget(String, Set, Converter, BiFunction)
null
.public final <T> T get(String name, Set<Annotation> qualifiers, Converter<? extends T> converter, String defaultValue)
name
and qualified
with the supplied qualifiers
, as converted by the supplied Converter
and with default value semantics implemented by the
optional supplied defaultValueFunction
.T
- the type to which any value should be convertedname
- the name of the setting for which a value is to be
returned; must not be null
qualifiers
- a Set
of Annotation
s to further
qualify the selection of the value to be returned; may be null
; if non-null
then this parameter value must be safe
for concurrent iteration by multiple threadsconverter
- a Converter
used to convert a String
value into a
setting
value of the appropriate type; must not be null
; must
either be safe for concurrent use by multiple threads or created
specially for this method invocation or supplied in a context
where it is known that only one thread is executing at a timedefaultValue
- a String
representation of the
default value to be used in case setting
value acquisition does not yield a value; may be null
null
)NullPointerException
- if either name
or converter
is null
IllegalArgumentException
- if conversion could not occur for any
reason; see Converter.convert(Value)
ConversionException
- if conversion could not occur for any reason
other than bad inputsNoSuchElementException
- if defaultValueFunction
was null
and no value could be sourcedValueAcquisitionException
- if there was a procedural
problem acquiring a valueArbitrationException
- if there was a problem performing
value arbitrationAmbiguousValuesException
- if arbitration completed but
could not resolve an ambiguity between potential return valuesMalformedValuesException
- if the handleMalformedValues(String, Set, Collection)
method was
overridden and the override throws a MalformedValuesException
ELException
- if there was an error related to
expression language parsing or evaluationConcurrentModificationException
- if the BiFunction
or Iterable
supplied at construction time throws onenull
.public final <T> T get(String name, Set<Annotation> qualifiers, Converter<? extends T> converter, BiFunction<? super String,? super Set<? extends Annotation>,? extends String> defaultValueFunction)
name
and qualified
with the supplied qualifiers
, as converted by the supplied Converter
and with default value semantics implemented by the
optional supplied defaultValueFunction
.T
- the type to which any value should be convertedname
- the name of the setting for which a value is to be
returned; must not be null
qualifiers
- a Set
of Annotation
s to further
qualify the selection of the value to be returned; may be null
; if non-null
then this parameter value must be safe
for concurrent iteration by multiple threadsconverter
- a Converter
used to convert a String
value into a
setting
value of the appropriate type; must not be null
; must
either be safe for concurrent use by multiple threads or created
specially for this method invocation or supplied in a context
where it is known that only one thread is executing at a timedefaultValueFunction
- a BiFunction
accepting a setting
name and a Set
of qualifier Annotation
s that
returns a default String
-typed value when a value could
not sourced; may be null
in which case if no value can be
sourced a NoSuchElementException
will be thrown; may
return null
; must be safe for concurrent use by mulitple
threads; must not call any of this Settings
instance's
methods or undefined behavior will resultnull
)NullPointerException
- if either name
or converter
is null
IllegalArgumentException
- if conversion could not occur for any
reason; see Converter.convert(Value)
ConversionException
- if conversion could not occur for any reason
other than bad inputsNoSuchElementException
- if defaultValueFunction
was null
and no value could be sourcedValueAcquisitionException
- if there was a procedural
problem acquiring a valueArbitrationException
- if there was a problem performing
value arbitrationAmbiguousValuesException
- if arbitration completed but
could not resolve an ambiguity between potential return valuesMalformedValuesException
- if the handleMalformedValues(String, Set, Collection)
method was
overridden and the override throws a MalformedValuesException
ELException
- if there was an error related to
expression language parsing or evaluationConcurrentModificationException
- if the BiFunction
or Iterable
supplied at construction time throws onenull
.@Experimental public final @Experimental Value getValue(String name, Set<Annotation> qualifiers)
Source.getValue(String, Set)
method so
that this Settings
can be conveniently used as a Source
from a higher-order Settings
.
End users should never need to call this method directly.
getValue
in class Source
name
- the name of the setting for which a value is to be
returned; must not be null
qualifiers
- a Set
of Annotation
s to further
qualify the selection of the value to be returned; may be null
; if non-null
then this parameter value must be safe
for concurrent iteration by multiple threadsValue
, or null
if no Value
could be created or acquiredNullPointerException
- if name
is null
ValueAcquisitionException
- if there was a procedural
problem acquiring a Value
Source.getValue(String, Set)
name
and qualifiers
parameter values may or may not return Value
s
that are identical, equal or
neither.null
.public final void configure(Object object) throws IntrospectionException, ReflectiveOperationException
PropertyDescriptor
s and using their
affiliated write
methods to set the corresponding values.
This implementation calls the configure(Object,
Iterable, String, Set)
method with sensible defaults.
object
- the Object
to configure; must not be null
NullPointerException
- if either object
or beanInfo
is null
IntrospectionException
- if introspection of the
supplied object
failsReflectiveOperationException
- if there was a problem
invoking a write
method; the supplied Object
may, in this case, be left
in an inconsistent stateIllegalArgumentException
- if conversion could not occur for any
reason; see Converter.convert(Value)
; the supplied Object
may, in this case, be left in an inconsistent stateConversionException
- if conversion could not occur for any
reason other than bad inputs; the supplied Object
may, in
this case, be left in an inconsistent stateValueAcquisitionException
- if there was a procedural
problem acquiring a value; the supplied Object
may, in
this case, be left in an inconsistent stateArbitrationException
- if there was a problem performing
value arbitration; the supplied Object
may, in this case,
be left in an inconsistent stateAmbiguousValuesException
- if arbitration completed but
could not resolve an ambiguity between potential return values;
the supplied Object
may, in this case, be left in an
inconsistent stateMalformedValuesException
- if the handleMalformedValues(String, Set, Collection)
method was
overridden and the override throws a MalformedValuesException
; the supplied Object
may, in
this case, be left in an inconsistent stateELException
- if there was an error related to
expression language parsing or evaluation; the supplied Object
may, in this case, be left in an inconsistent stateconfigure(Object, Iterable, String, Set)
public final void configure(Object object, String prefix) throws IntrospectionException, ReflectiveOperationException
PropertyDescriptor
s and using their
affiliated write
methods to set the corresponding values.
This implementation calls the configure(Object,
Iterable, String, Set)
method with sensible defaults.
object
- the Object
to configure; must not be null
prefix
- a String
that will be prepended to each
PropertyDescriptor
name before using the result as
the name of a setting for which a value will be acquired; may be null
NullPointerException
- if either object
or beanInfo
is null
IntrospectionException
- if introspection of the
supplied object
failsReflectiveOperationException
- if there was a problem
invoking a write
method; the supplied Object
may, in this case, be left
in an inconsistent stateIllegalArgumentException
- if conversion could not occur for any
reason; see Converter.convert(Value)
; the supplied Object
may, in this case, be left in an inconsistent stateConversionException
- if conversion could not occur for any
reason other than bad inputs; the supplied Object
may, in
this case, be left in an inconsistent stateValueAcquisitionException
- if there was a procedural
problem acquiring a value; the supplied Object
may, in
this case, be left in an inconsistent stateArbitrationException
- if there was a problem performing
value arbitration; the supplied Object
may, in this case,
be left in an inconsistent stateAmbiguousValuesException
- if arbitration completed but
could not resolve an ambiguity between potential return values;
the supplied Object
may, in this case, be left in an
inconsistent stateMalformedValuesException
- if the handleMalformedValues(String, Set, Collection)
method was
overridden and the override throws a MalformedValuesException
; the supplied Object
may, in
this case, be left in an inconsistent stateELException
- if there was an error related to
expression language parsing or evaluation; the supplied Object
may, in this case, be left in an inconsistent stateconfigure(Object, Iterable, String, Set)
public final void configure(Object object, Set<Annotation> qualifiers) throws IntrospectionException, ReflectiveOperationException
PropertyDescriptor
s and using their
affiliated write
methods to set the corresponding values.
This implementation calls the configure(Object,
Iterable, String, Set)
method with sensible defaults.
object
- the Object
to configure; must not be null
qualifiers
- a Set
of Annotation
s to further
qualify the selection of values; may be null
; if
non-null
then this parameter value must be safe for
concurrent iteration by multiple threadsNullPointerException
- if either object
or beanInfo
is null
IntrospectionException
- if introspection of the
supplied object
failsReflectiveOperationException
- if there was a problem
invoking a write
method; the supplied Object
may, in this case, be left
in an inconsistent stateIllegalArgumentException
- if conversion could not occur for any
reason; see Converter.convert(Value)
; the supplied Object
may, in this case, be left in an inconsistent stateConversionException
- if conversion could not occur for any
reason other than bad inputs; the supplied Object
may, in
this case, be left in an inconsistent stateValueAcquisitionException
- if there was a procedural
problem acquiring a value; the supplied Object
may, in
this case, be left in an inconsistent stateArbitrationException
- if there was a problem performing
value arbitration; the supplied Object
may, in this case,
be left in an inconsistent stateAmbiguousValuesException
- if arbitration completed but
could not resolve an ambiguity between potential return values;
the supplied Object
may, in this case, be left in an
inconsistent stateMalformedValuesException
- if the handleMalformedValues(String, Set, Collection)
method was
overridden and the override throws a MalformedValuesException
; the supplied Object
may, in
this case, be left in an inconsistent stateELException
- if there was an error related to
expression language parsing or evaluation; the supplied Object
may, in this case, be left in an inconsistent stateconfigure(Object, Iterable, String, Set)
public final void configure(Object object, String prefix, Set<Annotation> qualifiers) throws IntrospectionException, ReflectiveOperationException
PropertyDescriptor
s and using their
affiliated write
methods to set the corresponding values.
This implementation calls the configure(Object,
Iterable, String, Set)
method with sensible defaults.
object
- the Object
to configure; must not be null
prefix
- a String
that will be prepended to each
PropertyDescriptor
name before using the result as
the name of a setting for which a value will be acquired; may be null
qualifiers
- a Set
of Annotation
s to further
qualify the selection of values; may be null
; if
non-null
then this parameter value must be safe for
concurrent iteration by multiple threadsNullPointerException
- if either object
or beanInfo
is null
IntrospectionException
- if introspection of the
supplied object
failsReflectiveOperationException
- if there was a problem
invoking a write
method; the supplied Object
may, in this case, be left
in an inconsistent stateIllegalArgumentException
- if conversion could not occur for any
reason; see Converter.convert(Value)
; the supplied Object
may, in this case, be left in an inconsistent stateConversionException
- if conversion could not occur for any
reason other than bad inputs; the supplied Object
may, in
this case, be left in an inconsistent stateValueAcquisitionException
- if there was a procedural
problem acquiring a value; the supplied Object
may, in
this case, be left in an inconsistent stateArbitrationException
- if there was a problem performing
value arbitration; the supplied Object
may, in this case,
be left in an inconsistent stateAmbiguousValuesException
- if arbitration completed but
could not resolve an ambiguity between potential return values;
the supplied Object
may, in this case, be left in an
inconsistent stateMalformedValuesException
- if the handleMalformedValues(String, Set, Collection)
method was
overridden and the override throws a MalformedValuesException
; the supplied Object
may, in
this case, be left in an inconsistent stateELException
- if there was an error related to
expression language parsing or evaluation; the supplied Object
may, in this case, be left in an inconsistent stateconfigure(Object, Iterable, String, Set)
public final void configure(Object object, BeanInfo beanInfo) throws ReflectiveOperationException
PropertyDescriptor
s and using their
affiliated write
methods to set the corresponding values.
This implementation calls the configure(Object,
Iterable, String, Set)
method with sensible defaults.
object
- the Object
to configure; must not be null
beanInfo
- a BeanInfo
providing access to
PropertyDescriptor
s; must not be null
NullPointerException
- if either object
or beanInfo
is null
ReflectiveOperationException
- if there was a problem
invoking a write
method; the supplied Object
may, in this case, be left
in an inconsistent stateIllegalArgumentException
- if conversion could not occur for any
reason; see Converter.convert(Value)
; the supplied Object
may, in this case, be left in an inconsistent stateConversionException
- if conversion could not occur for any
reason other than bad inputs; the supplied Object
may, in
this case, be left in an inconsistent stateValueAcquisitionException
- if there was a procedural
problem acquiring a value; the supplied Object
may, in
this case, be left in an inconsistent stateArbitrationException
- if there was a problem performing
value arbitration; the supplied Object
may, in this case,
be left in an inconsistent stateAmbiguousValuesException
- if arbitration completed but
could not resolve an ambiguity between potential return values;
the supplied Object
may, in this case, be left in an
inconsistent stateMalformedValuesException
- if the handleMalformedValues(String, Set, Collection)
method was
overridden and the override throws a MalformedValuesException
; the supplied Object
may, in
this case, be left in an inconsistent stateELException
- if there was an error related to
expression language parsing or evaluation; the supplied Object
may, in this case, be left in an inconsistent stateconfigure(Object, Iterable, String, Set)
public final void configure(Object object, BeanInfo beanInfo, String prefix) throws ReflectiveOperationException
PropertyDescriptor
s and using their
affiliated write
methods to set the corresponding values.
This implementation calls the configure(Object,
Iterable, String, Set)
method with sensible defaults.
object
- the Object
to configure; must not be null
beanInfo
- a BeanInfo
providing access to
PropertyDescriptor
s; must not be null
prefix
- a String
that will be prepended to each
PropertyDescriptor
name before using the result as
the name of a setting for which a value will be acquired; may be null
NullPointerException
- if either object
or beanInfo
is null
ReflectiveOperationException
- if there was a problem
invoking a write
method; the supplied Object
may, in this case, be left
in an inconsistent stateIllegalArgumentException
- if conversion could not occur for any
reason; see Converter.convert(Value)
; the supplied Object
may, in this case, be left in an inconsistent stateConversionException
- if conversion could not occur for any
reason other than bad inputs; the supplied Object
may, in
this case, be left in an inconsistent stateValueAcquisitionException
- if there was a procedural
problem acquiring a value; the supplied Object
may, in
this case, be left in an inconsistent stateArbitrationException
- if there was a problem performing
value arbitration; the supplied Object
may, in this case,
be left in an inconsistent stateAmbiguousValuesException
- if arbitration completed but
could not resolve an ambiguity between potential return values;
the supplied Object
may, in this case, be left in an
inconsistent stateMalformedValuesException
- if the handleMalformedValues(String, Set, Collection)
method was
overridden and the override throws a MalformedValuesException
; the supplied Object
may, in
this case, be left in an inconsistent stateELException
- if there was an error related to
expression language parsing or evaluation; the supplied Object
may, in this case, be left in an inconsistent stateconfigure(Object, Iterable, String, Set)
public final void configure(Object object, BeanInfo beanInfo, Set<Annotation> qualifiers) throws ReflectiveOperationException
PropertyDescriptor
s and using their
affiliated write
methods to set the corresponding values.
This implementation calls the configure(Object,
Iterable, String, Set)
method with sensible defaults.
object
- the Object
to configure; must not be null
beanInfo
- a BeanInfo
providing access to
PropertyDescriptor
s; must not be null
qualifiers
- a Set
of Annotation
s to further
qualify the selection of values; may be null
; if
non-null
then this parameter value must be safe for
concurrent iteration by multiple threadsNullPointerException
- if either object
or beanInfo
is null
ReflectiveOperationException
- if there was a problem
invoking a write
method; the supplied Object
may, in this case, be left
in an inconsistent stateIllegalArgumentException
- if conversion could not occur for any
reason; see Converter.convert(Value)
; the supplied Object
may, in this case, be left in an inconsistent stateConversionException
- if conversion could not occur for any
reason other than bad inputs; the supplied Object
may, in
this case, be left in an inconsistent stateValueAcquisitionException
- if there was a procedural
problem acquiring a value; the supplied Object
may, in
this case, be left in an inconsistent stateArbitrationException
- if there was a problem performing
value arbitration; the supplied Object
may, in this case,
be left in an inconsistent stateAmbiguousValuesException
- if arbitration completed but
could not resolve an ambiguity between potential return values;
the supplied Object
may, in this case, be left in an
inconsistent stateMalformedValuesException
- if the handleMalformedValues(String, Set, Collection)
method was
overridden and the override throws a MalformedValuesException
; the supplied Object
may, in
this case, be left in an inconsistent stateELException
- if there was an error related to
expression language parsing or evaluation; the supplied Object
may, in this case, be left in an inconsistent stateconfigure(Object, Iterable, String, Set)
public final void configure(Object object, BeanInfo beanInfo, String prefix, Set<Annotation> qualifiers) throws ReflectiveOperationException
PropertyDescriptor
s and using their
affiliated write
methods to set the corresponding values.
This implementation calls the configure(Object,
Iterable, String, Set)
method with sensible defaults.
object
- the Object
to configure; must not be null
beanInfo
- a BeanInfo
providing access to
PropertyDescriptor
s; must not be null
prefix
- a String
that will be prepended to each
PropertyDescriptor
name before using the result as
the name of a setting for which a value will be acquired; may be null
qualifiers
- a Set
of Annotation
s to further
qualify the selection of values; may be null
; if
non-null
then this parameter value must be safe for
concurrent iteration by multiple threadsNullPointerException
- if either object
or beanInfo
is null
ReflectiveOperationException
- if there was a problem
invoking a write
method; the supplied Object
may, in this case, be left
in an inconsistent stateIllegalArgumentException
- if conversion could not occur for any
reason; see Converter.convert(Value)
; the supplied Object
may, in this case, be left in an inconsistent stateConversionException
- if conversion could not occur for any
reason other than bad inputs; the supplied Object
may, in
this case, be left in an inconsistent stateValueAcquisitionException
- if there was a procedural
problem acquiring a value; the supplied Object
may, in
this case, be left in an inconsistent stateArbitrationException
- if there was a problem performing
value arbitration; the supplied Object
may, in this case,
be left in an inconsistent stateAmbiguousValuesException
- if arbitration completed but
could not resolve an ambiguity between potential return values;
the supplied Object
may, in this case, be left in an
inconsistent stateMalformedValuesException
- if the handleMalformedValues(String, Set, Collection)
method was
overridden and the override throws a MalformedValuesException
; the supplied Object
may, in
this case, be left in an inconsistent stateELException
- if there was an error related to
expression language parsing or evaluation; the supplied Object
may, in this case, be left in an inconsistent stateconfigure(Object, Iterable, String, Set)
public final void configure(Object object, Iterable<? extends PropertyDescriptor> propertyDescriptors) throws ReflectiveOperationException
PropertyDescriptor
s and using their
affiliated write
methods to set the corresponding values.
This implementation calls the configure(Object,
Iterable, String, Set)
method with sensible defaults.
object
- the Object
to configure; must not be null
propertyDescriptors
- an Iterable
of PropertyDescriptor
s; must not be null
NullPointerException
- if either object
or propertyDescriptors
is null
ReflectiveOperationException
- if there was a problem
invoking a write
method; the supplied Object
may, in this case, be left
in an inconsistent stateIllegalArgumentException
- if conversion could not occur for any
reason; see Converter.convert(Value)
; the supplied Object
may, in this case, be left in an inconsistent stateConversionException
- if conversion could not occur for any
reason other than bad inputs; the supplied Object
may, in
this case, be left in an inconsistent stateValueAcquisitionException
- if there was a procedural
problem acquiring a value; the supplied Object
may, in
this case, be left in an inconsistent stateArbitrationException
- if there was a problem performing
value arbitration; the supplied Object
may, in this case,
be left in an inconsistent stateAmbiguousValuesException
- if arbitration completed but
could not resolve an ambiguity between potential return values;
the supplied Object
may, in this case, be left in an
inconsistent stateMalformedValuesException
- if the handleMalformedValues(String, Set, Collection)
method was
overridden and the override throws a MalformedValuesException
; the supplied Object
may, in
this case, be left in an inconsistent stateELException
- if there was an error related to
expression language parsing or evaluation; the supplied Object
may, in this case, be left in an inconsistent stateconfigure(Object, Iterable, String, Set)
public final void configure(Object object, Iterable<? extends PropertyDescriptor> propertyDescriptors, String prefix) throws ReflectiveOperationException
PropertyDescriptor
s and using their
affiliated write
methods to set the corresponding values.
This implementation calls the configure(Object,
Iterable, String, Set)
method with sensible defaults.
object
- the Object
to configure; must not be null
propertyDescriptors
- an Iterable
of PropertyDescriptor
s; must not be null
prefix
- a String
that will be prepended to each
PropertyDescriptor
name before using the result as
the name of a setting for which a value will be acquired; may be null
NullPointerException
- if either object
or propertyDescriptors
is null
ReflectiveOperationException
- if there was a problem
invoking a write
method; the supplied Object
may, in this case, be left
in an inconsistent stateIllegalArgumentException
- if conversion could not occur for any
reason; see Converter.convert(Value)
; the supplied Object
may, in this case, be left in an inconsistent stateConversionException
- if conversion could not occur for any
reason other than bad inputs; the supplied Object
may, in
this case, be left in an inconsistent stateValueAcquisitionException
- if there was a procedural
problem acquiring a value; the supplied Object
may, in
this case, be left in an inconsistent stateArbitrationException
- if there was a problem performing
value arbitration; the supplied Object
may, in this case,
be left in an inconsistent stateAmbiguousValuesException
- if arbitration completed but
could not resolve an ambiguity between potential return values;
the supplied Object
may, in this case, be left in an
inconsistent stateMalformedValuesException
- if the handleMalformedValues(String, Set, Collection)
method was
overridden and the override throws a MalformedValuesException
; the supplied Object
may, in
this case, be left in an inconsistent stateELException
- if there was an error related to
expression language parsing or evaluation; the supplied Object
may, in this case, be left in an inconsistent stateconfigure(Object, Iterable, String, Set)
public final void configure(Object object, Iterable<? extends PropertyDescriptor> propertyDescriptors, String prefix, Set<Annotation> qualifiers) throws ReflectiveOperationException
PropertyDescriptor
s and using their
affiliated write
methods to set the corresponding values.
For each PropertyDescriptor
reachable from the
supplied Iterable
:
prefix
(or the empty string if the supplied
prefix
is null
) and the return value of the
FeatureDescriptor.getName()
method.PropertyDescriptor
is interrogated for a write
method. If there is no write method, processing stops.Type
is acquired for the (writable) property in
question by first seeing if it has a propertyType
attribute set to
a Type
or a TypeLiteral
(very uncommon) and then
by using the return value of its PropertyDescriptor.getPropertyType()
method.Converter
is acquired by first synthesizing one
wrapped around the return value of the PropertyDescriptor.createPropertyEditor(Object)
method, if that
method returns a non-null
value, and then by retrieving one normally
otherwise.String
-typed value
of the PropertyDescriptor
's defaultValue
attribute. If
the value of that attribute is null
or not a String
(very common) then no default value will be used.get(String, Set, Converter, BiFunction)
method
is called. If the method throws a NoSuchElementException
, then processing stops.PropertyDescriptor
's write method on the supplied
object
.The net effect is that only writable Java Bean properties for which there is a setting value will be set to that value.
object
- the Object
to configure; must not be null
propertyDescriptors
- an Iterable
of PropertyDescriptor
s; must not be null
prefix
- a String
that will be prepended to each
PropertyDescriptor
name before using the result as
the name of a setting for which a value will be acquired; may be null
qualifiers
- a Set
of Annotation
s to further
qualify the selection of values; may be null
; if
non-null
then this parameter value must be safe for
concurrent iteration by multiple threadsNullPointerException
- if either object
or propertyDescriptors
is null
ReflectiveOperationException
- if there was a problem
invoking a write
method; the supplied Object
may, in this case, be left
in an inconsistent stateIllegalArgumentException
- if conversion could not occur for any
reason; see Converter.convert(Value)
; the supplied Object
may, in this case, be left in an inconsistent stateConversionException
- if conversion could not occur for any
reason other than bad inputs; the supplied Object
may, in
this case, be left in an inconsistent stateValueAcquisitionException
- if there was a procedural
problem acquiring a value; the supplied Object
may, in
this case, be left in an inconsistent stateArbitrationException
- if there was a problem performing
value arbitration; the supplied Object
may, in this case,
be left in an inconsistent stateAmbiguousValuesException
- if arbitration completed but
could not resolve an ambiguity between potential return values;
the supplied Object
may, in this case, be left in an
inconsistent stateMalformedValuesException
- if the handleMalformedValues(String, Set, Collection)
method was
overridden and the override throws a MalformedValuesException
; the supplied Object
may, in
this case, be left in an inconsistent stateELException
- if there was an error related to
expression language parsing or evaluation; the supplied Object
may, in this case, be left in an inconsistent stateprotected Value arbitrate(Set<? extends Source> sources, String name, Set<Annotation> qualifiers, Collection<? extends Value> values)
Collection
of
Value
s that this Settings
instance determined
were indistinguishable during value acquisition, and returns the
Value
to be used instead (normally drawn from the Collection
according to some heuristic).
This implementation iterates
over the Arbiter
instances supplied at construction
time and asks each in turn to perform value arbitration. The first
non-null
value from an Arbiter
is used as the
return value from this method; otherwise null
is
returned.
sources
- the Set
of Source
s in effect
during the current value acquisition operation; must not be
null
; must be unmodifiable; must be safe for
concurrent read-only access by multiple threadsname
- the name of the setting
value being sought; must not be null
qualifiers
- the Set
of qualifier Annotation
s in effect during the current value acquisition
operation; must not be null
; must be unmodifiable; must be safe for
concurrent read-only access by multiple threadsvalues
- the Collection
of Value
s acquired
during the current value acquisition operation that were deemed
to be indistinguishable; must not be null
; must be
unmodifiable; must
be safe for concurrent read-only access by multiple threadsValue
, or null
if arbitration could not select a single
Value
Arbiter
,
Arbiter.arbitrate(Set, String, Set, Collection)
null
.protected Value getValue(Source source, String name, Set<Annotation> qualifiers)
Source
, a name of a setting and a (possibly
null
) Set
of qualifying Annotation
s,
returns a Value
for the supplied name
originating
from the supplied Source
.
The default implementation of this method calls the Source.getValue(String, Set)
method on the supplied Source
, passing the remaining arguments to it, and returns its
result.
source
- the Source
of the Value
to be
returned; must not be null
name
- the name of the setting for which a Value
is
to be returned; must not be null
qualifiers
- an unmodifiable
Set
of qualifying Annotation
s; may
be null
Value
, or null
NullPointerException
- if source
or name
is null
UnsupportedOperationException
- if an override of this
method attempts to modify the qualifiers
parameterValueAcquisitionException
- if there was an exceptional
problem acquiring a Value
, but not in the relatively
common case that an appropriate Value
could not be
locatedSource.getValue(String, Set)
null
.protected void handleMalformedValues(String name, Set<Annotation> qualifiers, Collection<? extends Value> badValues)
Collection
of Value
instances that
were determined to be malformed in some way during the execution
of a get(String, Set, Converter, BiFunction)
operation.
The default implementation of this method does nothing.
Overrides may consider throwing a MalformedValuesException
instead.
Overrides of this method should not call any of this Settings
instance's other methods (especially get(String, Set, Converter, BiFunction)
) as undefined behavior
or infinite loops may result.
Value
instances in the supplied Collection
of
Value
instances will be discarded after this method
completes and are for informational purposes only.
name
- the name of the configuration setting for which a
Value
is being retrieved by an invocation of the get(String, Set, Converter, BiFunction)
method; must not be
null
qualifiers
- an unmodifiable Set
of qualifier Annotation
s
qualifying the value retrieval operation; may be null
badValues
- a non-null
unmodifiable
Collection
of Value
s that have been determined to
be malformed in some wayNullPointerException
- if name
or badValues
is null
UnsupportedOperationException
- if an override attempts
to modify either of the qualifiers
or the badValues
parametersMalformedValuesException
- if processing should abortget(String, Set, Converter, BiFunction)
,
Value
Copyright © 2019–2020, microBean™. All rights reserved.