|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.spicefactory.lib.reflect.convert.AbstractSequenceConverter<T>
public abstract class AbstractSequenceConverter<T>
Abstract Converter implementation for converting "sequences". Serves as a common base class for CollectionConverter and ArrayConverter.
| Constructor Summary | |
|---|---|
protected |
AbstractSequenceConverter(ReflectionFactory factory)
|
| Method Summary | |
|---|---|
protected abstract void |
addElement(T sequence,
Object element,
int index)
Adds the given element to the sequence (Array or Collection) at the specified index. |
T |
convert(Object value,
TypeContext typeContext)
Converts the given value to the target type of this converter. |
protected abstract T |
createInstance(TypeContext typeContext,
int size,
Object originalValue)
Create a new instance for the required target type. |
protected abstract Type |
getElementType(TypeContext typeContext)
Return the generic element type of the sequence (Array or Collection). |
protected Iterator<?> |
getIterator(Object value)
Return an Iterator for the given sequence (Array or Collection). |
protected int |
getSize(Object value)
|
boolean |
supports(Class<?> type)
Checks if this converter can convert instances of the given class to the target type of this converter. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
protected AbstractSequenceConverter(ReflectionFactory factory)
| Method Detail |
|---|
public T convert(Object value,
TypeContext typeContext)
ConverterConverter<Collection>) the given TypeContext might provide information for the
exact nature of the Collection (like List<String>).
convert in interface Converter<T>value - the value to be convertedtypeContext - additional information for the required type of the converted value
protected int getSize(Object value)
protected Iterator<?> getIterator(Object value)
value - the sequence for which an Iterator should be created
protected abstract T createInstance(TypeContext typeContext,
int size,
Object originalValue)
typeContext - the context from which the required type of the new instance be obtainedsize - the size of the Array/Collection to createoriginalValue - the original value (Array or Collection - mainly for logging purposes)
protected abstract Type getElementType(TypeContext typeContext)
typeContext - the context from which the element type can be obtained
protected abstract void addElement(T sequence,
Object element,
int index)
sequence - the sequence (Array or Collection) the item should be added toelement - the new element to be addedindex - the index at which the element should be addedpublic boolean supports(Class<?> type)
Converter
supports in interface Converter<T>type - the class to be checked
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||