Package org.pentaho.di.compatibility
Class Value
- java.lang.Object
-
- org.pentaho.di.compatibility.Value
-
- All Implemented Interfaces:
Serializable,Cloneable,XMLInterface
public class Value extends Object implements Cloneable, XMLInterface, Serializable
This class is one of the core classes of the Kettle framework. It contains everything you need to manipulate atomic data (Values/Fields/...) and to describe it in the form of meta-data. (name, length, precision, etc.)- Since:
- Beginning 2003
- Author:
- Matt
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static intVALUE_TYPE_BIGNUMBERValue type indicating that the value contains a floating point precision number with arbitrary precision.static intVALUE_TYPE_BINARYValue type indicating that the value contains binary data: BLOB, CLOB, ...static intVALUE_TYPE_BOOLEANValue type indicating that the value contains a boolean.static intVALUE_TYPE_DATEValue type indicating that the value contains a Date.static intVALUE_TYPE_INTEGERValue type indicating that the value contains a long integer.static intVALUE_TYPE_NONEValue type indicating that the value has no type set.static intVALUE_TYPE_NUMBERValue type indicating that the value contains a floating point double precision number.static intVALUE_TYPE_SERIALIZABLEValue type indicating that the value contains an Object.static intVALUE_TYPE_STRINGValue type indicating that the value contains a text String.static StringXML_TAG
-
Constructor Summary
Constructors Constructor Description Value()Constructs a new Value of type EMPTYValue(InputStream is)Read the Value, including meta-data from a DataInputStreamValue(String name)Constructs a new Value with a name.Value(String name, boolean bool)Constructs a new Value of Type VALUE_TYPE_BOOLEAN, with a name, containing a boolean valueValue(String name, byte[] b)Constructs a new Value of Type VALUE_TYPE_BINARY, with a name, containing a bytes valueValue(String name, double num)Constructs a new Value of Type VALUE_TYPE_NUMBER, with a name, containing a numberValue(String name, int val_type)Constructs a new Value with a name and a type.Value(String name, int valType, int length, int precision)Constructs a new Value with a name, a type, length and precision.Value(String name, long l)Constructs a new Value of Type VALUE_TYPE_INTEGER, with a name, containing an integer numberValue(String name, String str)Constructs a new Value of Type VALUE_TYPE_STRING, with a name, containing a StringValue(String name, StringBuffer str)Constructs a new Value of Type VALUE_TYPE_STRING, with a name, containing a StringValue(String name, StringBuilder str)Constructs a new Value of Type VALUE_TYPE_STRING, with a name, containing a StringValue(String name, BigDecimal bignum)Constructs a new Value of Type VALUE_TYPE_BIGNUMBER, with a name, containing a BigDecimal numberValue(String name, Date dat)Constructs a new Value of Type VALUE_TYPE_DATE, with a name, containing a DateValue(String name, Value v)Constructs a new Value as a copy of another value and renames it...Value(Value v)Constructs a new Value as a copy of another valueValue(Value metaData, DataInputStream dis)Read the data of a Value from a DataInputStream, the meta-data of the value has to be set before calling this method!Value(Node valnode)Construct a new Value and read the data from XML
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Valueabs()Valueacos()Valueadd_days(long days)Add a number of days to a Date value.Valueadd_months(int months)Valueand(Value v)Valueasin()Valueatan()Valueatan2(double arg0)Valueatan2(Value arg0)Valuebool_and(Value v)Valuebool_not()Valuebool_or(Value v)Valuebool_xor(Value v)ValuebyteToHexEncode()Change a string into its hexadecimal representation.Valueceil()ValuecharToHexEncode()Change a string into its hexadecimal representation.voidclearValue()Clears the content and name of a ValueObjectclone()ValueClone()Build a copy of this Valueintcompare(Value v)Compare 2 values of the same or different type! The comparison of Strings is case insensitiveintcompare(Value v, boolean caseInsensitive)Compare 2 values of the same or different type!voidconvertString(int newtype)Convert this Value from type String to another typeValuecos()Valuedat2num()Valuedat2str()Valuedat2str(String arg0)Valuedat2str(String arg0, String arg1)Valuedifferent(Value v)Valuedivide(byte v)Valuedivide(double v)Valuedivide(int v)Valuedivide(long v)Valuedivide(BigDecimal v)Valuedivide(Value v)Valuee()Valueequal(Value v)booleanequals(Object v)booleanequalValueType(Value v)booleanequalValueType(Value v, boolean checkTypeOnly)Returns whether "types" of the values are exactly the same: type, name, length, precision.Valueexp()Valuefirst_day()Valuefloor()static String[]getAllTypes()Get an array of String describing the possible types a Value can have.BigDecimalgetBigNumber()Get the BigDecimal number of this Value.booleangetBoolean()Get the boolean value of this Value.byte[]getBytes()StringgetClassName()DategetDate()Get the Date of this Value.static ValuegetInstance()longgetInteger()Get the long integer representation of this value.intgetLength()Get the length of this Value.StringgetName()Obtain the name of a ValuedoublegetNumber()Get the double precision floating point number of this Value.StringgetOrigin()Obtain the origin of the step.intgetPrecision()get the precision of this ValueSerializablegetSerializable()Get the Serializable of this Value.StringgetString()Get the String text representing this value.intgetStringLength()Get the length of the String representing this value.intgetType()Returns the type of this Valuestatic 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 t)Return the type of a value in a textual form: "String", "Number", "Integer", "Boolean", "Date", ...static String[]getTypes()get an array of String describing the possible types a Value can have.ValueInterfacegetValueInterface()StringgetXML()Produce the XML representation of this value.Valuegreater(Value v)Valuegreater_equal(Value v)inthashCode()ValuehexToByteDecode()Change a hexadecimal string into normal ASCII representation.ValuehexToCharDecode()Change a hexadecimal string into normal ASCII representation.Valueinitcap()booleanisBigNumber()Checks whether or not the value is a Big NumberbooleanisBinary()Checks whether or not this value is of type BinarybooleanisBoolean()Checks whether or not this value is a booleanbooleanisDate()Checks whether or not this value is a DatebooleanisEmpty()Checks whether or not this Value is empty.booleanisEqualTo(byte number)Check whether this value is equal to the Integer supplied.booleanisEqualTo(double number)Check whether this value is equal to the Number supplied.booleanisEqualTo(int number)Check whether this value is equal to the Integer supplied.booleanisEqualTo(long number)Check whether this value is equal to the Integer supplied.booleanisEqualTo(String string)Check whether this value is equal to the String supplied.booleanisEqualTo(BigDecimal number)Check whether this value is equal to the BigDecimal supplied.booleanisEqualTo(Date date)Check whether this value is equal to the Date supplied.booleanisInteger()Checks whether or not this value is an IntegerbooleanisNull()Checks wheter or not a value 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 NumberbooleanisSerializableType()Checks whether or not this value is of type SerializablebooleanisString()Checks wheter or not the value is a String.voidjsConstructor()voidjsConstructor(String name)voidjsConstructor(String name, String value)Valuelast_day()Valueleftstr(int len)Valueleftstr(Value len)Valuelength()Valuelike(Value v)booleanloadXML(Node valnode)Read the data for this Value from an XML NodeValuelog()Valuelower()Valuelpad(int len)Valuelpad(int len, String padstr)Valuelpad(Value len)Valuelpad(Value len, Value padstr)Valueltrim()voidmerge(Value other)Merges another Value.Valueminus(byte v)Valueminus(double v)Valueminus(int v)Valueminus(long v)Valueminus(BigDecimal v)Valueminus(Value v)Valuemod(byte arg)Valuemod(double arg0)Valuemod(int arg)Valuemod(long arg)Valuemod(BigDecimal arg)Valuemod(Value arg)Valuemultiply(byte v)Valuemultiply(double v)Valuemultiply(int v)Valuemultiply(long v)Valuemultiply(BigDecimal v)Valuemultiply(Value v)Valuenum2dat()Valuenum2str()Valuenum2str(String format)Valuenum2str(String format, String decimalSymbol)Valuenum2str(String format, String decimalSymbol, String groupingSymbol)Valuenum2str(String format, String decimalSymbol, String groupingSymbol, String currencySymbol)Valuenvl(Value alt)Valueor(Value v)Valuepi()Valueplus(byte v)Valueplus(double v)Valueplus(int v)Valueplus(long v)Valueplus(BigDecimal v)Valueplus(Value v)Valuepower(double arg)Valuepower(BigDecimal arg)Valuepower(Value v)voidreadObj(DataInputStream dis)Read the metadata and data for this Value object from the specified data input streamValuereplace(String repl, String with)Valuereplace(Value repl, Value with)Valuerightstr(int len)Valuerightstr(Value len)Valueround()Rounds off to the nearest integer.Valueround(int decimalPlaces)Rounds the Number value to a certain number decimal places.Valuerpad(int len)Valuerpad(int len, String padstr)Valuerpad(Value len)Valuerpad(Value len, Value padstr)Valuertrim()voidsetLength(int l)Sets the length of the Number, Integer or String to the specified length Note: no truncation of the value takes place, this is meta-data only!voidsetLength(int l, int p)Sets the length and the precision of the Number, Integer or String to the specified length & precision Note: no truncation of the value takes place, this is meta-data only!voidsetName(String name)Sets the name of a ValuevoidsetNull()Sets the Value to null, no type is being changed.voidsetNull(boolean n)Sets or unsets a value to null, no type is being changed.voidsetOrigin(String step_of_origin)This method allows you to set the origin of the Value by means of the name of the originating step.voidsetPrecision(int p)Sets the precision of this Value Note: no rounding or truncation takes place, this is meta-data only!voidsetSerializedValue(Serializable ser)voidsetType(int val_type)Set the type of this ValuevoidsetValue(boolean bool)Sets the Value to a booleanvoidsetValue(byte b)Sets the Value to a long integervoidsetValue(byte[] b)Sets the Value to a byte arrayvoidsetValue(double num)Sets the value to a double Number value.voidsetValue(int i)Sets the Value to a long integervoidsetValue(long l)Sets the Value to a long integervoidsetValue(Boolean b)voidsetValue(String str)Sets the Value to a String textvoidsetValue(StringBuffer str)Sets the Value to a String textvoidsetValue(StringBuilder str)Sets the Value to a String textvoidsetValue(BigDecimal num)Sets the value to a BigDecimal number value.voidsetValue(Date dat)Sets the Value to a DatevoidsetValue(Value v)Copy the Value from another Value.voidsetValueInterface(ValueInterface valueInterface)Valuesign()Valuesin()Valuesmaller(Value v)Valuesmaller_equal(Value v)Valuesqrt()ValuestartsWith(String string)ValuestartsWith(Value string)Valuestr2dat(String arg0)Valuestr2dat(String arg0, String arg1)Valuestr2num()Valuestr2num(String pattern)Valuestr2num(String pattern, String decimal)Valuestr2num(String pattern, String decimal, String grouping)Valuestr2num(String pattern, String decimal, String grouping, String currency)Valuesubstr(int from)Valuesubstr(int from, int to)Valuesubstr(Value from)Valuesubstr(Value from, Value to)Valuesysdate()Valuetan()StringtoString()Returns a padded to length String text representation of this ValueStringtoString(boolean pad)a String text representation of this Value, optionally padded to the specified lengthStringtoStringMeta()a String text representation of this Value, optionally padded to the specified lengthValuetrim()Performs a right and left trim of spaces in the string.Valuetrunc()Valuetrunc(double level)Valuetrunc(int level)Valueupper()Valuev_decode(Value[] args)Valuev_if(Value[] args)voidwrite(OutputStream outputStream)Write the value, including the meta-data to a DataOutputStreambooleanwriteData(DataOutputStream dos)Write the data of this Value, without the meta-data to a DataOutputStreamvoidwriteObj(DataOutputStream dos)Valuexor(Value v)
-
-
-
Field Detail
-
XML_TAG
public static final String XML_TAG
- See Also:
- Constant Field Values
-
VALUE_TYPE_NONE
public static final int VALUE_TYPE_NONE
Value type indicating that the value has no type set.- See Also:
- Constant Field Values
-
VALUE_TYPE_NUMBER
public static final int VALUE_TYPE_NUMBER
Value type indicating that the value contains a floating point double precision number.- See Also:
- Constant Field Values
-
VALUE_TYPE_STRING
public static final int VALUE_TYPE_STRING
Value type indicating that the value contains a text String.- See Also:
- Constant Field Values
-
VALUE_TYPE_DATE
public static final int VALUE_TYPE_DATE
Value type indicating that the value contains a Date.- See Also:
- Constant Field Values
-
VALUE_TYPE_BOOLEAN
public static final int VALUE_TYPE_BOOLEAN
Value type indicating that the value contains a boolean.- See Also:
- Constant Field Values
-
VALUE_TYPE_INTEGER
public static final int VALUE_TYPE_INTEGER
Value type indicating that the value contains a long integer.- See Also:
- Constant Field Values
-
VALUE_TYPE_BIGNUMBER
public static final int VALUE_TYPE_BIGNUMBER
Value type indicating that the value contains a floating point precision number with arbitrary precision.- See Also:
- Constant Field Values
-
VALUE_TYPE_SERIALIZABLE
public static final int VALUE_TYPE_SERIALIZABLE
Value type indicating that the value contains an Object.- See Also:
- Constant Field Values
-
VALUE_TYPE_BINARY
public static final int VALUE_TYPE_BINARY
Value type indicating that the value contains binary data: BLOB, CLOB, ...- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Value
public Value()
Constructs a new Value of type EMPTY
-
Value
public Value(String name)
Constructs a new Value with a name.- Parameters:
name- Sets the name of the Value
-
Value
public Value(String name, int val_type)
Constructs a new Value with a name and a type.- Parameters:
name- Sets the name of the Valueval_type- Sets the type of the Value (Value.VALUE_TYPE_*)
-
Value
public Value(String name, int valType, int length, int precision)
Constructs a new Value with a name, a type, length and precision.- Parameters:
name- Sets the name of the ValuevalType- Sets the type of the Value (Value.VALUE_TYPE_*)length- The length of the valueprecision- The precision of the value
-
Value
public Value(String name, BigDecimal bignum)
Constructs a new Value of Type VALUE_TYPE_BIGNUMBER, with a name, containing a BigDecimal number- Parameters:
name- Sets the name of the Valuebignum- The number to store in this Value
-
Value
public Value(String name, double num)
Constructs a new Value of Type VALUE_TYPE_NUMBER, with a name, containing a number- Parameters:
name- Sets the name of the Valuenum- The number to store in this Value
-
Value
public Value(String name, StringBuffer str)
Constructs a new Value of Type VALUE_TYPE_STRING, with a name, containing a String- Parameters:
name- Sets the name of the Valuestr- The text to store in this Value
-
Value
public Value(String name, StringBuilder str)
Constructs a new Value of Type VALUE_TYPE_STRING, with a name, containing a String- Parameters:
name- Sets the name of the Valuestr- The text to store in this Value
-
Value
public Value(String name, String str)
Constructs a new Value of Type VALUE_TYPE_STRING, with a name, containing a String- Parameters:
name- Sets the name of the Valuestr- The text to store in this Value
-
Value
public Value(String name, Date dat)
Constructs a new Value of Type VALUE_TYPE_DATE, with a name, containing a Date- Parameters:
name- Sets the name of the Valuedat- The date to store in this Value
-
Value
public Value(String name, boolean bool)
Constructs a new Value of Type VALUE_TYPE_BOOLEAN, with a name, containing a boolean value- Parameters:
name- Sets the name of the Valuebool- The boolean to store in this Value
-
Value
public Value(String name, long l)
Constructs a new Value of Type VALUE_TYPE_INTEGER, with a name, containing an integer number- Parameters:
name- Sets the name of the Valuel- The integer to store in this Value
-
Value
public Value(String name, Value v)
Constructs a new Value as a copy of another value and renames it...- Parameters:
name- The new name of the copied Valuev- The value to be copied
-
Value
public Value(String name, byte[] b)
Constructs a new Value of Type VALUE_TYPE_BINARY, with a name, containing a bytes value- Parameters:
name- Sets the name of the Valueb- The bytes to store in this Value
-
Value
public Value(Value v)
Constructs a new Value as a copy of another value- Parameters:
v- The Value to be copied
-
Value
public Value(InputStream is) throws KettleFileException
Read the Value, including meta-data from a DataInputStream- Parameters:
is- The InputStream to read the value from- Throws:
KettleFileException- when the Value couldn't be created by reading it from the DataInputStream.
-
Value
public Value(Value metaData, DataInputStream dis) throws KettleFileException
Read the data of a Value from a DataInputStream, the meta-data of the value has to be set before calling this method!- Parameters:
dis- the DataInputStream to read from- Throws:
KettleFileException- when the value couldn't be read from the DataInputStream
-
Value
public Value(Node valnode)
Construct a new Value and read the data from XML- Parameters:
valnode- The XML Node to read from.
-
-
Method Detail
-
Clone
public Value Clone()
Build a copy of this Value- Returns:
- a copy of another value
-
clearValue
public void clearValue()
Clears the content and name of a Value
-
setName
public void setName(String name)
Sets the name of a Value- Parameters:
name- The new name of the value
-
getName
public String getName()
Obtain the name of a Value- Returns:
- The name of the Value
-
setOrigin
public void setOrigin(String step_of_origin)
This method allows you to set the origin of the Value by means of the name of the originating step.- Parameters:
step_of_origin- The step of origin.
-
getOrigin
public String getOrigin()
Obtain the origin of the step.- Returns:
- The name of the originating step
-
setValue
public void setValue(BigDecimal num)
Sets the value to a BigDecimal number value.- Parameters:
num- The number value to set the value to
-
setValue
public void setValue(double num)
Sets the value to a double Number value.- Parameters:
num- The number value to set the value to
-
setValue
public void setValue(StringBuffer str)
Sets the Value to a String text- Parameters:
str- The StringBuffer to get the text from
-
setValue
public void setValue(StringBuilder str)
Sets the Value to a String text- Parameters:
str- The StringBuilder to get the text from
-
setValue
public void setValue(String str)
Sets the Value to a String text- Parameters:
str- The String to get the text from
-
setSerializedValue
public void setSerializedValue(Serializable ser)
-
setValue
public void setValue(Date dat)
Sets the Value to a Date- Parameters:
dat- The Date to set the Value to
-
setValue
public void setValue(boolean bool)
Sets the Value to a boolean- Parameters:
bool- The boolean to set the Value to
-
setValue
public void setValue(Boolean b)
-
setValue
public void setValue(byte b)
Sets the Value to a long integer- Parameters:
b- The byte to convert to a long integer to which the Value is set.
-
setValue
public void setValue(int i)
Sets the Value to a long integer- Parameters:
i- The integer to convert to a long integer to which the Value is set.
-
setValue
public void setValue(long l)
Sets the Value to a long integer- Parameters:
l- The long integer to which the Value is set.
-
setValue
public void setValue(byte[] b)
Sets the Value to a byte array- Parameters:
b- The byte array to which the Value has to be set.
-
setValue
public void setValue(Value v)
Copy the Value from another Value. It doesn't copy the name.- Parameters:
v- The Value to copy the settings and value from
-
getBigNumber
public BigDecimal getBigNumber()
Get the BigDecimal number of this Value. If the value is not of type BIG_NUMBER, a conversion is done first.- Returns:
- the double precision floating point number of this Value.
-
getNumber
public double getNumber()
Get the double precision floating point number of this Value. If the value is not of type NUMBER, a conversion is done first.- Returns:
- the double precision floating point number of this Value.
-
getString
public String getString()
Get the String text representing this value. If the value is not of type STRING, a conversion if done first.- Returns:
- the String text representing this value.
-
getStringLength
public int getStringLength()
Get the length of the String representing this value.- Returns:
- the length of the String representing this value.
-
getDate
public Date getDate()
Get the Date of this Value. If the Value is not of type DATE, a conversion is done first.- Returns:
- the Date of this Value.
-
getSerializable
public Serializable getSerializable()
Get the Serializable of this Value. If the Value is not of type Serializable, it returns null.- Returns:
- the Serializable of this Value.
-
getBoolean
public boolean getBoolean()
Get the boolean value of this Value. If the Value is not of type BOOLEAN, it will be converted.Strings: "YES", "Y", "TRUE" (case insensitive) to true, the rest false
Number: 0.0 is false, the rest is true.
Integer: 0 is false, the rest is true.
Date: always false.
- Returns:
- the boolean representation of this Value.
-
getInteger
public long getInteger()
Get the long integer representation of this value. If the Value is not of type INTEGER, it will be converted:String: try to convert to a long value, 0L if it didn't work.
Number: round the double value and return the resulting long integer.
Date: return the number of miliseconds after
1970:01:01 00:00:00Date: always false.
- Returns:
- the long integer representation of this value.
-
getBytes
public byte[] getBytes()
-
setType
public void setType(int val_type)
Set the type of this Value- Parameters:
val_type- The type to which the Value will be set.
-
getType
public int getType()
Returns the type of this Value- Returns:
- the type of this Value
-
isEmpty
public boolean isEmpty()
Checks whether or not this Value is empty. A value is empty if it has the type VALUE_TYPE_EMPTY- Returns:
- true if the value is empty.
-
isString
public boolean isString()
Checks wheter or not the value is a String.- Returns:
- true if the value is a String.
-
isDate
public boolean isDate()
Checks whether or not this value is a Date- Returns:
- true if the value is a Date
-
isBigNumber
public boolean isBigNumber()
Checks whether or not the value is a Big Number- Returns:
- true is this value is a big number
-
isNumber
public boolean isNumber()
Checks whether or not the value is a Number- Returns:
- true is this value is a number
-
isBoolean
public boolean isBoolean()
Checks whether or not this value is a boolean- Returns:
- true if this value has type boolean.
-
isSerializableType
public boolean isSerializableType()
Checks whether or not this value is of type Serializable- Returns:
- true if this value has type Serializable
-
isBinary
public boolean isBinary()
Checks whether or not this value is of type Binary- Returns:
- true if this value has type Binary
-
isInteger
public boolean isInteger()
Checks whether or not this value is an Integer- 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- 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
-
toString
public String toString()
Returns a padded to length String text representation of this Value
-
toString
public String toString(boolean pad)
a String text representation of this Value, optionally padded to the specified length- Parameters:
pad- true if you want to pad the resulting String- Returns:
- a String text representation of this Value, optionally padded to the specified length
-
toStringMeta
public String toStringMeta()
a String text representation of this Value, optionally padded to the specified length- Returns:
- a String text representation of this Value, optionally padded to the specified length
-
setLength
public void setLength(int l)
Sets the length of the Number, Integer or String to the specified length Note: no truncation of the value takes place, this is meta-data only!- Parameters:
l- the length to which you want to set the Value.
-
setLength
public void setLength(int l, int p)Sets the length and the precision of the Number, Integer or String to the specified length & precision Note: no truncation of the value takes place, this is meta-data only!- Parameters:
l- the length to which you want to set the Value.p- the precision to which you want to set this Value
-
getLength
public int getLength()
Get the length of this Value.- Returns:
- the length of this Value.
-
getPrecision
public int getPrecision()
get the precision of this Value- Returns:
- the precision of this Value.
-
setPrecision
public void setPrecision(int p)
Sets the precision of this Value Note: no rounding or truncation takes place, this is meta-data only!- Parameters:
p- the precision to which you want to set this Value.
-
getTypeDesc
public String getTypeDesc()
Return the type of a value in a textual form: "String", "Number", "Integer", "Boolean", "Date", ...- Returns:
- A String describing the type of value.
-
getTypeDesc
public static final String getTypeDesc(int t)
Return the type of a value in a textual form: "String", "Number", "Integer", "Boolean", "Date", ... given a certain integer type- Parameters:
t- the type to convert to text.- Returns:
- A String describing the type of a certain value.
-
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. (Value.VALUE_TYPE_...)
-
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.
-
setNull
public void setNull()
Sets the Value to null, no type is being changed.
-
setNull
public void setNull(boolean n)
Sets or unsets a value to null, no type is being changed.- Parameters:
n- true if you want the value to be null, false if you don't want this to be the case.
-
isNull
public boolean isNull()
Checks wheter or not a value is null.- Returns:
- true if the Value is null.
-
writeObj
public void writeObj(DataOutputStream dos) throws IOException
- Throws:
IOException
-
write
public void write(OutputStream outputStream) throws KettleFileException
Write the value, including the meta-data to a DataOutputStream- Parameters:
outputStream- the OutputStream to write to .- Throws:
KettleFileException- if something goes wrong.
-
readObj
public void readObj(DataInputStream dis) throws IOException
Read the metadata and data for this Value object from the specified data input stream- Parameters:
dis-- Throws:
IOException
-
writeData
public boolean writeData(DataOutputStream dos) throws KettleFileException
Write the data of this Value, without the meta-data to a DataOutputStream- Parameters:
dos- The DataOutputStream to write the data to- Returns:
- true if all went well, false if something went wrong.
- Throws:
KettleFileException
-
compare
public int compare(Value v)
Compare 2 values of the same or different type! The comparison of Strings is case insensitive- Parameters:
v- the value to compare with.- Returns:
- -1 if The value was smaller, 1 bigger and 0 if both values are equal.
-
compare
public int compare(Value v, boolean caseInsensitive)
Compare 2 values of the same or different type!- Parameters:
v- the value to compare with.caseInsensitive- True if you want the comparison to be case insensitive- Returns:
- -1 if The value was smaller, 1 bigger and 0 if both values are equal.
-
isEqualTo
public boolean isEqualTo(String string)
Check whether this value is equal to the String supplied.- Parameters:
string- The string to check for equality- Returns:
- true if the String representation of the value is equal to string. (ignoring case)
-
isEqualTo
public boolean isEqualTo(BigDecimal number)
Check whether this value is equal to the BigDecimal supplied.- Parameters:
number- The BigDecimal to check for equality- Returns:
- true if the BigDecimal representation of the value is equal to number.
-
isEqualTo
public boolean isEqualTo(double number)
Check whether this value is equal to the Number supplied.- Parameters:
number- The Number to check for equality- Returns:
- true if the Number representation of the value is equal to number.
-
isEqualTo
public boolean isEqualTo(long number)
Check whether this value is equal to the Integer supplied.- Parameters:
number- The Integer to check for equality- Returns:
- true if the Integer representation of the value is equal to number.
-
isEqualTo
public boolean isEqualTo(int number)
Check whether this value is equal to the Integer supplied.- Parameters:
number- The Integer to check for equality- Returns:
- true if the Integer representation of the value is equal to number.
-
isEqualTo
public boolean isEqualTo(byte number)
Check whether this value is equal to the Integer supplied.- Parameters:
number- The Integer to check for equality- Returns:
- true if the Integer representation of the value is equal to number.
-
isEqualTo
public boolean isEqualTo(Date date)
Check whether this value is equal to the Date supplied.- Parameters:
date- The Date to check for equality- Returns:
- true if the Date representation of the value is equal to date.
-
bool_not
public Value bool_not()
-
minus
public Value minus(BigDecimal v) throws KettleValueException
- Throws:
KettleValueException
-
minus
public Value minus(double v) throws KettleValueException
- Throws:
KettleValueException
-
minus
public Value minus(long v) throws KettleValueException
- Throws:
KettleValueException
-
minus
public Value minus(int v) throws KettleValueException
- Throws:
KettleValueException
-
minus
public Value minus(byte v) throws KettleValueException
- Throws:
KettleValueException
-
minus
public Value minus(Value v) throws KettleValueException
- Throws:
KettleValueException
-
plus
public Value plus(BigDecimal v)
-
plus
public Value plus(double v)
-
plus
public Value plus(long v)
-
plus
public Value plus(int v)
-
plus
public Value plus(byte v)
-
divide
public Value divide(BigDecimal v) throws KettleValueException
- Throws:
KettleValueException
-
divide
public Value divide(double v) throws KettleValueException
- Throws:
KettleValueException
-
divide
public Value divide(long v) throws KettleValueException
- Throws:
KettleValueException
-
divide
public Value divide(int v) throws KettleValueException
- Throws:
KettleValueException
-
divide
public Value divide(byte v) throws KettleValueException
- Throws:
KettleValueException
-
divide
public Value divide(Value v) throws KettleValueException
- Throws:
KettleValueException
-
multiply
public Value multiply(BigDecimal v) throws KettleValueException
- Throws:
KettleValueException
-
multiply
public Value multiply(double v) throws KettleValueException
- Throws:
KettleValueException
-
multiply
public Value multiply(long v) throws KettleValueException
- Throws:
KettleValueException
-
multiply
public Value multiply(int v) throws KettleValueException
- Throws:
KettleValueException
-
multiply
public Value multiply(byte v) throws KettleValueException
- Throws:
KettleValueException
-
multiply
public Value multiply(Value v) throws KettleValueException
- Throws:
KettleValueException
-
abs
public Value abs() throws KettleValueException
- Throws:
KettleValueException
-
acos
public Value acos() throws KettleValueException
- Throws:
KettleValueException
-
asin
public Value asin() throws KettleValueException
- Throws:
KettleValueException
-
atan
public Value atan() throws KettleValueException
- Throws:
KettleValueException
-
atan2
public Value atan2(Value arg0) throws KettleValueException
- Throws:
KettleValueException
-
atan2
public Value atan2(double arg0) throws KettleValueException
- Throws:
KettleValueException
-
ceil
public Value ceil() throws KettleValueException
- Throws:
KettleValueException
-
cos
public Value cos() throws KettleValueException
- Throws:
KettleValueException
-
exp
public Value exp() throws KettleValueException
- Throws:
KettleValueException
-
floor
public Value floor() throws KettleValueException
- Throws:
KettleValueException
-
initcap
public Value initcap()
-
length
public Value length() throws KettleValueException
- Throws:
KettleValueException
-
log
public Value log() throws KettleValueException
- Throws:
KettleValueException
-
lower
public Value lower()
-
lpad
public Value lpad(int len)
-
ltrim
public Value ltrim()
-
mod
public Value mod(Value arg) throws KettleValueException
- Throws:
KettleValueException
-
mod
public Value mod(BigDecimal arg) throws KettleValueException
- Throws:
KettleValueException
-
mod
public Value mod(long arg) throws KettleValueException
- Throws:
KettleValueException
-
mod
public Value mod(int arg) throws KettleValueException
- Throws:
KettleValueException
-
mod
public Value mod(byte arg) throws KettleValueException
- Throws:
KettleValueException
-
mod
public Value mod(double arg0) throws KettleValueException
- Throws:
KettleValueException
-
power
public Value power(BigDecimal arg) throws KettleValueException
- Throws:
KettleValueException
-
power
public Value power(double arg) throws KettleValueException
- Throws:
KettleValueException
-
power
public Value power(Value v) throws KettleValueException
- Throws:
KettleValueException
-
round
public Value round() throws KettleValueException
Rounds off to the nearest integer.See also: java.lang.Math.round()
- Returns:
- The rounded Number value.
- Throws:
KettleValueException
-
round
public Value round(int decimalPlaces) throws KettleValueException
Rounds the Number value to a certain number decimal places.- Parameters:
decimalPlaces-- Returns:
- The rounded Number Value
- Throws:
KettleValueException- in case it's not a number (or other problem).
-
rpad
public Value rpad(int len)
-
rtrim
public Value rtrim()
-
sign
public Value sign() throws KettleValueException
- Throws:
KettleValueException
-
sin
public Value sin() throws KettleValueException
- Throws:
KettleValueException
-
sqrt
public Value sqrt() throws KettleValueException
- Throws:
KettleValueException
-
substr
public Value substr(int from)
-
substr
public Value substr(int from, int to)
-
rightstr
public Value rightstr(int len)
-
leftstr
public Value leftstr(int len)
-
sysdate
public Value sysdate()
-
tan
public Value tan() throws KettleValueException
- Throws:
KettleValueException
-
num2str
public Value num2str() throws KettleValueException
- Throws:
KettleValueException
-
num2str
public Value num2str(String format) throws KettleValueException
- Throws:
KettleValueException
-
num2str
public Value num2str(String format, String decimalSymbol) throws KettleValueException
- Throws:
KettleValueException
-
num2str
public Value num2str(String format, String decimalSymbol, String groupingSymbol) throws KettleValueException
- Throws:
KettleValueException
-
num2str
public Value num2str(String format, String decimalSymbol, String groupingSymbol, String currencySymbol) throws KettleValueException
- Throws:
KettleValueException
-
dat2str
public Value dat2str() throws KettleValueException
- Throws:
KettleValueException
-
dat2str
public Value dat2str(String arg0) throws KettleValueException
- Throws:
KettleValueException
-
dat2str
public Value dat2str(String arg0, String arg1) throws KettleValueException
- Throws:
KettleValueException
-
num2dat
public Value num2dat() throws KettleValueException
- Throws:
KettleValueException
-
str2dat
public Value str2dat(String arg0) throws KettleValueException
- Throws:
KettleValueException
-
str2dat
public Value str2dat(String arg0, String arg1) throws KettleValueException
- Throws:
KettleValueException
-
str2num
public Value str2num() throws KettleValueException
- Throws:
KettleValueException
-
str2num
public Value str2num(String pattern) throws KettleValueException
- Throws:
KettleValueException
-
str2num
public Value str2num(String pattern, String decimal) throws KettleValueException
- Throws:
KettleValueException
-
str2num
public Value str2num(String pattern, String decimal, String grouping) throws KettleValueException
- Throws:
KettleValueException
-
str2num
public Value str2num(String pattern, String decimal, String grouping, String currency) throws KettleValueException
- Throws:
KettleValueException
-
dat2num
public Value dat2num() throws KettleValueException
- Throws:
KettleValueException
-
trim
public Value trim()
Performs a right and left trim of spaces in the string. If the value is not a string a conversion to String is performed first.- Returns:
- The trimmed string value.
-
upper
public Value upper()
-
e
public Value e()
-
pi
public Value pi()
-
v_decode
public Value v_decode(Value[] args) throws KettleValueException
- Throws:
KettleValueException
-
v_if
public Value v_if(Value[] args) throws KettleValueException
- Throws:
KettleValueException
-
add_months
public Value add_months(int months) throws KettleValueException
- Throws:
KettleValueException
-
add_days
public Value add_days(long days) throws KettleValueException
Add a number of days to a Date value.- Parameters:
days- The number of days to add to the current date value- Returns:
- The resulting value
- Throws:
KettleValueException
-
last_day
public Value last_day() throws KettleValueException
- Throws:
KettleValueException
-
first_day
public Value first_day() throws KettleValueException
- Throws:
KettleValueException
-
trunc
public Value trunc() throws KettleValueException
- Throws:
KettleValueException
-
trunc
public Value trunc(double level) throws KettleValueException
- Throws:
KettleValueException
-
trunc
public Value trunc(int level) throws KettleValueException
- Throws:
KettleValueException
-
byteToHexEncode
public Value byteToHexEncode()
Change a string into its hexadecimal representation. E.g. if Value contains string "a" afterwards it would contain value "61". Note that transformations happen in groups of 2 hex characters, so the value of a characters is always in the range 0-255.- Returns:
- Value itself
- Throws:
KettleValueException
-
hexToByteDecode
public Value hexToByteDecode() throws KettleValueException
Change a hexadecimal string into normal ASCII representation. E.g. if Value contains string "61" afterwards it would contain value "a". If the hexadecimal string is of odd length a leading zero will be used. Note that only the low byte of a character will be processed, this is for binary transformations.- Returns:
- Value itself
- Throws:
KettleValueException
-
charToHexEncode
public Value charToHexEncode()
Change a string into its hexadecimal representation. E.g. if Value contains string "a" afterwards it would contain value "0061". Note that transformations happen in groups of 4 hex characters, so the value of a characters is always in the range 0-65535.- Returns:
- Value itself
- Throws:
KettleValueException
-
hexToCharDecode
public Value hexToCharDecode() throws KettleValueException
Change a hexadecimal string into normal ASCII representation. E.g. if Value contains string "61" afterwards it would contain value "a". If the hexadecimal string is of a wrong length leading zeroes will be used. Note that transformations happen in groups of 4 hex characters, so the value of a characters is always in the range 0-65535.- Returns:
- Value itself
- Throws:
KettleValueException
-
getInstance
public static final Value getInstance()
-
getClassName
public String getClassName()
-
jsConstructor
public void jsConstructor()
-
jsConstructor
public void jsConstructor(String name)
-
getXML
public String getXML()
Produce the XML representation of this value.- Specified by:
getXMLin interfaceXMLInterface- Returns:
- a String containing the XML to represent this Value.
-
loadXML
public boolean loadXML(Node valnode)
Read the data for this Value from an XML Node- Parameters:
valnode- The XML Node to read from- Returns:
- true if all went well, false if something went wrong.
-
convertString
public void convertString(int newtype) throws KettleValueExceptionConvert this Value from type String to another type- Parameters:
newtype- The Value type to convert to.- Throws:
KettleValueException
-
equalValueType
public boolean equalValueType(Value v)
-
equalValueType
public boolean equalValueType(Value v, boolean checkTypeOnly)
Returns whether "types" of the values are exactly the same: type, name, length, precision.- Parameters:
v- Value to compare type against.- Returns:
- == true when types are the same == false when the types differ
-
getValueInterface
public ValueInterface getValueInterface()
-
setValueInterface
public void setValueInterface(ValueInterface valueInterface)
-
merge
public void merge(Value other)
Merges another Value. That means, that if the other Value has got the same name and is of the same type as this Value, it's real field value is set as this this' value, if our value isnullor empty- Parameters:
other- The other value
-
-