net.entropysoft.transmorph.converters.collections.CollectionToString Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of transmorph Show documentation
Show all versions of transmorph Show documentation
Java library to convert a Java object of one type into
an object of another type (with another signature, possibly
parameterized).
package net.entropysoft.transmorph.converters.collections;
import java.util.Collection;
import net.entropysoft.transmorph.ConversionContext;
import net.entropysoft.transmorph.ConverterException;
import net.entropysoft.transmorph.converters.AbstractContainerConverter;
import net.entropysoft.transmorph.type.TypeReference;
public class CollectionToString extends AbstractContainerConverter {
private IStringArrayFormatter stringArrayFormatter = new DefaultStringArrayFormatter();
public CollectionToString() {
this.useObjectPool = false;
}
public IStringArrayFormatter getStringArrayFormatter() {
return stringArrayFormatter;
}
public void setStringArrayFormatter(IStringArrayFormatter stringArrayFormatter) {
this.stringArrayFormatter = stringArrayFormatter;
}
public Object doConvert(ConversionContext context, Object sourceObject, TypeReference> destinationType) throws ConverterException {
if (sourceObject == null) {
return null;
}
Collection