Class ConfigurationInterpolator.DefaultStringConverter
- java.lang.Object
-
- org.apache.commons.configuration2.interpol.ConfigurationInterpolator.DefaultStringConverter
-
- All Implemented Interfaces:
java.util.function.Function<java.lang.Object,java.lang.String>
- Enclosing class:
- ConfigurationInterpolator
private static final class ConfigurationInterpolator.DefaultStringConverter extends java.lang.Object implements java.util.function.Function<java.lang.Object,java.lang.String>
Class encapsulating the default logic to convert resolved variable values into strings. This class is thread-safe.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static ConfigurationInterpolator.DefaultStringConverter
INSTANCE
Shared instance.
-
Constructor Summary
Constructors Modifier Constructor Description private
DefaultStringConverter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
apply(java.lang.Object obj)
private java.lang.Object
extractSimpleValue(java.lang.Object obj)
Attempt to extract a simple value fromobj
for use in string conversion.private <T> T
nextOrNull(java.util.Iterator<T> it)
Return the next value fromit
ornull
if no values remain.
-
-
-
Field Detail
-
INSTANCE
static final ConfigurationInterpolator.DefaultStringConverter INSTANCE
Shared instance.
-
-
Method Detail
-
apply
public java.lang.String apply(java.lang.Object obj)
- Specified by:
apply
in interfacejava.util.function.Function<java.lang.Object,java.lang.String>
-
extractSimpleValue
private java.lang.Object extractSimpleValue(java.lang.Object obj)
Attempt to extract a simple value fromobj
for use in string conversion. If the input represents a collection of some sort (e.g., an iterable or array), the first item from the collection is returned.- Parameters:
obj
- input object- Returns:
- extracted simple object
-
nextOrNull
private <T> T nextOrNull(java.util.Iterator<T> it)
Return the next value fromit
ornull
if no values remain.- Type Parameters:
T
- iterated type- Parameters:
it
- iterator- Returns:
- next value from
it
ornull
if no values remain
-
-