@Singleton @Named public class ValueConverterToString extends AbstractSimpleValueConverter<Object,String>
| Modifier and Type | Field and Description |
|---|---|
private Iso8601Util |
iso8601Util |
private StringUtil |
stringUtil |
| Constructor and Description |
|---|
ValueConverterToString()
The constructor.
|
| Modifier and Type | Method and Description |
|---|---|
<T extends String> |
convert(Object value,
Object valueSource,
Class<T> targetClass)
This method converts the given
pojo to the <TARGET>-type. |
protected void |
doInitialize()
This method performs the actual
initialization. |
protected Iso8601Util |
getIso8601Util()
This method gets the
Iso8601Util to use. |
Class<Object> |
getSourceType()
This the type of the value accepted by this converter.
|
protected StringUtil |
getStringUtil()
This method gets the
StringUtil to use. |
Class<String> |
getTargetType()
Is the guaranteed return-type of the
conversion. |
void |
setIso8601Util(Iso8601Util iso8601Util)
This method sets the
Iso8601Util to use. |
void |
setStringUtil(StringUtil stringUtil)
This method sets the
StringUtil to use. |
convertcreateLogger, getLoggerdoInitialized, getInitializationState, initializeprivate Iso8601Util iso8601Util
private StringUtil stringUtil
protected Iso8601Util getIso8601Util()
Iso8601Util to use.Iso8601Util instance.@Inject public void setIso8601Util(Iso8601Util iso8601Util)
Iso8601Util to use.iso8601Util - is the Iso8601Util instance.protected StringUtil getStringUtil()
StringUtil to use.StringUtil instance.@Inject public void setStringUtil(StringUtil stringUtil)
StringUtil to use.stringUtil - is the StringUtil instance.protected void doInitialize()
AbstractComponentinitialization. It is called when AbstractComponent.initialize() is
invoked for the first time. super.AbstractComponent.doInitialize().doInitialize in class AbstractLoggableComponentpublic Class<Object> getSourceType()
ValueConverterObject if you want to accept any
value. A very common source-type is String.public Class<String> getTargetType()
ValueConverterconversion. This
information is used externally to choose the most specific ValueConverter that is
appropriate for the conversion. Object as target-type while a specific
converter may have Collection as target-type. Now if an object
(compliant with the source-type) needs to be converted to a
Collection or List, the specific converter is used while for other
objects the generic converter is chosen. target-type is often more general than the actual
returned result. So a ValueConverter that converts
a comma-separated String to an ArrayList will typically declare
List as target-type.public <T extends String> T convert(Object value, Object valueSource, Class<T> targetClass)
ValueConverterpojo to the <TARGET>-type.T - is the generic type of targetClass.value - is the value to convert.valueSource - describes the source of the value. This may be the filename where the value was read
from, an XPath where the value was located in an XML document, etc. It is used in exceptions
thrown if something goes wrong. This will help to find the problem easier.targetClass - is the type to convert the value to.value or null if the conversion is NOT possible. The returned value
has to be an instance of the given targetType.ValueConverter.convert(Object, Object, GenericType)Copyright © 2001–2016 mmm-Team. All rights reserved.