net.sf.jsefa.common.converter
Class SimpleListConverter

java.lang.Object
  extended by net.sf.jsefa.common.converter.SimpleListConverter
All Implemented Interfaces:
SimpleTypeConverter

public class SimpleListConverter
extends Object
implements SimpleTypeConverter

Converter for List objects.
The format consists of one String representing the delimiter for the list items.

It is thread-safe.

Author:
Norman Lahme-Huetig

Constructor Summary
protected SimpleListConverter(SimpleTypeConverterConfiguration configuration)
          Constructs a new SimpleListConverter.
 
Method Summary
static SimpleListConverter create(SimpleTypeConverterConfiguration configuration)
          Creates a SimpleListConverter.
 Object fromString(String value)
          Converts the given String object into an object with the simple data type this converter is intended for.
protected  String[] getDefaultFormat()
          Returns the default format which is used when no format is given.
protected  Class<? extends Collection> getImplementor(Class<?> aCollectionInterface)
          Returns a class implementing the given interface.
 String toString(Object value)
          Converts the given value to a String object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleListConverter

protected SimpleListConverter(SimpleTypeConverterConfiguration configuration)
Constructs a new SimpleListConverter.
If no format is given, the default format (see getDefaultFormat()) is used.

Parameters:
configuration - the configuration
Throws:
ConversionException - if the given format is not valid.
Method Detail

create

public static SimpleListConverter create(SimpleTypeConverterConfiguration configuration)
Creates a SimpleListConverter.
If no format is given, the default format (see getDefaultFormat()) is used.

Parameters:
configuration - the configuration
Returns:
a simple list converter
Throws:
ConversionException - if the given format is not valid.

fromString

public final Object fromString(String value)
Converts the given String object into an object with the simple data type this converter is intended for.

Specified by:
fromString in interface SimpleTypeConverter
Parameters:
value - the String object to convert
Returns:
the converted value

toString

public final String toString(Object value)
Converts the given value to a String object.

Specified by:
toString in interface SimpleTypeConverter
Parameters:
value - the value to convert
Returns:
the converted value

getDefaultFormat

protected String[] getDefaultFormat()
Returns the default format which is used when no format is given.

Returns:
the default format.

getImplementor

protected Class<? extends Collection> getImplementor(Class<?> aCollectionInterface)
Returns a class implementing the given interface.

Parameters:
aCollectionInterface - a Collection.
Returns:
a class implementing the given interface or null.


Copyright © 2014. All rights reserved.