Package org.pentaho.di.core.row.value
Class ValueMetaBase
- java.lang.Object
-
- org.pentaho.di.core.row.value.ValueMetaBase
-
- All Implemented Interfaces:
Cloneable,ValueMetaInterface
- Direct Known Subclasses:
ValueMeta,ValueMetaBigNumber,ValueMetaBinary,ValueMetaBoolean,ValueMetaDate,ValueMetaInteger,ValueMetaNone,ValueMetaNumber,ValueMetaSerializable,ValueMetaString
public class ValueMetaBase extends Object implements ValueMetaInterface
-
-
Field Summary
-
Fields inherited from interface org.pentaho.di.core.row.ValueMetaInterface
DEFAULT_INTEGER_LENGTH, SORT_TYPE_ASCENDING, SORT_TYPE_DESCENDING, SORT_TYPE_NOT_SORTED, sortTypeCodes, STORAGE_TYPE_BINARY_STRING, STORAGE_TYPE_INDEXED, STORAGE_TYPE_NORMAL, storageTypeCodes, TRIM_TYPE_BOTH, TRIM_TYPE_LEFT, TRIM_TYPE_NONE, TRIM_TYPE_RIGHT, TYPE_BIGNUMBER, TYPE_BINARY, TYPE_BOOLEAN, TYPE_DATE, TYPE_INET, TYPE_INTEGER, TYPE_NONE, TYPE_NUMBER, TYPE_SERIALIZABLE, TYPE_STRING, TYPE_TIMESTAMP, typeCodes
-
-
Constructor Summary
Constructors Constructor Description ValueMetaBase()ValueMetaBase(DataInputStream inputStream)Deprecated.in favor of a combination ofValueMetaFactory.createValueMeta() and the loadMetaData() method.ValueMetaBase(String name)ValueMetaBase(String name, int type)ValueMetaBase(String name, int type, int storageType)Deprecated.useValueMetaBase(String, int)andsetStorageType(int)insteadValueMetaBase(String name, int type, int length, int precision)ValueMetaBase(String name, int type, int length, int precision, Comparator<Object> comparator)ValueMetaBase(String name, int type, Comparator<Object> comparator)ValueMetaBase(Node node)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description ValueMetaBaseclone()ObjectcloneValueData(Object object)Clones the data.intcompare(Object data1, Object data2)Compare 2 values of the same data typeintcompare(Object data1, ValueMetaInterface meta2, Object data2)Compare 2 values of the same data typeprotected voidcompareStorageAndActualFormat()protected BooleanconvertBigNumberToBoolean(BigDecimal number)protected DateconvertBigNumberToDate(BigDecimal number)protected StringconvertBigNumberToString(BigDecimal number)ObjectconvertBinaryStringToNativeType(byte[] binary)Convert the binary data to the actual data type.
- byte[] --> Long (Integer) - byte[] --> Double (Number) - byte[] --> BigDecimal (BigNumber) - byte[] --> Date (Date) - byte[] --> Boolean (Boolean) - byte[] --> byte[] (Binary)protected StringconvertBinaryStringToString(byte[] binary)Converts a byte[] stored in a binary string storage type into a String;protected BigDecimalconvertBooleanToBigNumber(Boolean bool)protected LongconvertBooleanToInteger(Boolean bool)protected DoubleconvertBooleanToNumber(Boolean bool)protected StringconvertBooleanToString(Boolean bool)ObjectconvertData(ValueMetaInterface meta2, Object data2)Convert the specified data to the data type specified in this object.ObjectconvertDataCompatible(ValueMetaInterface meta2, Object data2)Convert the specified data to the data type specified in this object.ObjectconvertDataFromString(String pol, ValueMetaInterface convertMeta, String nullIf, String ifNull, int trim_type)Convert the specified string to the data type specified in this object.ObjectconvertDataUsingConversionMetaData(Object data)Convert an object to the data type specified in the conversion metadataprotected BigDecimalconvertDateToBigNumber(Date date)protected StringconvertDateToCompatibleString(Date date)protected LongconvertDateToInteger(Date date)protected DoubleconvertDateToNumber(Date date)protected StringconvertDateToString(Date date)protected BooleanconvertIntegerToBoolean(Long number)protected StringconvertIntegerToCompatibleString(Long integer)protected DateconvertIntegerToDate(Long number)protected StringconvertIntegerToString(Long integer)ObjectconvertNormalStorageTypeToBinaryString(Object object)Convert a normal storage type to a binary string object.protected BooleanconvertNumberToBoolean(Double number)protected StringconvertNumberToCompatibleString(Double number)protected DateconvertNumberToDate(Double number)protected StringconvertNumberToString(Double number)protected BigDecimalconvertStringToBigNumber(String string)protected byte[]convertStringToBinaryString(String string)static BooleanconvertStringToBoolean(String string)protected DateconvertStringToDate(String string)protected LongconvertStringToInteger(String string)protected DoubleconvertStringToNumber(String string)ObjectconvertToBinaryStringStorageType(Object object)Converts the specified data object to the binary string storage type.ObjectconvertToNormalStorageType(Object object)Converts the specified data object to the normal storage type.ValuecreateOriginalValue(Object data)Create an old-style value for backward compatibility reasonsprotected voiddetermineSingleByteEncoding()voiddrawValue(PrimitiveGCInterface gc, Object value)This method draws the value using the supplied graphical context.static String[]getAllTypes()Get an array of String describing the possible types a Value can have.BigDecimalgetBigNumber(Object object)Convert the supplied data to a BigNumberbyte[]getBinary(Object object)Convert the supplied data to binary databyte[]getBinaryString(Object object)convert the supplied data to a binary string representation (for writing text)BooleangetBoolean(Object object)Convert the supplied data to a BooleanLocalegetCollatorLocale()Get the current Locale of the collatorintgetCollatorStrength()Returns the strength of the collator.StringgetComments()Gets the comments.StringgetCompatibleString(Object object)Convert the supplied data to a String compatible with version 2.5.StringgetConversionMask()Deprecated.ValueMetaInterfacegetConversionMetadata()This conversion metadata can be attached to a String object to see where it came from and with which mask it was generated, the encoding, the local languages used, padding, etc.StringgetCurrencySymbol()Gets the currency symbol.StringgetDatabaseColumnTypeDefinition(DatabaseInterface databaseInterface, String tk, String pk, boolean use_autoinc, boolean add_fieldname, boolean add_cr)Ask for suggestions as to how this plugin data type should be represented in the specified database interfaceStringgetDataXML(Object object)Returns an XML representation of the row data.DategetDate(Object object)Convert the supplied data to a DateSimpleDateFormatgetDateFormat()Gets the date format.LocalegetDateFormatLocale()Returns the locale from the date format.TimeZonegetDateFormatTimeZone()DecimalFormatgetDecimalFormat()Gets the decimal format.DecimalFormatgetDecimalFormat(boolean useBigDecimal)Gets the decimal format.StringgetDecimalSymbol()Gets the decimal symbol.StringgetFormatMask()Gets a formatting mask using this value's meta information.StringgetGroupingSymbol()Gets the grouping symbol.Object[]getIndex()Gets the index.LonggetInteger(Object object)Convert the supplied data to an IntegerintgetLength()Gets the length.ValueMetaInterfacegetMetadataPreview(DatabaseMeta databaseMeta, ResultSet rs)This is a similar method to getValueFromSQLType, but it uses a ResultSet from a call to DatabaseMetaData#getColumns(String, String, String, String) The ResultSet must be positioned correctly on the row to read.StringgetMetaXML()Returns an XML representation of the row metadata.StringgetName()Gets the name.ObjectgetNativeDataType(Object object)This method gives you the native Java data type corresponding to the value meta-data.Class<?>getNativeDataTypeClass()Return the Java class that represents the "native" storage type of this ValueMetaDoublegetNumber(Object object)Convert the supplied data to a NumberlonggetNumberOfBinaryStringConversions()Returns the number of binary string to native data type conversions done with this object conversionsStringgetOrigin()Gets the origin.protected voidgetOriginalColumnMetadata(ValueMetaInterface v, ResultSetMetaData rm, int index, boolean ignoreLength)intgetOriginalColumnType()store original JDBC RecordSetMetaData for later useStringgetOriginalColumnTypeName()Gets the original column type name.intgetOriginalNullable()Gets the original nullable.intgetOriginalPrecision()Gets the original precision.intgetOriginalScale()Gets the original scale.booleangetOriginalSigned()Gets the original signed.intgetPrecision()Gets the precision.protected intgetQuotesBeforeSymbol(String df, String symbols)ValueMetaInterfacegetStorageMetadata()Returns the storage Meta data that is needed for internal conversion from BinaryString or String to the specified type.intgetStorageType()Gets the storage type.static intgetStorageType(String desc)Convert the String description of a storage type to an integer type.static StringgetStorageTypeCode(int storageType)StringgetStorageTypeDesc()Return the storage type of a value in a textual form: "normal", "binary-string", "indexes"StringgetString(Object object)Convert the supplied data to a StringStringgetStringEncoding()Gets the string encoding.intgetTrimType()Gets the trim type.static intgetTrimTypeByCode(String tt)static intgetTrimTypeByDesc(String tt)static StringgetTrimTypeCode(int i)static String[]getTrimTypeCodes()static StringgetTrimTypeDesc(int i)static String[]getTrimTypeDescriptions()intgetType()Gets the type.static intgetType(String desc)Convert the String description of a type to an integer type.StringgetTypeDesc()Return the type of a value in a textual form: "String", "Number", "Integer", "Boolean", "Date", ...static StringgetTypeDesc(int type)TODO: change Desc to Code all over the place.static String[]getTypes()get an array of String describing the possible types a Value can have.ObjectgetValue(Node node)Convert a data XML node to an Object that corresponds to the metadata.ObjectgetValueData(Value value)Extracts the primitive data from an old style Value objectObjectgetValueFromResultSet(DatabaseInterface databaseInterface, ResultSet resultSet, int index)Get a value from a result set column based on the current value metadataValueMetaInterfacegetValueFromSQLType(DatabaseMeta databaseMeta, String name, ResultSetMetaData rm, int index, boolean ignoreLength, boolean lazyConversion)Investigate JDBC result set metadata at the specified index.inthashCode(Object object)Calculate the hashcode of the specified data objectbooleanisBigNumber()Checks whether or not the value is a Big NumberbooleanisBigNumberFormatting()booleanisBinary()Checks whether or not this value is of type BinarybooleanisBoolean()Checks whether or not this value is a booleanbooleanisCaseInsensitive()Returns a true of the value object is case insensitive, false if it is case sensitive,booleanisCollatorDisabled()Returns a true of the value object is case insensitive, false if it is case sensitive,booleanisDate()Checks whether or not this value is a DatebooleanisDateFormatLenient()Returns true of the date format is leniant, false if it is strict.booleanisIgnoreWhitespace()Is Ignore Whitespace Only applicable for TYPE_STRING comparisonsbooleanisInteger()Checks whether or not this value is an IntegerbooleanisLargeTextField()Returns true if this is a large text field (CLOB, TEXT) with arbitrary length.booleanisLenientStringToNumber()booleanisNull(Object data)Determine if an object is null.booleanisNumber()Checks whether or not the value is a NumberbooleanisNumeric()Checks whether or not this Value is Numeric A Value is numeric if it is either of type Number or Integerstatic booleanisNumeric(int t)Checks whether or not the specified type is either Integer or NumberbooleanisOriginalAutoIncrement()Checks if is original auto increment.intisOriginalNullable()Checks if is original nullable.booleanisOriginalSigned()Checks if is original signed.booleanisOutputPaddingEnabled()Returns true if output padding is enabled (padding to specified length).booleanisSerializableType()Checks whether or not this value is of type SerializablebooleanisSingleByteEncoding()booleanisSortedAscending()booleanisSortedDescending()Returns whether or not the value should be sorted in descending order.booleanisStorageBinaryString()Checks if is storage binary string.booleanisStorageIndexed()Checks if is storage indexed.booleanisStorageNormal()Checks if is storage normal.booleanisString()Checks whether or not the value is a String.protected BigDecimalreadBigNumber(DataInputStream inputStream)protected byte[]readBinary(DataInputStream inputStream)protected byte[]readBinaryString(DataInputStream inputStream)protected BooleanreadBoolean(DataInputStream inputStream)ObjectreadData(DataInputStream inputStream)De-serialize data from an inputstream.protected DatereadDate(DataInputStream inputStream)protected LongreadInteger(DataInputStream inputStream)voidreadMetaData(DataInputStream inputStream)Load the attributes of this particular value meta object from the input stream.protected DoublereadNumber(DataInputStream inputStream)protected IntegerreadSmallInteger(DataInputStream inputStream)protected StringreadString(DataInputStream inputStream)booleanrequiresRealClone()Returns true if the data type requires a real copy.voidsetBigNumberFormatting(boolean bigNumberFormatting)voidsetCaseInsensitive(boolean caseInsensitive)Sets whether or not the value object is case sensitive.voidsetCollatorDisabled(boolean collatorDisabled)Sets whether or not the value object should be sorted according to a locale using a collatorvoidsetCollatorLocale(Locale locale)Sets the Locale of the collatorvoidsetCollatorStrength(int collatorStrength)Sets the strength of the collator.voidsetComments(String comments)Sets the comments for the object implementing the interface.voidsetConversionMask(String conversionMask)Sets the conversion mask.voidsetConversionMetadata(ValueMetaInterface conversionMetadata)Attach conversion metadata to a String object to see where it came from and with which mask it was generated, the encoding, the local languages used, padding, etc.voidsetCurrencySymbol(String currencySymbol)Sets the currency symbol.voidsetDateFormatLenient(boolean dateFormatLenient)Set to true if the date formatting (parsing) is to be set to lenient.voidsetDateFormatLocale(Locale dateFormatLocale)Sets the locale of the date format.voidsetDateFormatTimeZone(TimeZone dateFormatTimeZone)voidsetDecimalSymbol(String decimalSymbol)Sets the decimal symbol.protected voidsetDefaultConversionMask()voidsetGroupingSymbol(String groupingSymbol)Sets the grouping symbol.voidsetIgnoreWhitespace(boolean ignoreWhitespace)Set Ignore Whitespace Only applicable for TYPE_STRING comparisonsvoidsetIndex(Object[] index)Sets the index.voidsetLargeTextField(boolean largeTextField)Set to true if the this is to be a large text field (CLOB, TEXT) with arbitrary length.voidsetLength(int length)Sets the length.voidsetLength(int length, int precision)Sets the length.voidsetLenientStringToNumber(boolean lenientStringToNumber)voidsetName(String name)Sets the name.voidsetNumberOfBinaryStringConversions(long numberOfBinaryStringConversions)Returns the number of binary string to native data type done with this object conversions to set.voidsetOrigin(String origin)Sets the origin.voidsetOriginalAutoIncrement(boolean originalAutoIncrement)Sets the original auto increment.voidsetOriginalColumnType(int originalColumnType)Sets the original column type.voidsetOriginalColumnTypeName(String originalColumnTypeName)Sets the original column type name.voidsetOriginalNullable(int originalNullable)Sets the original nullable.voidsetOriginalPrecision(int originalPrecision)Sets the original precision.voidsetOriginalScale(int originalScale)Sets the original scale.voidsetOriginalSigned(boolean originalSigned)Sets the original signed.voidsetOutputPaddingEnabled(boolean outputPaddingEnabled)Set to true if output padding is to be enabled (padding to specified length).voidsetPrecision(int precision)Sets the precision.voidsetPreparedStatementValue(DatabaseMeta databaseMeta, PreparedStatement preparedStatement, int index, Object data)Set a value on a JDBC prepared statement on the specified positionvoidsetSortedDescending(boolean sortedDescending)Sets whether or not the value should be set in a descending order.voidsetStorageMetadata(ValueMetaInterface storageMetadata)Sets the storage meta data.voidsetStorageType(int storageType)Sets the storage type.voidsetStringEncoding(String encoding)Sets the string encoding.voidsetTrimType(int trimType)Sets the trim type.voidsetType(int type)Deprecated.StringtoString()StringtoStringMeta()a String text representation of this Value, optionally padded to the specified lengthprotected Stringtrim(String string)protected voidwriteBigNumber(DataOutputStream outputStream, BigDecimal number)protected voidwriteBinary(DataOutputStream outputStream, byte[] binary)protected voidwriteBinaryString(DataOutputStream outputStream, byte[] binaryString)protected voidwriteBoolean(DataOutputStream outputStream, Boolean bool)voidwriteData(DataOutputStream outputStream, Object object)Serialize the content of the specified data object to the outputStream.protected voidwriteDate(DataOutputStream outputStream, Date date)protected voidwriteInteger(DataOutputStream outputStream, Integer number)protected voidwriteInteger(DataOutputStream outputStream, Long number)voidwriteMeta(DataOutputStream outputStream)Write the content of this class (metadata) to the specified output stream.protected voidwriteNumber(DataOutputStream outputStream, Double number)protected voidwriteString(DataOutputStream outputStream, String string)
-
-
-
Field Detail
-
DEFAULT_INTEGER_PARSE_MASK
public static final String DEFAULT_INTEGER_PARSE_MASK
-
DEFAULT_NUMBER_PARSE_MASK
public static final String DEFAULT_NUMBER_PARSE_MASK
-
DEFAULT_BIGNUMBER_PARSE_MASK
public static final String DEFAULT_BIGNUMBER_PARSE_MASK
-
DEFAULT_DATE_PARSE_MASK
public static final String DEFAULT_DATE_PARSE_MASK
-
DEFAULT_TIMESTAMP_PARSE_MASK
public static final String DEFAULT_TIMESTAMP_PARSE_MASK
-
DEFAULT_INTEGER_FORMAT_MASK
public static final String DEFAULT_INTEGER_FORMAT_MASK
-
DEFAULT_NUMBER_FORMAT_MASK
public static final String DEFAULT_NUMBER_FORMAT_MASK
-
DEFAULT_BIG_NUMBER_FORMAT_MASK
public static final String DEFAULT_BIG_NUMBER_FORMAT_MASK
-
DEFAULT_DATE_FORMAT_MASK
public static final String DEFAULT_DATE_FORMAT_MASK
-
DEFAULT_TIMESTAMP_FORMAT_MASK
public static final String DEFAULT_TIMESTAMP_FORMAT_MASK
-
PKG
protected static Class<?> PKG
-
XML_META_TAG
public static final String XML_META_TAG
- See Also:
- Constant Field Values
-
XML_DATA_TAG
public static final String XML_DATA_TAG
- See Also:
- Constant Field Values
-
COMPATIBLE_DATE_FORMAT_PATTERN
public static final String COMPATIBLE_DATE_FORMAT_PATTERN
- See Also:
- Constant Field Values
-
name
protected String name
-
length
protected int length
-
precision
protected int precision
-
type
protected int type
-
trimType
protected int trimType
-
storageType
protected int storageType
-
origin
protected String origin
-
comments
protected String comments
-
index
protected Object[] index
-
conversionMask
protected String conversionMask
-
stringEncoding
protected String stringEncoding
-
decimalSymbol
protected String decimalSymbol
-
groupingSymbol
protected String groupingSymbol
-
currencySymbol
protected String currencySymbol
-
collatorStrength
protected int collatorStrength
-
caseInsensitive
protected boolean caseInsensitive
-
collatorDisabled
protected boolean collatorDisabled
-
sortedDescending
protected boolean sortedDescending
-
outputPaddingEnabled
protected boolean outputPaddingEnabled
-
largeTextField
protected boolean largeTextField
-
collatorLocale
protected Locale collatorLocale
-
collator
protected Collator collator
-
dateFormatLocale
protected Locale dateFormatLocale
-
dateFormatTimeZone
protected TimeZone dateFormatTimeZone
-
dateFormatLenient
protected boolean dateFormatLenient
-
lenientStringToNumber
protected boolean lenientStringToNumber
-
ignoreTimezone
protected boolean ignoreTimezone
-
emptyStringAndNullAreDifferent
protected boolean emptyStringAndNullAreDifferent
-
dateFormat
protected SimpleDateFormat dateFormat
-
dateFormatChanged
protected boolean dateFormatChanged
-
decimalFormat
protected DecimalFormat decimalFormat
-
decimalFormatChanged
protected boolean decimalFormatChanged
-
storageMetadata
protected ValueMetaInterface storageMetadata
-
identicalFormat
protected boolean identicalFormat
-
conversionMetadata
protected ValueMetaInterface conversionMetadata
-
numberOfBinaryStringConversions
protected long numberOfBinaryStringConversions
-
bigNumberFormatting
protected boolean bigNumberFormatting
-
originalColumnType
protected int originalColumnType
-
originalColumnTypeName
protected String originalColumnTypeName
-
originalPrecision
protected int originalPrecision
-
originalScale
protected int originalScale
-
originalAutoIncrement
protected boolean originalAutoIncrement
-
originalNullable
protected int originalNullable
-
originalSigned
protected boolean originalSigned
-
ignoreWhitespace
protected boolean ignoreWhitespace
-
comparator
protected final Comparator<Object> comparator
-
trimTypeCode
public static final String[] trimTypeCode
The trim type codes
-
trimTypeDesc
public static final String[] trimTypeDesc
The trim description
-
SINGLE_BYTE_ENCODINGS
public static final String[] SINGLE_BYTE_ENCODINGS
-
compatibleDateFormat
protected static SimpleDateFormat compatibleDateFormat
-
-
Constructor Detail
-
ValueMetaBase
public ValueMetaBase()
-
ValueMetaBase
public ValueMetaBase(String name)
-
ValueMetaBase
public ValueMetaBase(String name, int type)
-
ValueMetaBase
public ValueMetaBase(String name, int type, Comparator<Object> comparator)
-
ValueMetaBase
public ValueMetaBase(String name, int type, int length, int precision)
-
ValueMetaBase
public ValueMetaBase(String name, int type, int length, int precision, Comparator<Object> comparator)
-
ValueMetaBase
public ValueMetaBase(Node node) throws KettleException
- Throws:
KettleException
-
ValueMetaBase
@Deprecated public ValueMetaBase(DataInputStream inputStream) throws KettleFileException, KettleEOFException
Deprecated.in favor of a combination ofValueMetaFactory.createValueMeta() and the loadMetaData() method.Create a new Value meta object.- Parameters:
inputStream-- Throws:
KettleFileExceptionKettleEOFException
-
ValueMetaBase
@Deprecated public ValueMetaBase(String name, int type, int storageType)
Deprecated.useValueMetaBase(String, int)andsetStorageType(int)instead- Parameters:
name-type-storageType-
-
-
Method Detail
-
setDefaultConversionMask
protected void setDefaultConversionMask()
-
determineSingleByteEncoding
protected void determineSingleByteEncoding()
-
clone
public ValueMetaBase clone()
- Specified by:
clonein interfaceValueMetaInterface- Overrides:
clonein classObject- Returns:
- a copy of this value meta object
-
getComments
public String getComments()
Description copied from interface:ValueMetaInterfaceGets the comments.- Specified by:
getCommentsin interfaceValueMetaInterface- Returns:
- the comments
-
setComments
public void setComments(String comments)
Description copied from interface:ValueMetaInterfaceSets the comments for the object implementing the interface.- Specified by:
setCommentsin interfaceValueMetaInterface- Parameters:
comments- the comments to set
-
getIndex
public Object[] getIndex()
Description copied from interface:ValueMetaInterfaceGets the index.- Specified by:
getIndexin interfaceValueMetaInterface- Returns:
- the index
-
setIndex
public void setIndex(Object[] index)
Description copied from interface:ValueMetaInterfaceSets the index.- Specified by:
setIndexin interfaceValueMetaInterface- Parameters:
index- the index to set
-
getLength
public int getLength()
Description copied from interface:ValueMetaInterfaceGets the length.- Specified by:
getLengthin interfaceValueMetaInterface- Returns:
- the length
-
setLength
public void setLength(int length)
Description copied from interface:ValueMetaInterfaceSets the length.- Specified by:
setLengthin interfaceValueMetaInterface- Parameters:
length- the length to set
-
setLength
public void setLength(int length, int precision)Description copied from interface:ValueMetaInterfaceSets the length.- Specified by:
setLengthin interfaceValueMetaInterface- Parameters:
length- the length to setprecision- the precision
-
getName
public String getName()
Description copied from interface:ValueMetaInterfaceGets the name.- Specified by:
getNamein interfaceValueMetaInterface- Returns:
- the name
-
setName
public void setName(String name)
Description copied from interface:ValueMetaInterfaceSets the name.- Specified by:
setNamein interfaceValueMetaInterface- Parameters:
name- the name to set
-
getOrigin
public String getOrigin()
Description copied from interface:ValueMetaInterfaceGets the origin.- Specified by:
getOriginin interfaceValueMetaInterface- Returns:
- the origin
-
setOrigin
public void setOrigin(String origin)
Description copied from interface:ValueMetaInterfaceSets the origin.- Specified by:
setOriginin interfaceValueMetaInterface- Parameters:
origin- the origin to set
-
getPrecision
public int getPrecision()
Description copied from interface:ValueMetaInterfaceGets the precision.- Specified by:
getPrecisionin interfaceValueMetaInterface- Returns:
- the precision
-
setPrecision
public void setPrecision(int precision)
Description copied from interface:ValueMetaInterfaceSets the precision.- Specified by:
setPrecisionin interfaceValueMetaInterface- Parameters:
precision- the precision to set
-
getStorageType
public int getStorageType()
Description copied from interface:ValueMetaInterfaceGets the storage type.- Specified by:
getStorageTypein interfaceValueMetaInterface- Returns:
- the storageType
-
setStorageType
public void setStorageType(int storageType)
Description copied from interface:ValueMetaInterfaceSets the storage type.- Specified by:
setStorageTypein interfaceValueMetaInterface- Parameters:
storageType- the storageType to set
-
isStorageNormal
public boolean isStorageNormal()
Description copied from interface:ValueMetaInterfaceChecks if is storage normal.- Specified by:
isStorageNormalin interfaceValueMetaInterface- Returns:
- true, if is storage normal
-
isStorageIndexed
public boolean isStorageIndexed()
Description copied from interface:ValueMetaInterfaceChecks if is storage indexed.- Specified by:
isStorageIndexedin interfaceValueMetaInterface- Returns:
- true, if is storage indexed
-
isStorageBinaryString
public boolean isStorageBinaryString()
Description copied from interface:ValueMetaInterfaceChecks if is storage binary string.- Specified by:
isStorageBinaryStringin interfaceValueMetaInterface- Returns:
- true, if is storage binary string
-
getType
public int getType()
Description copied from interface:ValueMetaInterfaceGets the type.- Specified by:
getTypein interfaceValueMetaInterface- Returns:
- the type
-
setType
@Deprecated public void setType(int type)
Deprecated.Description copied from interface:ValueMetaInterfaceSets the type.- Specified by:
setTypein interfaceValueMetaInterface- Parameters:
type- the type to set
-
getConversionMask
@Deprecated public String getConversionMask()
Deprecated.Description copied from interface:ValueMetaInterfaceGets the conversion mask.- Specified by:
getConversionMaskin interfaceValueMetaInterface- Returns:
- the conversionMask
-
setConversionMask
public void setConversionMask(String conversionMask)
Description copied from interface:ValueMetaInterfaceSets the conversion mask.- Specified by:
setConversionMaskin interfaceValueMetaInterface- Parameters:
conversionMask- the conversionMask to set
-
getStringEncoding
public String getStringEncoding()
Description copied from interface:ValueMetaInterfaceGets the string encoding.- Specified by:
getStringEncodingin interfaceValueMetaInterface- Returns:
- the encoding
-
setStringEncoding
public void setStringEncoding(String encoding)
Description copied from interface:ValueMetaInterfaceSets the string encoding.- Specified by:
setStringEncodingin interfaceValueMetaInterface- Parameters:
encoding- the encoding to set
-
getDecimalSymbol
public String getDecimalSymbol()
Description copied from interface:ValueMetaInterfaceGets the decimal symbol.- Specified by:
getDecimalSymbolin interfaceValueMetaInterface- Returns:
- the decimalSymbol
-
setDecimalSymbol
public void setDecimalSymbol(String decimalSymbol)
Description copied from interface:ValueMetaInterfaceSets the decimal symbol.- Specified by:
setDecimalSymbolin interfaceValueMetaInterface- Parameters:
decimalSymbol- the decimalSymbol to set
-
getGroupingSymbol
public String getGroupingSymbol()
Description copied from interface:ValueMetaInterfaceGets the grouping symbol.- Specified by:
getGroupingSymbolin interfaceValueMetaInterface- Returns:
- the groupingSymbol
-
setGroupingSymbol
public void setGroupingSymbol(String groupingSymbol)
Description copied from interface:ValueMetaInterfaceSets the grouping symbol.- Specified by:
setGroupingSymbolin interfaceValueMetaInterface- Parameters:
groupingSymbol- the groupingSymbol to set
-
getCurrencySymbol
public String getCurrencySymbol()
Description copied from interface:ValueMetaInterfaceGets the currency symbol.- Specified by:
getCurrencySymbolin interfaceValueMetaInterface- Returns:
- the currencySymbol
-
setCurrencySymbol
public void setCurrencySymbol(String currencySymbol)
Description copied from interface:ValueMetaInterfaceSets the currency symbol.- Specified by:
setCurrencySymbolin interfaceValueMetaInterface- Parameters:
currencySymbol- the currencySymbol to set
-
isCaseInsensitive
public boolean isCaseInsensitive()
Description copied from interface:ValueMetaInterfaceReturns a true of the value object is case insensitive, false if it is case sensitive,- Specified by:
isCaseInsensitivein interfaceValueMetaInterface- Returns:
- the caseInsensitive
-
setCaseInsensitive
public void setCaseInsensitive(boolean caseInsensitive)
Description copied from interface:ValueMetaInterfaceSets whether or not the value object is case sensitive. This information is useful if the value is involved in string comparisons.- Specified by:
setCaseInsensitivein interfaceValueMetaInterface- Parameters:
caseInsensitive- the caseInsensitive to set
-
isCollatorDisabled
public boolean isCollatorDisabled()
Description copied from interface:ValueMetaInterfaceReturns a true of the value object is case insensitive, false if it is case sensitive,- Specified by:
isCollatorDisabledin interfaceValueMetaInterface- Returns:
- the collatorDisabled
-
setCollatorDisabled
public void setCollatorDisabled(boolean collatorDisabled)
Description copied from interface:ValueMetaInterfaceSets whether or not the value object should be sorted according to a locale using a collator- Specified by:
setCollatorDisabledin interfaceValueMetaInterface- Parameters:
collatorDisabled- the collatorDisabled to set
-
getCollatorLocale
public Locale getCollatorLocale()
Description copied from interface:ValueMetaInterfaceGet the current Locale of the collator- Specified by:
getCollatorLocalein interfaceValueMetaInterface- Returns:
- the current Collator Locale
-
setCollatorLocale
public void setCollatorLocale(Locale locale)
Description copied from interface:ValueMetaInterfaceSets the Locale of the collator- Specified by:
setCollatorLocalein interfaceValueMetaInterface
-
getCollatorStrength
public int getCollatorStrength()
Description copied from interface:ValueMetaInterfaceReturns the strength of the collator.- Specified by:
getCollatorStrengthin interfaceValueMetaInterface- Returns:
- the collatorStrength
-
setCollatorStrength
public void setCollatorStrength(int collatorStrength) throws IllegalArgumentExceptionDescription copied from interface:ValueMetaInterfaceSets the strength of the collator.- Specified by:
setCollatorStrengthin interfaceValueMetaInterface- Parameters:
collatorStrength- the collatorStrength to set- Throws:
IllegalArgumentException
-
isSortedDescending
public boolean isSortedDescending()
Description copied from interface:ValueMetaInterfaceReturns whether or not the value should be sorted in descending order.- Specified by:
isSortedDescendingin interfaceValueMetaInterface- Returns:
- the sortedDescending
-
setSortedDescending
public void setSortedDescending(boolean sortedDescending)
Description copied from interface:ValueMetaInterfaceSets whether or not the value should be set in a descending order.- Specified by:
setSortedDescendingin interfaceValueMetaInterface- Parameters:
sortedDescending- the sortedDescending to set
-
isOutputPaddingEnabled
public boolean isOutputPaddingEnabled()
Description copied from interface:ValueMetaInterfaceReturns true if output padding is enabled (padding to specified length).- Specified by:
isOutputPaddingEnabledin interfaceValueMetaInterface- Returns:
- true if output padding is enabled (padding to specified length)
-
setOutputPaddingEnabled
public void setOutputPaddingEnabled(boolean outputPaddingEnabled)
Description copied from interface:ValueMetaInterfaceSet to true if output padding is to be enabled (padding to specified length).- Specified by:
setOutputPaddingEnabledin interfaceValueMetaInterface- Parameters:
outputPaddingEnabled- Set to true if output padding is to be enabled (padding to specified length)
-
isLargeTextField
public boolean isLargeTextField()
Description copied from interface:ValueMetaInterfaceReturns true if this is a large text field (CLOB, TEXT) with arbitrary length.- Specified by:
isLargeTextFieldin interfaceValueMetaInterface- Returns:
- true if this is a large text field (CLOB, TEXT) with arbitrary length.
-
setLargeTextField
public void setLargeTextField(boolean largeTextField)
Description copied from interface:ValueMetaInterfaceSet to true if the this is to be a large text field (CLOB, TEXT) with arbitrary length.- Specified by:
setLargeTextFieldin interfaceValueMetaInterface- Parameters:
largeTextField- Set to true if this is to be a large text field (CLOB, TEXT) with arbitrary length.
-
isDateFormatLenient
public boolean isDateFormatLenient()
Description copied from interface:ValueMetaInterfaceReturns true of the date format is leniant, false if it is strict.
See alsoValueMetaInterface.setDateFormatLenient(boolean)- Specified by:
isDateFormatLenientin interfaceValueMetaInterface- Returns:
- the dateFormatLenient
-
setDateFormatLenient
public void setDateFormatLenient(boolean dateFormatLenient)
Description copied from interface:ValueMetaInterfaceSet to true if the date formatting (parsing) is to be set to lenient. Being lenient means that the "date format" is tolerant to some formatting errors. For example, a month specified as "15" will be interpreted as "March":
15 - (December = 12) = 3 = March.
Set to false for stricter formatting validation.- Specified by:
setDateFormatLenientin interfaceValueMetaInterface- Parameters:
dateFormatLenient- the dateFormatLenient to set
-
getDateFormatLocale
public Locale getDateFormatLocale()
Description copied from interface:ValueMetaInterfaceReturns the locale from the date format.- Specified by:
getDateFormatLocalein interfaceValueMetaInterface- Returns:
- the dateFormatLocale
-
setDateFormatLocale
public void setDateFormatLocale(Locale dateFormatLocale)
Description copied from interface:ValueMetaInterfaceSets the locale of the date format.- Specified by:
setDateFormatLocalein interfaceValueMetaInterface- Parameters:
dateFormatLocale- the dateFormatLocale to set
-
convertStringToDate
protected Date convertStringToDate(String string) throws KettleValueException
- Throws:
KettleValueException
-
convertDateToBigNumber
protected BigDecimal convertDateToBigNumber(Date date)
-
convertBigNumberToDate
protected Date convertBigNumberToDate(BigDecimal number)
-
convertNumberToString
protected String convertNumberToString(Double number) throws KettleValueException
- Throws:
KettleValueException
-
convertNumberToCompatibleString
protected String convertNumberToCompatibleString(Double number) throws KettleValueException
- Throws:
KettleValueException
-
convertStringToNumber
protected Double convertStringToNumber(String string) throws KettleValueException
- Throws:
KettleValueException
-
getDateFormat
public SimpleDateFormat getDateFormat()
Description copied from interface:ValueMetaInterfaceGets the date format.- Specified by:
getDateFormatin interfaceValueMetaInterface- Returns:
- the date format
-
getDecimalFormat
public DecimalFormat getDecimalFormat()
Description copied from interface:ValueMetaInterfaceGets the decimal format.- Specified by:
getDecimalFormatin interfaceValueMetaInterface- Returns:
- the decimal format
-
getDecimalFormat
public DecimalFormat getDecimalFormat(boolean useBigDecimal)
Description copied from interface:ValueMetaInterfaceGets the decimal format.- Specified by:
getDecimalFormatin interfaceValueMetaInterface- Parameters:
useBigDecimal- the use big decimal- Returns:
- the decimal format
-
getFormatMask
public String getFormatMask()
Description copied from interface:ValueMetaInterfaceGets a formatting mask using this value's meta information.- Specified by:
getFormatMaskin interfaceValueMetaInterface- Returns:
- the format mask.
-
convertIntegerToString
protected String convertIntegerToString(Long integer) throws KettleValueException
- Throws:
KettleValueException
-
convertIntegerToCompatibleString
protected String convertIntegerToCompatibleString(Long integer) throws KettleValueException
- Throws:
KettleValueException
-
convertStringToInteger
protected Long convertStringToInteger(String string) throws KettleValueException
- Throws:
KettleValueException
-
convertBigNumberToString
protected String convertBigNumberToString(BigDecimal number) throws KettleValueException
- Throws:
KettleValueException
-
convertStringToBigNumber
protected BigDecimal convertStringToBigNumber(String string) throws KettleValueException
- Throws:
KettleValueException
-
convertBooleanToBigNumber
protected BigDecimal convertBooleanToBigNumber(Boolean bool)
-
convertBigNumberToBoolean
protected Boolean convertBigNumberToBoolean(BigDecimal number)
-
convertBinaryStringToString
protected String convertBinaryStringToString(byte[] binary) throws KettleValueException
Converts a byte[] stored in a binary string storage type into a String;- Parameters:
binary- the binary string- Returns:
- the String in the correct encoding.
- Throws:
KettleValueException
-
convertToNormalStorageType
public Object convertToNormalStorageType(Object object) throws KettleValueException
Converts the specified data object to the normal storage type.- Specified by:
convertToNormalStorageTypein interfaceValueMetaInterface- Parameters:
object- the data object to convert- Returns:
- the data in a normal storage type
- Throws:
KettleValueException- In case there is a data conversion error.
-
convertToBinaryStringStorageType
public Object convertToBinaryStringStorageType(Object object) throws KettleValueException
Converts the specified data object to the binary string storage type.- Specified by:
convertToBinaryStringStorageTypein interfaceValueMetaInterface- Parameters:
object- the data object to convert- Returns:
- the data in a binary string storage type
- Throws:
KettleValueException- In case there is a data conversion error.
-
convertBinaryStringToNativeType
public Object convertBinaryStringToNativeType(byte[] binary) throws KettleValueException
Convert the binary data to the actual data type.
- byte[] --> Long (Integer) - byte[] --> Double (Number) - byte[] --> BigDecimal (BigNumber) - byte[] --> Date (Date) - byte[] --> Boolean (Boolean) - byte[] --> byte[] (Binary)- Specified by:
convertBinaryStringToNativeTypein interfaceValueMetaInterface- Parameters:
binary-- Returns:
- Throws:
KettleValueException
-
convertNormalStorageTypeToBinaryString
public Object convertNormalStorageTypeToBinaryString(Object object) throws KettleValueException
Description copied from interface:ValueMetaInterfaceConvert a normal storage type to a binary string object. (for comparison reasons)- Specified by:
convertNormalStorageTypeToBinaryStringin interfaceValueMetaInterface- Parameters:
object- The object expressed in a normal storage type- Returns:
- a binary string
- Throws:
KettleValueException- in case there is a data conversion error
-
convertStringToBinaryString
protected byte[] convertStringToBinaryString(String string) throws KettleValueException
- Throws:
KettleValueException
-
cloneValueData
public Object cloneValueData(Object object) throws KettleValueException
Clones the data. Normally, we don't have to do anything here, but just for arguments and safety, we do a little extra work in case of binary blobs and Date objects. We should write a programmers manual later on to specify in all clarity that "we always overwrite/replace values in the Object[] data rows, we never modify them" .- Specified by:
cloneValueDatain interfaceValueMetaInterface- Parameters:
object- the object- Returns:
- a cloned data object if needed
- Throws:
KettleValueException- the kettle value exception
-
getCompatibleString
public String getCompatibleString(Object object) throws KettleValueException
Description copied from interface:ValueMetaInterfaceConvert the supplied data to a String compatible with version 2.5.- Specified by:
getCompatibleStringin interfaceValueMetaInterface- Throws:
KettleValueException
-
getString
public String getString(Object object) throws KettleValueException
Description copied from interface:ValueMetaInterfaceConvert the supplied data to a String- Specified by:
getStringin interfaceValueMetaInterface- Throws:
KettleValueException
-
getNumber
public Double getNumber(Object object) throws KettleValueException
Description copied from interface:ValueMetaInterfaceConvert the supplied data to a Number- Specified by:
getNumberin interfaceValueMetaInterface- Throws:
KettleValueException
-
getInteger
public Long getInteger(Object object) throws KettleValueException
Description copied from interface:ValueMetaInterfaceConvert the supplied data to an Integer- Specified by:
getIntegerin interfaceValueMetaInterface- Throws:
KettleValueException
-
getBigNumber
public BigDecimal getBigNumber(Object object) throws KettleValueException
Description copied from interface:ValueMetaInterfaceConvert the supplied data to a BigNumber- Specified by:
getBigNumberin interfaceValueMetaInterface- Throws:
KettleValueException
-
getBoolean
public Boolean getBoolean(Object object) throws KettleValueException
Description copied from interface:ValueMetaInterfaceConvert the supplied data to a Boolean- Specified by:
getBooleanin interfaceValueMetaInterface- Throws:
KettleValueException
-
getDate
public Date getDate(Object object) throws KettleValueException
Description copied from interface:ValueMetaInterfaceConvert the supplied data to a Date- Specified by:
getDatein interfaceValueMetaInterface- Throws:
KettleValueException
-
getBinary
public byte[] getBinary(Object object) throws KettleValueException
Description copied from interface:ValueMetaInterfaceConvert the supplied data to binary data- Specified by:
getBinaryin interfaceValueMetaInterface- Throws:
KettleValueException
-
getBinaryString
public byte[] getBinaryString(Object object) throws KettleValueException
Description copied from interface:ValueMetaInterfaceconvert the supplied data to a binary string representation (for writing text)- Specified by:
getBinaryStringin interfaceValueMetaInterface- Throws:
KettleValueException
-
isString
public boolean isString()
Checks whether or not the value is a String.- Specified by:
isStringin interfaceValueMetaInterface- Returns:
- true if the value is a String.
-
isDate
public boolean isDate()
Checks whether or not this value is a Date- Specified by:
isDatein interfaceValueMetaInterface- Returns:
- true if the value is a Date
-
isBigNumber
public boolean isBigNumber()
Checks whether or not the value is a Big Number- Specified by:
isBigNumberin interfaceValueMetaInterface- Returns:
- true is this value is a big number
-
isNumber
public boolean isNumber()
Checks whether or not the value is a Number- Specified by:
isNumberin interfaceValueMetaInterface- Returns:
- true is this value is a number
-
isBoolean
public boolean isBoolean()
Checks whether or not this value is a boolean- Specified by:
isBooleanin interfaceValueMetaInterface- Returns:
- true if this value has type boolean.
-
isSerializableType
public boolean isSerializableType()
Checks whether or not this value is of type Serializable- Specified by:
isSerializableTypein interfaceValueMetaInterface- Returns:
- true if this value has type Serializable
-
isBinary
public boolean isBinary()
Checks whether or not this value is of type Binary- Specified by:
isBinaryin interfaceValueMetaInterface- Returns:
- true if this value has type Binary
-
isInteger
public boolean isInteger()
Checks whether or not this value is an Integer- Specified by:
isIntegerin interfaceValueMetaInterface- Returns:
- true if this value is an integer
-
isNumeric
public boolean isNumeric()
Checks whether or not this Value is Numeric A Value is numeric if it is either of type Number or Integer- Specified by:
isNumericin interfaceValueMetaInterface- Returns:
- true if the value is either of type Number or Integer
-
isNumeric
public static final boolean isNumeric(int t)
Checks whether or not the specified type is either Integer or Number- Parameters:
t- the type to check- Returns:
- true if the type is Integer or Number
-
isSortedAscending
public boolean isSortedAscending()
-
getTypeDesc
public String getTypeDesc()
Return the type of a value in a textual form: "String", "Number", "Integer", "Boolean", "Date", ...- Specified by:
getTypeDescin interfaceValueMetaInterface- Returns:
- A String describing the type of value.
-
getStorageTypeDesc
public String getStorageTypeDesc()
Return the storage type of a value in a textual form: "normal", "binary-string", "indexes"- Returns:
- A String describing the storage type of the value metadata
-
toStringMeta
public String toStringMeta()
a String text representation of this Value, optionally padded to the specified length- Specified by:
toStringMetain interfaceValueMetaInterface- Returns:
- a String text representation of this Value, optionally padded to the specified length
-
writeData
public void writeData(DataOutputStream outputStream, Object object) throws KettleFileException
Description copied from interface:ValueMetaInterfaceSerialize the content of the specified data object to the outputStream. No metadata is written.- Specified by:
writeDatain interfaceValueMetaInterface- Parameters:
outputStream- the outputstream to write toobject- the data object to serialize- Throws:
KettleFileException- in case a I/O error occurs
-
readData
public Object readData(DataInputStream inputStream) throws KettleFileException, KettleEOFException, SocketTimeoutException
Description copied from interface:ValueMetaInterfaceDe-serialize data from an inputstream. No metadata is read or changed.- Specified by:
readDatain interfaceValueMetaInterface- Parameters:
inputStream- the input stream to read from- Returns:
- a new data object
- Throws:
KettleFileException- in case a I/O error occursKettleEOFException- When we have read all the data there is to readSocketTimeoutException- In case there is a timeout (when set on a socket) during reading
-
writeString
protected void writeString(DataOutputStream outputStream, String string) throws IOException
- Throws:
IOException
-
writeBinaryString
protected void writeBinaryString(DataOutputStream outputStream, byte[] binaryString) throws IOException
- Throws:
IOException
-
readString
protected String readString(DataInputStream inputStream) throws IOException
- Throws:
IOException
-
readBinaryString
protected byte[] readBinaryString(DataInputStream inputStream) throws IOException
- Throws:
IOException
-
writeBigNumber
protected void writeBigNumber(DataOutputStream outputStream, BigDecimal number) throws IOException
- Throws:
IOException
-
readBigNumber
protected BigDecimal readBigNumber(DataInputStream inputStream) throws IOException
- Throws:
IOException
-
writeDate
protected void writeDate(DataOutputStream outputStream, Date date) throws IOException
- Throws:
IOException
-
readDate
protected Date readDate(DataInputStream inputStream) throws IOException
- Throws:
IOException
-
writeBoolean
protected void writeBoolean(DataOutputStream outputStream, Boolean bool) throws IOException
- Throws:
IOException
-
readBoolean
protected Boolean readBoolean(DataInputStream inputStream) throws IOException
- Throws:
IOException
-
writeNumber
protected void writeNumber(DataOutputStream outputStream, Double number) throws IOException
- Throws:
IOException
-
readNumber
protected Double readNumber(DataInputStream inputStream) throws IOException
- Throws:
IOException
-
writeInteger
protected void writeInteger(DataOutputStream outputStream, Long number) throws IOException
- Throws:
IOException
-
readInteger
protected Long readInteger(DataInputStream inputStream) throws IOException
- Throws:
IOException
-
writeInteger
protected void writeInteger(DataOutputStream outputStream, Integer number) throws IOException
- Throws:
IOException
-
readSmallInteger
protected Integer readSmallInteger(DataInputStream inputStream) throws IOException
- Throws:
IOException
-
writeBinary
protected void writeBinary(DataOutputStream outputStream, byte[] binary) throws IOException
- Throws:
IOException
-
readBinary
protected byte[] readBinary(DataInputStream inputStream) throws IOException
- Throws:
IOException
-
writeMeta
public void writeMeta(DataOutputStream outputStream) throws KettleFileException
Description copied from interface:ValueMetaInterfaceWrite the content of this class (metadata) to the specified output stream.- Specified by:
writeMetain interfaceValueMetaInterface- Parameters:
outputStream- the outputstream to write to- Throws:
KettleFileException- in case a I/O error occurs
-
readMetaData
public void readMetaData(DataInputStream inputStream) throws KettleFileException, KettleEOFException
Load the attributes of this particular value meta object from the input stream. Loading the type is not handled here, this should be read from the stream previously!- Specified by:
readMetaDatain interfaceValueMetaInterface- Parameters:
inputStream- the input stream to read from- Throws:
KettleFileException- In case there was a IO problemKettleEOFException- If we reached the end of the stream
-
getMetaXML
public String getMetaXML() throws IOException
Description copied from interface:ValueMetaInterfaceReturns an XML representation of the row metadata.- Specified by:
getMetaXMLin interfaceValueMetaInterface- Returns:
- an XML representation of the row metadata
- Throws:
IOException- Thrown in case there is an (Base64/GZip) decoding problem
-
getDataXML
public String getDataXML(Object object) throws IOException
Description copied from interface:ValueMetaInterfaceReturns an XML representation of the row data.- Specified by:
getDataXMLin interfaceValueMetaInterface- Parameters:
object- The data to serialize as XML- Returns:
- an XML representation of the row data
- Throws:
IOException- Thrown in case there is an (Base64/GZip) decoding problem
-
getValue
public Object getValue(Node node) throws KettleException
Convert a data XML node to an Object that corresponds to the metadata. This is basically String to Object conversion that is being done.- Specified by:
getValuein interfaceValueMetaInterface- Parameters:
node- the node to retrieve the data value from- Returns:
- the converted data value
- Throws:
IOException- thrown in case there is a problem with the XML to object conversionKettleException- thrown in case there is a problem with the XML to object conversion
-
getTypes
public static final String[] getTypes()
get an array of String describing the possible types a Value can have.- Returns:
- an array of String describing the possible types a Value can have.
-
getAllTypes
public static final String[] getAllTypes()
Get an array of String describing the possible types a Value can have.- Returns:
- an array of String describing the possible types a Value can have.
-
getTypeDesc
public static final String getTypeDesc(int type)
TODO: change Desc to Code all over the place. Make sure we can localise this stuff later on.- Parameters:
type- the type- Returns:
- the description (code) of the type
-
getType
public static final int getType(String desc)
Convert the String description of a type to an integer type.- Parameters:
desc- The description of the type to convert- Returns:
- The integer type of the given String. (ValueMetaInterface.TYPE_...)
-
getStorageType
public static final int getStorageType(String desc)
Convert the String description of a storage type to an integer type.- Parameters:
desc- The description of the storage type to convert- Returns:
- The integer storage type of the given String. (ValueMetaInterface.STORAGE_TYPE_...) or -1 if the storage type code not be found.
-
getStorageTypeCode
public static final String getStorageTypeCode(int storageType)
-
isNull
public boolean isNull(Object data) throws KettleValueException
Determine if an object is null. This is the case if data==null or if it's an empty string.- Specified by:
isNullin interfaceValueMetaInterface- Parameters:
data- the object to test- Returns:
- true if the object is considered null.
- Throws:
KettleValueException- in case there is a conversion error (only thrown in case of lazy conversion)
-
compare
public int compare(Object data1, Object data2) throws KettleValueException
Compare 2 values of the same data type- Specified by:
comparein interfaceValueMetaInterface- Parameters:
data1- the first valuedata2- the second value- Returns:
- 0 if the values are equal, -1 if data1 is smaller than data2 and +1 if it's larger.
- Throws:
KettleValueException- In case we get conversion errors
-
compare
public int compare(Object data1, ValueMetaInterface meta2, Object data2) throws KettleValueException
Compare 2 values of the same data type- Specified by:
comparein interfaceValueMetaInterface- Parameters:
data1- the first valuemeta2- the second value's metadatadata2- the second value- Returns:
- 0 if the values are equal, -1 if data1 is smaller than data2 and +1 if it's larger.
- Throws:
KettleValueException- In case we get conversion errors
-
convertData
public Object convertData(ValueMetaInterface meta2, Object data2) throws KettleValueException
Convert the specified data to the data type specified in this object.- Specified by:
convertDatain interfaceValueMetaInterface- Parameters:
meta2- the metadata of the object to be converteddata2- the data of the object to be converted- Returns:
- the object in the data type of this value metadata object
- Throws:
KettleValueException- in case there is a data conversion error
-
convertDataCompatible
public Object convertDataCompatible(ValueMetaInterface meta2, Object data2) throws KettleValueException
Convert the specified data to the data type specified in this object. For String conversion, be compatible with version 2.5.2.- Specified by:
convertDataCompatiblein interfaceValueMetaInterface- Parameters:
meta2- the metadata of the object to be converteddata2- the data of the object to be converted- Returns:
- the object in the data type of this value metadata object
- Throws:
KettleValueException- in case there is a data conversion error
-
convertDataUsingConversionMetaData
public Object convertDataUsingConversionMetaData(Object data) throws KettleValueException
Convert an object to the data type specified in the conversion metadata- Specified by:
convertDataUsingConversionMetaDatain interfaceValueMetaInterface- Parameters:
data- The data- Returns:
- The data converted to the storage data type
- Throws:
KettleValueException- in case there is a conversion error.
-
convertDataFromString
public Object convertDataFromString(String pol, ValueMetaInterface convertMeta, String nullIf, String ifNull, int trim_type) throws KettleValueException
Convert the specified string to the data type specified in this object.- Specified by:
convertDataFromStringin interfaceValueMetaInterface- Parameters:
pol- the string to be convertedconvertMeta- the metadata of the object (only string type) to be convertednullIf- set the object to null if pos equals nullif (IgnoreCase)ifNull- set the object to ifNull when pol is empty or nulltrim_type- the trim type to be used (ValueMetaInterface.TRIM_TYPE_XXX)- Returns:
- the object in the data type of this value metadata object
- Throws:
KettleValueException- in case there is a data conversion error
-
hashCode
public int hashCode(Object object) throws KettleValueException
Calculate the hashcode of the specified data object- Specified by:
hashCodein interfaceValueMetaInterface- Parameters:
object- the data value to calculate a hashcode for- Returns:
- the calculated hashcode
- Throws:
KettleValueException
-
createOriginalValue
public Value createOriginalValue(Object data) throws KettleValueException
Create an old-style value for backward compatibility reasons- Specified by:
createOriginalValuein interfaceValueMetaInterface- Parameters:
data- the data to store in the value- Returns:
- a newly created Value object
- Throws:
KettleValueException- case there is a data conversion problem
-
getValueData
public Object getValueData(Value value) throws KettleValueException
Extracts the primitive data from an old style Value object- Specified by:
getValueDatain interfaceValueMetaInterface- Parameters:
value- the old style Value object- Returns:
- the value's data, NOT the meta data.
- Throws:
KettleValueException- case there is a data conversion problem
-
getStorageMetadata
public ValueMetaInterface getStorageMetadata()
Description copied from interface:ValueMetaInterfaceReturns the storage Meta data that is needed for internal conversion from BinaryString or String to the specified type. This storage Meta data object survives cloning and should travel through the transformation unchanged as long as the data type remains the same.- Specified by:
getStorageMetadatain interfaceValueMetaInterface- Returns:
- the storageMetadata
-
setStorageMetadata
public void setStorageMetadata(ValueMetaInterface storageMetadata)
Description copied from interface:ValueMetaInterfaceSets the storage meta data.- Specified by:
setStorageMetadatain interfaceValueMetaInterface- Parameters:
storageMetadata- the storageMetadata to set
-
compareStorageAndActualFormat
protected void compareStorageAndActualFormat()
-
getTrimType
public int getTrimType()
Description copied from interface:ValueMetaInterfaceGets the trim type.- Specified by:
getTrimTypein interfaceValueMetaInterface- Returns:
- the trimType
-
setTrimType
public void setTrimType(int trimType)
Description copied from interface:ValueMetaInterfaceSets the trim type.- Specified by:
setTrimTypein interfaceValueMetaInterface- Parameters:
trimType- the trimType to set
-
getTrimTypeByCode
public static final int getTrimTypeByCode(String tt)
-
getTrimTypeByDesc
public static final int getTrimTypeByDesc(String tt)
-
getTrimTypeCode
public static final String getTrimTypeCode(int i)
-
getTrimTypeDesc
public static final String getTrimTypeDesc(int i)
-
getConversionMetadata
public ValueMetaInterface getConversionMetadata()
Description copied from interface:ValueMetaInterfaceThis conversion metadata can be attached to a String object to see where it came from and with which mask it was generated, the encoding, the local languages used, padding, etc.- Specified by:
getConversionMetadatain interfaceValueMetaInterface- Returns:
- the conversionMetadata
-
setConversionMetadata
public void setConversionMetadata(ValueMetaInterface conversionMetadata)
Description copied from interface:ValueMetaInterfaceAttach conversion metadata to a String object to see where it came from and with which mask it was generated, the encoding, the local languages used, padding, etc.- Specified by:
setConversionMetadatain interfaceValueMetaInterface- Parameters:
conversionMetadata- the conversionMetadata to set
-
isSingleByteEncoding
public boolean isSingleByteEncoding()
- Specified by:
isSingleByteEncodingin interfaceValueMetaInterface- Returns:
- true if the String encoding used (storage) is single byte encoded.
-
getNumberOfBinaryStringConversions
public long getNumberOfBinaryStringConversions()
Description copied from interface:ValueMetaInterfaceReturns the number of binary string to native data type conversions done with this object conversions- Specified by:
getNumberOfBinaryStringConversionsin interfaceValueMetaInterface- Returns:
- the number of binary string to native data type conversions done with this object conversions
-
setNumberOfBinaryStringConversions
public void setNumberOfBinaryStringConversions(long numberOfBinaryStringConversions)
Description copied from interface:ValueMetaInterfaceReturns the number of binary string to native data type done with this object conversions to set.- Specified by:
setNumberOfBinaryStringConversionsin interfaceValueMetaInterface- Parameters:
numberOfBinaryStringConversions- the number of binary string to native data type done with this object conversions to set
-
isOriginalAutoIncrement
public boolean isOriginalAutoIncrement()
Description copied from interface:ValueMetaInterfaceChecks if is original auto increment.- Specified by:
isOriginalAutoIncrementin interfaceValueMetaInterface- Returns:
- true, if is original auto increment
-
setOriginalAutoIncrement
public void setOriginalAutoIncrement(boolean originalAutoIncrement)
Description copied from interface:ValueMetaInterfaceSets the original auto increment.- Specified by:
setOriginalAutoIncrementin interfaceValueMetaInterface- Parameters:
originalAutoIncrement- the new original auto increment
-
getOriginalColumnType
public int getOriginalColumnType()
Description copied from interface:ValueMetaInterfacestore original JDBC RecordSetMetaData for later use- Specified by:
getOriginalColumnTypein interfaceValueMetaInterface- See Also:
ResultSetMetaData
-
setOriginalColumnType
public void setOriginalColumnType(int originalColumnType)
Description copied from interface:ValueMetaInterfaceSets the original column type.- Specified by:
setOriginalColumnTypein interfaceValueMetaInterface- Parameters:
originalColumnType- the new original column type
-
getOriginalColumnTypeName
public String getOriginalColumnTypeName()
Description copied from interface:ValueMetaInterfaceGets the original column type name.- Specified by:
getOriginalColumnTypeNamein interfaceValueMetaInterface- Returns:
- the original column type name
-
setOriginalColumnTypeName
public void setOriginalColumnTypeName(String originalColumnTypeName)
Description copied from interface:ValueMetaInterfaceSets the original column type name.- Specified by:
setOriginalColumnTypeNamein interfaceValueMetaInterface- Parameters:
originalColumnTypeName- the new original column type name
-
isOriginalNullable
public int isOriginalNullable()
Description copied from interface:ValueMetaInterfaceChecks if is original nullable.- Specified by:
isOriginalNullablein interfaceValueMetaInterface- Returns:
- the int
-
setOriginalNullable
public void setOriginalNullable(int originalNullable)
Description copied from interface:ValueMetaInterfaceSets the original nullable.- Specified by:
setOriginalNullablein interfaceValueMetaInterface- Parameters:
originalNullable- the new original nullable
-
getOriginalPrecision
public int getOriginalPrecision()
Description copied from interface:ValueMetaInterfaceGets the original precision.- Specified by:
getOriginalPrecisionin interfaceValueMetaInterface- Returns:
- the original precision
-
setOriginalPrecision
public void setOriginalPrecision(int originalPrecision)
Description copied from interface:ValueMetaInterfaceSets the original precision.- Specified by:
setOriginalPrecisionin interfaceValueMetaInterface- Parameters:
originalPrecision- the new original precision
-
getOriginalScale
public int getOriginalScale()
Description copied from interface:ValueMetaInterfaceGets the original scale.- Specified by:
getOriginalScalein interfaceValueMetaInterface- Returns:
- the original scale
-
getOriginalNullable
public int getOriginalNullable()
Description copied from interface:ValueMetaInterfaceGets the original nullable.- Specified by:
getOriginalNullablein interfaceValueMetaInterface- Returns:
- the original nullable
-
getOriginalSigned
public boolean getOriginalSigned()
Description copied from interface:ValueMetaInterfaceGets the original signed.- Specified by:
getOriginalSignedin interfaceValueMetaInterface- Returns:
- the original signed
-
setOriginalScale
public void setOriginalScale(int originalScale)
Description copied from interface:ValueMetaInterfaceSets the original scale.- Specified by:
setOriginalScalein interfaceValueMetaInterface- Parameters:
originalScale- the new original scale
-
isOriginalSigned
public boolean isOriginalSigned()
Description copied from interface:ValueMetaInterfaceChecks if is original signed.- Specified by:
isOriginalSignedin interfaceValueMetaInterface- Returns:
- true, if is original signed
-
setOriginalSigned
public void setOriginalSigned(boolean originalSigned)
Description copied from interface:ValueMetaInterfaceSets the original signed.- Specified by:
setOriginalSignedin interfaceValueMetaInterface- Parameters:
originalSigned- the new original signed
-
isBigNumberFormatting
public boolean isBigNumberFormatting()
- Returns:
- the bigNumberFormatting flag : true if BigNumbers of formatted as well
-
setBigNumberFormatting
public void setBigNumberFormatting(boolean bigNumberFormatting)
- Parameters:
bigNumberFormatting- the bigNumberFormatting flag to set : true if BigNumbers of formatted as well
-
getTrimTypeCodes
public static String[] getTrimTypeCodes()
- Returns:
- The available trim type codes (NOT localized, use for persistence)
-
getTrimTypeDescriptions
public static String[] getTrimTypeDescriptions()
- Returns:
- The available trim type descriptions (localized)
-
requiresRealClone
public boolean requiresRealClone()
Description copied from interface:ValueMetaInterfaceReturns true if the data type requires a real copy. Usually a binary or Serializable object.- Specified by:
requiresRealClonein interfaceValueMetaInterface- Returns:
- boolean
-
isLenientStringToNumber
public boolean isLenientStringToNumber()
- Specified by:
isLenientStringToNumberin interfaceValueMetaInterface- Returns:
- the lenientStringToNumber
-
setLenientStringToNumber
public void setLenientStringToNumber(boolean lenientStringToNumber)
- Specified by:
setLenientStringToNumberin interfaceValueMetaInterface- Parameters:
lenientStringToNumber- the lenientStringToNumber to set
-
getDateFormatTimeZone
public TimeZone getDateFormatTimeZone()
- Specified by:
getDateFormatTimeZonein interfaceValueMetaInterface- Returns:
- the date format time zone
-
setDateFormatTimeZone
public void setDateFormatTimeZone(TimeZone dateFormatTimeZone)
- Specified by:
setDateFormatTimeZonein interfaceValueMetaInterface- Parameters:
dateFormatTimeZone- the date format time zone to set
-
isIgnoreWhitespace
public boolean isIgnoreWhitespace()
Description copied from interface:ValueMetaInterfaceIs Ignore Whitespace Only applicable for TYPE_STRING comparisons- Specified by:
isIgnoreWhitespacein interfaceValueMetaInterface- Returns:
- true if whitespace should be ignored during string comparison
-
setIgnoreWhitespace
public void setIgnoreWhitespace(boolean ignoreWhitespace)
Description copied from interface:ValueMetaInterfaceSet Ignore Whitespace Only applicable for TYPE_STRING comparisons- Specified by:
setIgnoreWhitespacein interfaceValueMetaInterface- Parameters:
ignoreWhitespace- true if whitespace should be ignored during string comparison
-
drawValue
public void drawValue(PrimitiveGCInterface gc, Object value) throws KettleValueException
Description copied from interface:ValueMetaInterfaceThis method draws the value using the supplied graphical context.- Specified by:
drawValuein interfaceValueMetaInterface- Parameters:
gc- The graphical context to draw on.- Throws:
KettleValueException
-
getValueFromSQLType
public ValueMetaInterface getValueFromSQLType(DatabaseMeta databaseMeta, String name, ResultSetMetaData rm, int index, boolean ignoreLength, boolean lazyConversion) throws KettleDatabaseException
Description copied from interface:ValueMetaInterfaceInvestigate JDBC result set metadata at the specified index. If this value metadata is interested in handling this SQL type, it should return the value meta. Otherwise it should return null.- Specified by:
getValueFromSQLTypein interfaceValueMetaInterface- Parameters:
databaseMeta- the database metadata to reference capabilities and so on.name- The name of the new valuerm- The result metadata to investigateindex- The index to look at (1-based)ignoreLength- Don't look at the lengthlazyConversion- use lazy conversion- Returns:
- The value metadata if this value should handle the SQL type at the specified index.
- Throws:
KettleDatabaseException- In case something went wrong.
-
getOriginalColumnMetadata
protected void getOriginalColumnMetadata(ValueMetaInterface v, ResultSetMetaData rm, int index, boolean ignoreLength) throws SQLException
- Throws:
SQLException
-
getMetadataPreview
public ValueMetaInterface getMetadataPreview(DatabaseMeta databaseMeta, ResultSet rs) throws KettleDatabaseException
Description copied from interface:ValueMetaInterfaceThis is a similar method to getValueFromSQLType, but it uses a ResultSet from a call to DatabaseMetaData#getColumns(String, String, String, String) The ResultSet must be positioned correctly on the row to read.Note that the ValueMeta returned by this RowMeta may not contain actual values. This is a lightweight call using only JDBC metadata and does not make use of SQL statements.
- Specified by:
getMetadataPreviewin interfaceValueMetaInterface- Parameters:
databaseMeta- the database metadata to reference capabilities and so on.rs- A ResultSet from getColumns, positioned correctly on a column to read.- Throws:
KettleDatabaseException
-
getValueFromResultSet
public Object getValueFromResultSet(DatabaseInterface databaseInterface, ResultSet resultSet, int index) throws KettleDatabaseException
Get a value from a result set column based on the current value metadata- Specified by:
getValueFromResultSetin interfaceValueMetaInterface- Parameters:
databaseInterface- the database metadata to useresultSet- The JDBC result set to read fromindex- The column index (1-based)- Returns:
- The Kettle native data type based on the value metadata
- Throws:
KettleDatabaseException- in case something goes wrong.
-
setPreparedStatementValue
public void setPreparedStatementValue(DatabaseMeta databaseMeta, PreparedStatement preparedStatement, int index, Object data) throws KettleDatabaseException
Description copied from interface:ValueMetaInterfaceSet a value on a JDBC prepared statement on the specified position- Specified by:
setPreparedStatementValuein interfaceValueMetaInterface- Parameters:
databaseMeta- the database metadata to referencepreparedStatement- The prepared statementindex- the column index (1-based)data- the value to set- Throws:
KettleDatabaseException- in case something goes wrong
-
getNativeDataType
public Object getNativeDataType(Object object) throws KettleValueException
Description copied from interface:ValueMetaInterfaceThis method gives you the native Java data type corresponding to the value meta-data. Conversions from other storage types and other operations are done automatically according to the specified value meta-data.- Specified by:
getNativeDataTypein interfaceValueMetaInterface- Parameters:
object- The input data- Returns:
- The native data type
- Throws:
KettleValueException- in case there is an unexpected data conversion error.
-
getDatabaseColumnTypeDefinition
public String getDatabaseColumnTypeDefinition(DatabaseInterface databaseInterface, String tk, String pk, boolean use_autoinc, boolean add_fieldname, boolean add_cr)
Description copied from interface:ValueMetaInterfaceAsk for suggestions as to how this plugin data type should be represented in the specified database interface- Specified by:
getDatabaseColumnTypeDefinitionin interfaceValueMetaInterface- Parameters:
databaseInterface- The database type/dialect to get the column type definition fortk- Is this a technical key field?pk- Is this a primary key field?use_autoinc- Use auto-increment?add_fieldname- add the fieldname to the column type definition?add_cr- add a cariage return to the string?- Returns:
- The field type definition
-
getNativeDataTypeClass
public Class<?> getNativeDataTypeClass() throws KettleValueException
Description copied from interface:ValueMetaInterfaceReturn the Java class that represents the "native" storage type of this ValueMeta- Specified by:
getNativeDataTypeClassin interfaceValueMetaInterface- Returns:
- A Java class
- Throws:
KettleValueException
-
-