
org.cyclopsgroup.caff.format.CSVFormat Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of caff Show documentation
Show all versions of caff Show documentation
Java conversion and formatting framework
package org.cyclopsgroup.caff.format;
import java.io.IOException;
import java.io.Reader;
import java.io.Writer;
import org.cyclopsgroup.caff.CharIterator;
/**
* Format implementation based on CSV syntax
*
* @author Jiaqi Guo
* @param Type of bean to format or parse
*/
public class CSVFormat
extends Format
{
private final CSVImpl impl;
/**
* @param beanType Type of bean to format or parse
*/
public CSVFormat( Class beanType )
{
super( beanType );
impl = new CSVImpl( beanType );
}
/**
* @inheritDoc
*/
@Override
public T parse( CharSequence content ) throws IOException
{
T bean = createBean();
impl.populate( bean, CharIterator.instanceOf( content ) );
return bean;
}
/**
* @inheritDoc
*/
@Override
public void populate( T bean, Reader reader )
throws IOException
{
impl.populate( bean, CharIterator.instanceOf( reader ) );
}
/**
* @inheritDoc
*/
@Override
public void print( T object, Writer output )
throws IOException
{
impl.print( object, output );
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy