|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.mmm.util.component.base.AbstractComponent
net.sf.mmm.util.component.base.AbstractLoggableComponent
net.sf.mmm.util.value.base.AbstractSimpleValueConverter<CharSequence,File>
net.sf.mmm.util.value.impl.ValueConverterToFile
@Singleton @Named public class ValueConverterToFile
This is an implementation of the
ValueConverter
interface that converts an
Object
to a Number
. It supports objects given as
CharSequence
(e.g. String
) or Number
.
Field Summary | |
---|---|
private FileUtil |
fileUtil
|
Constructor Summary | |
---|---|
ValueConverterToFile()
The constructor. |
Method Summary | |
---|---|
File |
convert(CharSequence value,
Object valueSource,
Class<? extends File> targetClass)
This method converts the given pojo to the
<TARGET>-type. |
protected void |
doInitialize()
This method performs the actual initialization . |
protected FileUtil |
getFileUtil()
This method gets the FileUtil to use. |
Class<CharSequence> |
getSourceType()
This the type of the value accepted by this converter. |
Class<File> |
getTargetType()
Is the guaranteed return-type of the conversion . |
void |
setFileUtil(FileUtil fileUtil)
This method set the FileUtil to use. |
Methods inherited from class net.sf.mmm.util.value.base.AbstractSimpleValueConverter |
---|
convert |
Methods inherited from class net.sf.mmm.util.component.base.AbstractLoggableComponent |
---|
getLogger, setLogger |
Methods inherited from class net.sf.mmm.util.component.base.AbstractComponent |
---|
doInitialized, getInitializationState, initialize |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private FileUtil fileUtil
getFileUtil()
Constructor Detail |
---|
public ValueConverterToFile()
Method Detail |
---|
protected FileUtil getFileUtil()
FileUtil
to use.
FileUtil
instance.@Inject public void setFileUtil(FileUtil fileUtil)
FileUtil
to use.
fileUtil
- is the FileUtil
instance.protected void doInitialize()
initialization
. It is
called when AbstractComponent.initialize()
is invoked for the first time.super.AbstractComponent.doInitialize()
.
doInitialize
in class AbstractLoggableComponent
public Class<CharSequence> getSourceType()
Object
if you want to accept any value. A very common source-type
is String
.
public Class<File> getTargetType()
conversion
. 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 File convert(CharSequence value, Object valueSource, Class<? extends File> targetClass)
pojo
to the
<TARGET>-type.
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)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |