Package com.consol.citrus.util
Interface TypeConverter
-
- All Known Implementing Classes:
DefaultTypeConverter
public interface TypeConverter- Author:
- Christoph Deppisch
-
-
Field Summary
Fields Modifier and Type Field Description static StringAPACHE_CAMELstatic Map<String,TypeConverter>convertersstatic StringDEFAULTstatic StringGROOVYstatic org.slf4j.LoggerLOGLoggerstatic StringRESOURCE_PATHType converter resource lookup pathstatic StringSPRING
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description <T> TconvertIfNecessary(Object target, Class<T> type)Converts target object to required type if necessary.<T> TconvertStringToType(String value, Class<T> type)Converts String value object to given type.static Map<String,TypeConverter>lookup()Resolves all available converters from resource path lookup.static TypeConverterlookupDefault()Lookup default type converter specified by resource path lookup and/or environment settings.static TypeConverterlookupDefault(TypeConverter defaultTypeConverter)Lookup default type converter specified by resource path lookup and/or environment settings.
-
-
-
Field Detail
-
LOG
static final org.slf4j.Logger LOG
Logger
-
RESOURCE_PATH
static final String RESOURCE_PATH
Type converter resource lookup path- See Also:
- Constant Field Values
-
converters
static final Map<String,TypeConverter> converters
-
DEFAULT
static final String DEFAULT
- See Also:
- Constant Field Values
-
SPRING
static final String SPRING
- See Also:
- Constant Field Values
-
APACHE_CAMEL
static final String APACHE_CAMEL
- See Also:
- Constant Field Values
-
GROOVY
static final String GROOVY
- See Also:
- Constant Field Values
-
-
Method Detail
-
lookup
static Map<String,TypeConverter> lookup()
Resolves all available converters from resource path lookup. Scans classpath for converter meta information and instantiates those converters.- Returns:
-
lookupDefault
static TypeConverter lookupDefault()
Lookup default type converter specified by resource path lookup and/or environment settings. In case only a single type converter is loaded via resource path lookup this converter is used regardless of any environment settings. If there are multiple converter implementations on the classpath the environment settings must specify the default. If no converter implementation is given via resource path lookup the default implementation is returned.- Returns:
- type converter to use by default.
-
lookupDefault
static TypeConverter lookupDefault(TypeConverter defaultTypeConverter)
Lookup default type converter specified by resource path lookup and/or environment settings. In case only a single type converter is loaded via resource path lookup this converter is used regardless of any environment settings. If there are multiple converter implementations on the classpath the environment settings must specify the default. If no converter implementation is given via resource path lookup the default implementation is returned.- Parameters:
defaultTypeConverter- the fallback default converter- Returns:
- type converter to use by default.
-
convertIfNecessary
<T> T convertIfNecessary(Object target, Class<T> type)
Converts target object to required type if necessary.- Type Parameters:
T-- Parameters:
target-type-- Returns:
-
-