Package org.pentaho.di.core.row.value
Class ValueMetaConverter
java.lang.Object
org.pentaho.di.core.row.value.ValueMetaConverter
- All Implemented Interfaces:
Serializable,IValueMetaConverter
This class is intended to facilitate any needed conversions of a ValueMetaInterface field from one type to another.
It was initially implemented for Orc storage in the pentaho-hadoop-shims project. This class is added here because
the conversions are not dependant on orc in any way.
Important note:
This class is not intended to mimic the conversions that exist on PDI! It handles
conversions from and to Avro/Parquet/Orc format, as so it must only take in consideration those Specs!
Created by tkafalas on 12/8/2017.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected ObjectconvertFromBigNumberMetaInterface(int targetValueMetaType, Object value) protected ObjectconvertFromBinaryMetaInterface(int targetValueMetaType, Object value) protected ObjectconvertFromBooleanMetaInterface(int targetValueMetaType, Object value) protected ObjectconvertFromDateMetaInterface(int targetValueMetaType, Object value) protected ObjectconvertFromInetMetaInterface(int targetValueMetaType, Object value) protected ObjectconvertFromIntegerMetaInterface(int targetValueMetaType, Object value) protected ObjectconvertFromNumberMetaInterface(int targetValueMetaType, Object value) protected ObjectconvertFromSerializableMetaInterface(int targetValueMetaType, Object value) convertFromSourceToTargetDataType(int sourceValueMetaType, int targetValueMetaType, Object value) protected ObjectconvertFromStringMetaInterface(int targetValueMetaType, Object value) protected ObjectconvertFromTimestampMetaInterface(int targetValueMetaType, Object value) intvoidsetDatePattern(SimpleDateFormat datePattern) voidsetPrecision(int precision)
-
Constructor Details
-
ValueMetaConverter
public ValueMetaConverter()
-
-
Method Details
-
getDatePattern
-
setDatePattern
- Specified by:
setDatePatternin interfaceIValueMetaConverter
-
getPrecision
public int getPrecision() -
setPrecision
public void setPrecision(int precision) -
convertFromSourceToTargetDataType
public Object convertFromSourceToTargetDataType(int sourceValueMetaType, int targetValueMetaType, Object value) throws ValueMetaConversionException - Specified by:
convertFromSourceToTargetDataTypein interfaceIValueMetaConverter- Parameters:
sourceValueMetaType- The source ValueMeta Type defined in the ValueMetaInterfacetargetValueMetaType- The target ValueMeta Type defined in the ValueMetaInterfacevalue- the source value to be converted- Returns:
- An object representing the value converted to targetMetaType. This value is suitable to use for
- Throws:
ValueMetaConversionException
-
convertFromStringMetaInterface
protected Object convertFromStringMetaInterface(int targetValueMetaType, Object value) throws ValueMetaConversionException - Throws:
ValueMetaConversionException
-
convertFromDateMetaInterface
protected Object convertFromDateMetaInterface(int targetValueMetaType, Object value) throws ValueMetaConversionException - Throws:
ValueMetaConversionException
-
convertFromNumberMetaInterface
protected Object convertFromNumberMetaInterface(int targetValueMetaType, Object value) throws ValueMetaConversionException - Throws:
ValueMetaConversionException
-
convertFromBooleanMetaInterface
protected Object convertFromBooleanMetaInterface(int targetValueMetaType, Object value) throws ValueMetaConversionException - Throws:
ValueMetaConversionException
-
convertFromIntegerMetaInterface
protected Object convertFromIntegerMetaInterface(int targetValueMetaType, Object value) throws ValueMetaConversionException - Throws:
ValueMetaConversionException
-
convertFromBigNumberMetaInterface
protected Object convertFromBigNumberMetaInterface(int targetValueMetaType, Object value) throws ValueMetaConversionException - Throws:
ValueMetaConversionException
-
convertFromTimestampMetaInterface
protected Object convertFromTimestampMetaInterface(int targetValueMetaType, Object value) throws ValueMetaConversionException - Throws:
ValueMetaConversionException
-
convertFromInetMetaInterface
protected Object convertFromInetMetaInterface(int targetValueMetaType, Object value) throws ValueMetaConversionException - Throws:
ValueMetaConversionException
-
convertFromBinaryMetaInterface
protected Object convertFromBinaryMetaInterface(int targetValueMetaType, Object value) throws ValueMetaConversionException - Throws:
ValueMetaConversionException
-
convertFromSerializableMetaInterface
protected Object convertFromSerializableMetaInterface(int targetValueMetaType, Object value) throws ValueMetaConversionException - Throws:
ValueMetaConversionException
-