Class InterpolatorSpecification
- java.lang.Object
-
- org.apache.commons.configuration2.interpol.InterpolatorSpecification
-
public final class InterpolatorSpecification extends Object
A simple value class defining a
ConfigurationInterpolator.Objects of this class can be used for creating new
ConfigurationInterpolatorinstances; they contain all required properties. It is either possible to set a fully initializedConfigurationInterpolatordirectly which can be used as is. Alternatively, some or all properties of an instance to be newly created can be set. These properties include- a map with
Lookupobjects associated with a specific prefix - a collection with default
Lookupobjects (without a prefix) - a parent
ConfigurationInterpolator - a function used to convert interpolated values into strings
When setting up a configuration it is possible to define the
ConfigurationInterpolatorin terms of this class. The configuration will then either use theConfigurationInterpolatorinstance explicitly defined in theInterpolatorSpecificationinstance or create a new one.Instances are not created directly, but using the nested
Builderclass. They are then immutable.- Since:
- 2.0
- a map with
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classInterpolatorSpecification.BuilderA builder class for creating instances ofInterpolatorSpecification.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Collection<Lookup>getDefaultLookups()Gets a collection with the default lookups.ConfigurationInterpolatorgetInterpolator()Gets theConfigurationInterpolatorinstance to be used directly.ConfigurationInterpolatorgetParentInterpolator()Gets the parentConfigurationInterpolatorobject.Map<String,Lookup>getPrefixLookups()Gets a map with prefix lookups.Function<Object,String>getStringConverter()Gets the function used to convert interpolated values to strings ornullif the default conversion function is to be used.
-
-
-
Method Detail
-
getInterpolator
public ConfigurationInterpolator getInterpolator()
Gets theConfigurationInterpolatorinstance to be used directly.- Returns:
- the
ConfigurationInterpolator(can be null)
-
getParentInterpolator
public ConfigurationInterpolator getParentInterpolator()
Gets the parentConfigurationInterpolatorobject.- Returns:
- the parent
ConfigurationInterpolator(can be null)
-
getPrefixLookups
public Map<String,Lookup> getPrefixLookups()
Gets a map with prefix lookups. The keys of the map are the prefix strings, its values are the correspondingLookupobjects.- Returns:
- the prefix lookups for a new
ConfigurationInterpolatorinstance (never null)
-
getDefaultLookups
public Collection<Lookup> getDefaultLookups()
Gets a collection with the default lookups.- Returns:
- the default lookups for a new
ConfigurationInterpolatorinstance (never null)
-
getStringConverter
public Function<Object,String> getStringConverter()
Gets the function used to convert interpolated values to strings ornullif the default conversion function is to be used.- Returns:
- function used to convert interpolated values to strings or
nullif the default conversion function is to be used
-
-