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
-
Method Summary
Modifier and TypeMethodDescriptionprotected Object
convertFromBigNumberMetaInterface
(int targetValueMetaType, Object value) protected Object
convertFromBinaryMetaInterface
(int targetValueMetaType, Object value) protected Object
convertFromBooleanMetaInterface
(int targetValueMetaType, Object value) protected Object
convertFromDateMetaInterface
(int targetValueMetaType, Object value) protected Object
convertFromInetMetaInterface
(int targetValueMetaType, Object value) protected Object
convertFromIntegerMetaInterface
(int targetValueMetaType, Object value) protected Object
convertFromNumberMetaInterface
(int targetValueMetaType, Object value) protected Object
convertFromSerializableMetaInterface
(int targetValueMetaType, Object value) convertFromSourceToTargetDataType
(int sourceValueMetaType, int targetValueMetaType, Object value) protected Object
convertFromStringMetaInterface
(int targetValueMetaType, Object value) protected Object
convertFromTimestampMetaInterface
(int targetValueMetaType, Object value) int
void
setDatePattern
(SimpleDateFormat datePattern) void
setPrecision
(int precision)
-
Constructor Details
-
ValueMetaConverter
public ValueMetaConverter()
-
-
Method Details
-
getDatePattern
-
setDatePattern
- Specified by:
setDatePattern
in 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:
convertFromSourceToTargetDataType
in 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
-