org.databene.commons.converter
Class ArrayConverter<S,T>

java.lang.Object
  extended by org.databene.commons.converter.MultiConverterWrapper<S,T>
      extended by org.databene.commons.converter.ArrayConverter<S,T>
All Implemented Interfaces:
Converter<S[],T[]>, ThreadAware
Direct Known Subclasses:
ArrayTypeConverter

public class ArrayConverter<S,T>
extends MultiConverterWrapper<S,T>
implements Converter<S[],T[]>

Converts arrays from one component type to arrays of another component type.

Created: 07.06.2007 14:35:18

Author:
Volker Bergmann

Field Summary
 
Fields inherited from class org.databene.commons.converter.MultiConverterWrapper
components
 
Constructor Summary
ArrayConverter(java.lang.Class<S> sourceComponentType, java.lang.Class<T> targetComponentType, Converter<S,T>... converters)
           
 
Method Summary
 T[] convert(S[] sourceValues)
          Concerts an object of type S to an object of type T
static
<S,T> T[]
convert(S[] sourceValues, Converter<S,T> converter, java.lang.Class<T> componentType)
           
 java.lang.Class<S[]> getSourceType()
           
 java.lang.Class<T[]> getTargetType()
           
 
Methods inherited from class org.databene.commons.converter.MultiConverterWrapper
addComponent, clone, getComponents, isParallelizable, isThreadSafe, setComponents
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.databene.commons.ThreadAware
isParallelizable, isThreadSafe
 

Constructor Detail

ArrayConverter

public ArrayConverter(java.lang.Class<S> sourceComponentType,
                      java.lang.Class<T> targetComponentType,
                      Converter<S,T>... converters)
Method Detail

getSourceType

public java.lang.Class<S[]> getSourceType()
Specified by:
getSourceType in interface Converter<S[],T[]>

getTargetType

public java.lang.Class<T[]> getTargetType()
Specified by:
getTargetType in interface Converter<S[],T[]>

convert

public T[] convert(S[] sourceValues)
            throws ConversionException
Description copied from interface: Converter
Concerts an object of type S to an object of type T

Specified by:
convert in interface Converter<S[],T[]>
Parameters:
sourceValues - the object to convert
Returns:
the converted object
Throws:
ConversionException - if the conversion fails

convert

public static <S,T> T[] convert(S[] sourceValues,
                                Converter<S,T> converter,
                                java.lang.Class<T> componentType)
                   throws ConversionException
Throws:
ConversionException


Copyright © 2010. All Rights Reserved.