Skip to content

Instantly share code, notes, and snippets.

@jganoff
Created March 12, 2012 14:48
Show Gist options
  • Save jganoff/2022423 to your computer and use it in GitHub Desktop.
Save jganoff/2022423 to your computer and use it in GitHub Desktop.
package org.pentaho.hadoop.mapreduce.converter;
import org.pentaho.di.core.row.ValueMetaInterface;
/**
* Provides conversion between types
*
* @param <F> Type this converter can convert from
* @param <T> Type this converter can convert to
*/
public interface ITypeConverter<F, T> {
/**
* Can this converter convert between the types provided?
*
* @param from Type to convert from
* @param to Type to convert to
* @return {@code true} if this converter can handle the conversion between {@code from} and {@code to}
*/
public boolean canConvert(Class from, Class to);
/**
* Convert an object with some metadata to the destination type.
*
* @param meta Metadata for the object provided. This provides hints and formatting to aid in conversion.
* @param obj Object to convert
* @return Converted object
*
* @throws TypeConversionException Error encountered when converting {@code obj} to type {@code T}
*/
public T convert(ValueMetaInterface meta, F obj) throws TypeConversionException;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment