com.codetaco.funnel.provider.ProviderFactory Maven / Gradle / Ivy
package com.codetaco.funnel.provider;
import java.io.IOException;
import java.text.ParseException;
import com.codetaco.funnel.FunnelDataProvider;
import com.codetaco.funnel.parameters.FunnelContext;
/**
*
* ProviderFactory class.
*
*
* @author Chris DeGreef [email protected]
*/
public class ProviderFactory
{
/**
*
* create.
*
*
* @param context a {@link com.codetaco.funnel.parameters.FunnelContext}
* object.
* @return a {@link com.codetaco.funnel.FunnelDataProvider} object.
* @throws java.io.IOException if any.
* @throws java.text.ParseException if any.
*/
static public FunnelDataProvider create(final FunnelContext context) throws IOException, ParseException
{
if (context.getFixedRecordLengthIn() > 0)
return new FixedLengthProvider(context);
if (context.getCsv() == null)
return new VariableLengthProvider(context);
return new CsvProvider(context);
}
}