public class ValueDataUtil extends Object
Constructor and Description |
---|
ValueDataUtil() |
Modifier and Type | Method and Description |
---|---|
static Object |
abs(ValueMetaInterface metaA,
Object dataA) |
static Object |
addDays(ValueMetaInterface metaA,
Object dataA,
ValueMetaInterface metaB,
Object dataB) |
static Object |
addHours(ValueMetaInterface metaA,
Object dataA,
ValueMetaInterface metaB,
Object dataB) |
static Object |
addMinutes(ValueMetaInterface metaA,
Object dataA,
ValueMetaInterface metaB,
Object dataB) |
static Object |
addMonths(ValueMetaInterface metaA,
Object dataA,
ValueMetaInterface metaB,
Object dataB) |
static Object |
addTimeToDate(ValueMetaInterface metaA,
Object dataA,
ValueMetaInterface metaB,
Object dataB,
ValueMetaInterface metaC,
Object dataC) |
static String |
byteToHexEncode(ValueMetaInterface metaA,
Object dataA)
Change a string into its hexadecimal representation.
|
static Object |
ceil(ValueMetaInterface metaA,
Object dataA) |
static String |
charToHexEncode(ValueMetaInterface meta,
Object data)
Change a string into its hexadecimal representation.
|
static Long |
ChecksumAdler32(ValueMetaInterface metaA,
Object dataA) |
static Long |
ChecksumCRC32(ValueMetaInterface metaA,
Object dataA) |
static Object |
combination1(ValueMetaInterface metaA,
Object dataA,
ValueMetaInterface metaB,
Object dataB,
ValueMetaInterface metaC,
Object dataC)
A + B * C
|
static Object |
combination2(ValueMetaInterface metaA,
Object dataA,
ValueMetaInterface metaB,
Object dataB)
SQRT( A*A + B*B )
|
static String |
createChecksum(ValueMetaInterface metaA,
Object dataA,
String type) |
static Object |
DateDiff(ValueMetaInterface metaA,
Object dataA,
ValueMetaInterface metaB,
Object dataB,
String resultType)
Returns the number of days that have elapsed between dataA and dataB.
|
static Object |
DateWorkingDiff(ValueMetaInterface metaA,
Object dataA,
ValueMetaInterface metaB,
Object dataB) |
static Object |
dayOfMonth(ValueMetaInterface metaA,
Object dataA) |
static Object |
dayOfWeek(ValueMetaInterface metaA,
Object dataA) |
static Object |
dayOfYear(ValueMetaInterface metaA,
Object dataA) |
static Object |
divide(ValueMetaInterface metaA,
Object dataA,
ValueMetaInterface metaB,
Object dataB) |
static BigDecimal |
divideBigDecimals(BigDecimal a,
BigDecimal b,
MathContext mc) |
static Double |
divideDoubles(Double a,
Double b) |
static Long |
divideLongs(Long a,
Long b) |
static String |
escapeHTML(ValueMetaInterface metaA,
Object dataA) |
static String |
escapeSQL(ValueMetaInterface metaA,
Object dataA) |
static String |
escapeXML(ValueMetaInterface metaA,
Object dataA) |
static Object |
floor(ValueMetaInterface metaA,
Object dataA) |
static String |
get_Double_Metaphone(ValueMetaInterface metaA,
Object dataA) |
static String |
get_Metaphone(ValueMetaInterface metaA,
Object dataA) |
static String |
get_RefinedSoundEx(ValueMetaInterface metaA,
Object dataA) |
static String |
get_SoundEx(ValueMetaInterface metaA,
Object dataA) |
static Long |
getDamerauLevenshtein_Distance(ValueMetaInterface metaA,
Object dataA,
ValueMetaInterface metaB,
Object dataB)
DamerauLevenshtein distance is a measure of the similarity between two strings, which we will refer to as the
source string (s) and the target string (t).
|
static String |
getDigits(ValueMetaInterface metaA,
Object dataA) |
static String |
getFileEncoding(ValueMetaInterface metaA,
Object dataA)
Get file encoding.
|
static Double |
getJaro_Similitude(ValueMetaInterface metaA,
Object dataA,
ValueMetaInterface metaB,
Object dataB)
Jaro similitude is a measure of the similarity between two strings, which we will refer to as the source string (s)
and the target string (t).
|
static Double |
getJaroWinkler_Similitude(ValueMetaInterface metaA,
Object dataA,
ValueMetaInterface metaB,
Object dataB)
JaroWinkler similitude is a measure of the similarity between two strings, which we will refer to as the source
string (s) and the target string (t).
|
static Long |
getLevenshtein_Distance(ValueMetaInterface metaA,
Object dataA,
ValueMetaInterface metaB,
Object dataB)
Levenshtein distance (LD) is a measure of the similarity between two strings, which we will refer to as the source
string (s) and the target string (t).
|
static Long |
getNeedlemanWunsch_Distance(ValueMetaInterface metaA,
Object dataA,
ValueMetaInterface metaB,
Object dataB)
NeedlemanWunsch distance is a measure of the similarity between two strings, which we will refer to as the source
string (s) and the target string (t).
|
static Object |
getZeroForValueMetaType(ValueMetaInterface type)
Default utility method to get exact zero value according to ValueMetaInterface.
|
static String |
hexToByteDecode(ValueMetaInterface meta,
Object data)
Change a hexadecimal string into normal ASCII representation.
|
static String |
hexToCharDecode(ValueMetaInterface meta,
Object data)
Change a hexadecimal string into normal ASCII representation.
|
static Object |
hourOfDay(ValueMetaInterface metaA,
Object dataA) |
static String |
initCap(ValueMetaInterface metaA,
Object dataA) |
static boolean |
isSpace(char c)
Deprecated.
Use
Const.isSpace(char) instead |
static boolean |
isXMLFileWellFormed(ValueMetaInterface metaA,
Object dataA)
Checks an xml file is well formed.
|
static boolean |
isXMLWellFormed(ValueMetaInterface metaA,
Object dataA)
Checks an xml string is well formed.
|
static String |
leftTrim(String string)
Deprecated.
Use
Const.ltrim(String) instead |
static Object |
loadFileContentInBinary(ValueMetaInterface metaA,
Object dataA) |
static String |
lowerCase(ValueMetaInterface metaA,
Object dataA) |
static Object |
minus(ValueMetaInterface metaA,
Object dataA,
ValueMetaInterface metaB,
Object dataB) |
static Object |
minuteOfHour(ValueMetaInterface metaA,
Object dataA) |
static Object |
monthOfDate(ValueMetaInterface metaA,
Object dataA) |
static Object |
multiply(ValueMetaInterface metaA,
Object dataA,
ValueMetaInterface metaB,
Object dataB) |
static BigDecimal |
multiplyBigDecimals(BigDecimal a,
BigDecimal b,
MathContext mc) |
static Double |
multiplyDoubles(Double a,
Double b) |
static Long |
multiplyLongs(Long a,
Long b) |
static int |
nrSpacesAfter(String field)
Count the number of spaces to the right of a text.
|
static int |
nrSpacesBefore(String field)
Count the number of spaces to the left of a text.
|
static Object |
nvl(ValueMetaInterface metaA,
Object dataA,
ValueMetaInterface metaB,
Object dataB) |
static boolean |
onlySpaces(String str)
Checks whether or not a String consists only of spaces.
|
static Object |
percent1(ValueMetaInterface metaA,
Object dataA,
ValueMetaInterface metaB,
Object dataB)
100 * A / B
|
static Object |
percent2(ValueMetaInterface metaA,
Object dataA,
ValueMetaInterface metaB,
Object dataB)
A - ( A * B / 100 )
|
static Object |
percent3(ValueMetaInterface metaA,
Object dataA,
ValueMetaInterface metaB,
Object dataB)
A + ( A * B / 100 )
|
static Object |
plus(ValueMetaInterface metaA,
Object dataA,
ValueMetaInterface metaB,
Object dataB) |
static Object |
plus3(ValueMetaInterface metaA,
Object dataA,
ValueMetaInterface metaB,
Object dataB,
ValueMetaInterface metaC,
Object dataC) |
static Object |
quarterOfDate(ValueMetaInterface metaA,
Object dataA) |
static String |
removeCR(ValueMetaInterface metaA,
Object dataA) |
static String |
removeCRLF(ValueMetaInterface metaA,
Object dataA) |
static String |
removeDigits(ValueMetaInterface metaA,
Object dataA) |
static String |
removeLF(ValueMetaInterface metaA,
Object dataA) |
static String |
removeTAB(ValueMetaInterface metaA,
Object dataA) |
static Object |
removeTimeFromDate(ValueMetaInterface metaA,
Object dataA) |
static String |
replace(String string,
String repl,
String with)
Replace value occurances in a String with another value.
|
static void |
replaceBuffer(StringBuffer str,
String code,
String repl)
Alternate faster version of string replace using a stringbuffer as input.
|
static String |
rightPad(StringBuffer ret,
int limit)
Right pad a StringBuffer: adds spaces to a string until a certain length.
|
static String |
rightPad(String ret,
int limit)
Right pad a string: adds spaces to a string until a certain length.
|
static String |
rightTrim(String string)
Deprecated.
Use
Const.rtrim(String) instead |
static Object |
round(ValueMetaInterface metaA,
Object dataA)
Rounding with no decimal places (using default rounding method ROUND_HALF_EVEN)
|
static Object |
round(ValueMetaInterface metaA,
Object dataA,
int roundingMode)
Rounding with no decimal places with a given rounding method
|
static Object |
round(ValueMetaInterface metaA,
Object dataA,
ValueMetaInterface metaB,
Object dataB)
Rounding with decimal places (using default rounding method ROUND_HALF_EVEN)
|
static Object |
round(ValueMetaInterface metaA,
Object dataA,
ValueMetaInterface metaB,
Object dataB,
int roundingMode)
Rounding with decimal places with a given rounding method
|
static Object |
secondOfMinute(ValueMetaInterface metaA,
Object dataA) |
static Object |
sqrt(ValueMetaInterface metaA,
Object dataA) |
static long |
stringLen(ValueMetaInterface metaA,
Object dataA) |
static Object |
sum(ValueMetaInterface metaA,
Object dataA,
ValueMetaInterface metaB,
Object dataB) |
static String |
trim(String string)
Deprecated.
Use
Const.trim(String) instead |
static String |
unEscapeHTML(ValueMetaInterface metaA,
Object dataA) |
static String |
unEscapeXML(ValueMetaInterface metaA,
Object dataA) |
static String |
upperCase(ValueMetaInterface metaA,
Object dataA) |
static String |
useCDATA(ValueMetaInterface metaA,
Object dataA) |
static Object |
weekOfYear(ValueMetaInterface metaA,
Object dataA) |
static Object |
weekOfYearISO8601(ValueMetaInterface metaA,
Object dataA) |
static Object |
yearOfDate(ValueMetaInterface metaA,
Object dataA) |
static Object |
yearOfDateISO8601(ValueMetaInterface metaA,
Object dataA) |
@Deprecated public static final String leftTrim(String string)
Const.ltrim(String)
instead@Deprecated public static final String rightTrim(String string)
Const.rtrim(String)
instead@Deprecated public static final boolean isSpace(char c)
Const.isSpace(char)
insteadc
- The character to verify if it is a space.@Deprecated public static final String trim(String string)
Const.trim(String)
insteadstring
- The string to trimpublic static Long getLevenshtein_Distance(ValueMetaInterface metaA, Object dataA, ValueMetaInterface metaB, Object dataB)
public static Long getDamerauLevenshtein_Distance(ValueMetaInterface metaA, Object dataA, ValueMetaInterface metaB, Object dataB)
public static Long getNeedlemanWunsch_Distance(ValueMetaInterface metaA, Object dataA, ValueMetaInterface metaB, Object dataB)
public static Double getJaro_Similitude(ValueMetaInterface metaA, Object dataA, ValueMetaInterface metaB, Object dataB)
public static Double getJaroWinkler_Similitude(ValueMetaInterface metaA, Object dataA, ValueMetaInterface metaB, Object dataB)
public static String get_Metaphone(ValueMetaInterface metaA, Object dataA)
public static String get_Double_Metaphone(ValueMetaInterface metaA, Object dataA)
public static String get_SoundEx(ValueMetaInterface metaA, Object dataA)
public static String get_RefinedSoundEx(ValueMetaInterface metaA, Object dataA)
public static String initCap(ValueMetaInterface metaA, Object dataA)
public static String upperCase(ValueMetaInterface metaA, Object dataA)
public static String lowerCase(ValueMetaInterface metaA, Object dataA)
public static String escapeXML(ValueMetaInterface metaA, Object dataA)
public static String unEscapeXML(ValueMetaInterface metaA, Object dataA)
public static String escapeHTML(ValueMetaInterface metaA, Object dataA)
public static String unEscapeHTML(ValueMetaInterface metaA, Object dataA)
public static String escapeSQL(ValueMetaInterface metaA, Object dataA)
public static String useCDATA(ValueMetaInterface metaA, Object dataA)
public static String removeCR(ValueMetaInterface metaA, Object dataA)
public static String removeLF(ValueMetaInterface metaA, Object dataA)
public static String removeCRLF(ValueMetaInterface metaA, Object dataA)
public static String removeTAB(ValueMetaInterface metaA, Object dataA)
public static String getDigits(ValueMetaInterface metaA, Object dataA)
public static String removeDigits(ValueMetaInterface metaA, Object dataA)
public static long stringLen(ValueMetaInterface metaA, Object dataA)
public static String createChecksum(ValueMetaInterface metaA, Object dataA, String type)
public static Long ChecksumCRC32(ValueMetaInterface metaA, Object dataA)
public static Long ChecksumAdler32(ValueMetaInterface metaA, Object dataA)
public static Object plus(ValueMetaInterface metaA, Object dataA, ValueMetaInterface metaB, Object dataB) throws KettleValueException
KettleValueException
public static Object plus3(ValueMetaInterface metaA, Object dataA, ValueMetaInterface metaB, Object dataB, ValueMetaInterface metaC, Object dataC) throws KettleValueException
KettleValueException
public static Object sum(ValueMetaInterface metaA, Object dataA, ValueMetaInterface metaB, Object dataB) throws KettleValueException
KettleValueException
public static Object loadFileContentInBinary(ValueMetaInterface metaA, Object dataA) throws KettleValueException
KettleValueException
public static Object minus(ValueMetaInterface metaA, Object dataA, ValueMetaInterface metaB, Object dataB) throws KettleValueException
KettleValueException
public static Object multiply(ValueMetaInterface metaA, Object dataA, ValueMetaInterface metaB, Object dataB) throws KettleValueException
KettleValueException
public static BigDecimal multiplyBigDecimals(BigDecimal a, BigDecimal b, MathContext mc)
public static Object divide(ValueMetaInterface metaA, Object dataA, ValueMetaInterface metaB, Object dataB) throws KettleValueException
KettleValueException
public static BigDecimal divideBigDecimals(BigDecimal a, BigDecimal b, MathContext mc)
public static Object sqrt(ValueMetaInterface metaA, Object dataA) throws KettleValueException
KettleValueException
public static Object percent1(ValueMetaInterface metaA, Object dataA, ValueMetaInterface metaB, Object dataB) throws KettleValueException
metaA
- dataA
- metaB
- dataB
- KettleValueException
public static Object percent2(ValueMetaInterface metaA, Object dataA, ValueMetaInterface metaB, Object dataB) throws KettleValueException
metaA
- dataA
- metaB
- dataB
- KettleValueException
public static Object percent3(ValueMetaInterface metaA, Object dataA, ValueMetaInterface metaB, Object dataB) throws KettleValueException
metaA
- dataA
- metaB
- dataB
- KettleValueException
public static Object combination1(ValueMetaInterface metaA, Object dataA, ValueMetaInterface metaB, Object dataB, ValueMetaInterface metaC, Object dataC) throws KettleValueException
metaA
- dataA
- metaB
- dataB
- KettleValueException
public static Object combination2(ValueMetaInterface metaA, Object dataA, ValueMetaInterface metaB, Object dataB) throws KettleValueException
metaA
- dataA
- metaB
- dataB
- KettleValueException
public static Object round(ValueMetaInterface metaA, Object dataA) throws KettleValueException
metaA
- Metadata of value to rounddataA
- Value to roundKettleValueException
public static Object round(ValueMetaInterface metaA, Object dataA, int roundingMode) throws KettleValueException
metaA
- Metadata of value to rounddataA
- Value to roundroundingMode
- The mode for rounding, e.g. java.math.BigDecimal.ROUND_HALF_EVENKettleValueException
public static Object round(ValueMetaInterface metaA, Object dataA, ValueMetaInterface metaB, Object dataB) throws KettleValueException
metaA
- Metadata of value to rounddataA
- Value to roundmetaB
- Metadata of decimal placesdataB
- decimal placesKettleValueException
public static Object round(ValueMetaInterface metaA, Object dataA, ValueMetaInterface metaB, Object dataB, int roundingMode) throws KettleValueException
metaA
- Metadata of value to rounddataA
- Value to roundmetaB
- Metadata of decimal placesdataB
- decimal placesroundingMode
- roundingMode The mode for rounding, e.g. java.math.BigDecimal.ROUND_HALF_EVENKettleValueException
public static Object ceil(ValueMetaInterface metaA, Object dataA) throws KettleValueException
KettleValueException
public static Object floor(ValueMetaInterface metaA, Object dataA) throws KettleValueException
KettleValueException
public static Object abs(ValueMetaInterface metaA, Object dataA) throws KettleValueException
KettleValueException
public static Object nvl(ValueMetaInterface metaA, Object dataA, ValueMetaInterface metaB, Object dataB) throws KettleValueException
KettleValueException
public static Object removeTimeFromDate(ValueMetaInterface metaA, Object dataA) throws KettleValueException
KettleValueException
public static Object addTimeToDate(ValueMetaInterface metaA, Object dataA, ValueMetaInterface metaB, Object dataB, ValueMetaInterface metaC, Object dataC) throws KettleValueException
KettleValueException
public static Object addDays(ValueMetaInterface metaA, Object dataA, ValueMetaInterface metaB, Object dataB) throws KettleValueException
KettleValueException
public static Object addHours(ValueMetaInterface metaA, Object dataA, ValueMetaInterface metaB, Object dataB) throws KettleValueException
KettleValueException
public static Object addMinutes(ValueMetaInterface metaA, Object dataA, ValueMetaInterface metaB, Object dataB) throws KettleValueException
KettleValueException
public static Object addMonths(ValueMetaInterface metaA, Object dataA, ValueMetaInterface metaB, Object dataB) throws KettleValueException
KettleValueException
public static Object DateDiff(ValueMetaInterface metaA, Object dataA, ValueMetaInterface metaB, Object dataB, String resultType) throws KettleValueException
metaA
- dataA
- The "end date"metaB
- dataB
- The "start date"resultType
- The "result type" (ms, s, mn, h, d)KettleValueException
public static Object DateWorkingDiff(ValueMetaInterface metaA, Object dataA, ValueMetaInterface metaB, Object dataB) throws KettleValueException
KettleValueException
public static Object yearOfDate(ValueMetaInterface metaA, Object dataA) throws KettleValueException
KettleValueException
public static Object monthOfDate(ValueMetaInterface metaA, Object dataA) throws KettleValueException
KettleValueException
public static Object quarterOfDate(ValueMetaInterface metaA, Object dataA) throws KettleValueException
KettleValueException
public static Object dayOfYear(ValueMetaInterface metaA, Object dataA) throws KettleValueException
KettleValueException
public static Object dayOfMonth(ValueMetaInterface metaA, Object dataA) throws KettleValueException
KettleValueException
public static Object hourOfDay(ValueMetaInterface metaA, Object dataA) throws KettleValueException
KettleValueException
public static Object minuteOfHour(ValueMetaInterface metaA, Object dataA) throws KettleValueException
KettleValueException
public static Object secondOfMinute(ValueMetaInterface metaA, Object dataA) throws KettleValueException
KettleValueException
public static Object dayOfWeek(ValueMetaInterface metaA, Object dataA) throws KettleValueException
KettleValueException
public static Object weekOfYear(ValueMetaInterface metaA, Object dataA) throws KettleValueException
KettleValueException
public static Object weekOfYearISO8601(ValueMetaInterface metaA, Object dataA) throws KettleValueException
KettleValueException
public static Object yearOfDateISO8601(ValueMetaInterface metaA, Object dataA) throws KettleValueException
KettleValueException
public static String hexToByteDecode(ValueMetaInterface meta, Object data) throws KettleValueException
KettleValueException
public static String byteToHexEncode(ValueMetaInterface metaA, Object dataA) throws KettleValueException
KettleValueException
public static String charToHexEncode(ValueMetaInterface meta, Object data) throws KettleValueException
KettleValueException
- In case of a data conversion problem.public static String hexToCharDecode(ValueMetaInterface meta, Object data) throws KettleValueException
KettleValueException
public static final String rightPad(String ret, int limit)
ret
- The string to padlimit
- The desired length of the padded string.public static final String rightPad(StringBuffer ret, int limit)
ret
- The StringBuffer to padlimit
- The desired length of the padded string.public static final String replace(String string, String repl, String with)
string
- The original String.repl
- The text to replacewith
- The new text bitpublic static void replaceBuffer(StringBuffer str, String code, String repl)
str
- The string where we want to replace incode
- The code to search forrepl
- The replacement string for codepublic static final int nrSpacesBefore(String field)
field
- The text to examinepublic static final int nrSpacesAfter(String field)
field
- The text to examinepublic static final boolean onlySpaces(String str)
str
- The string to checkpublic static boolean isXMLFileWellFormed(ValueMetaInterface metaA, Object dataA)
metaA
- The ValueMetaInterfacedataA
- The value (filename)public static boolean isXMLWellFormed(ValueMetaInterface metaA, Object dataA)
metaA
- The ValueMetaInterfacedataA
- The value (filename)public static String getFileEncoding(ValueMetaInterface metaA, Object dataA) throws KettleValueException
metaA
- The ValueMetaInterfacedataA
- The value (filename)KettleValueException
public static Object getZeroForValueMetaType(ValueMetaInterface type) throws KettleValueException
type
- KettleValueException