Codota Logo
Value
Code IndexAdd Codota to your IDE (free)

How to use
Value
in
org.pentaho.di.compatibility

Best Java code snippets using org.pentaho.di.compatibility.Value (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
DateTime d =
  • Codota Iconnew DateTime()
  • Codota IconDateTimeFormatter formatter;String text;formatter.parseDateTime(text)
  • Codota IconObject instant;new DateTime(instant)
  • Smart code suggestions by Codota
}
origin: pentaho/pentaho-kettle

public Value lower() {
 if ( isNull() ) {
  setType( VALUE_TYPE_STRING );
 } else {
  setValue( getString().toLowerCase() );
 }
 return this;
}
origin: pentaho/pentaho-kettle

public Value minus( byte v ) throws KettleValueException {
 return minus( new Value( "tmp", (long) v ) );
}
origin: pentaho/pentaho-kettle

public Value abs() throws KettleValueException {
 if ( isNull() ) {
  return this;
 }
 if ( isBigNumber() ) {
  setValue( getBigNumber().abs() );
 } else if ( isNumber() ) {
  setValue( Math.abs( getNumber() ) );
 } else if ( isInteger() ) {
  setValue( Math.abs( getInteger() ) );
 } else {
  throw new KettleValueException( "Function ABS only works with a number" );
 }
 return this;
}
origin: pentaho/pentaho-kettle

public Value or( Value v ) {
 long n1 = getInteger();
 long n2 = v.getInteger();
 long res = n1 | n2;
 setValue( res );
 return this;
}
origin: pentaho/pentaho-kettle

/**
 * Constructs a new Value of Type VALUE_TYPE_DATE, with a name, containing a Date
 *
 * @param name
 *          Sets the name of the Value
 * @param dat
 *          The date to store in this Value
 */
public Value( String name, Date dat ) {
 // clearValue();
 setValue( dat );
 setName( name );
}
origin: pentaho/pentaho-kettle

/**
 * Constructs a new Value of Type VALUE_TYPE_BINARY, with a name, containing a bytes value
 *
 * @param name
 *          Sets the name of the Value
 * @param b
 *          The bytes to store in this Value
 */
public Value( String name, byte[] b ) {
 clearValue();
 setValue( b );
 setName( name );
}
origin: pentaho/pentaho-kettle

public Value power( Value v ) throws KettleValueException {
 if ( isNull() ) {
  return this;
 } else if ( isNumeric() ) {
  setValue( Math.pow( getNumber(), v.getNumber() ) );
 } else {
  throw new KettleValueException( "Function POWER only works with numeric data" );
 }
 return this;
}
origin: pentaho/pentaho-kettle

res.setName( rename[i] );
res.setType( type[i] );
   case ValueMetaInterface.TYPE_NUMBER:
    if ( classname.equalsIgnoreCase( "org.mozilla.javascript.Undefined" ) ) {
     res.setNull();
    } else if ( classname.equalsIgnoreCase( "org.mozilla.javascript.NativeJavaObject" ) ) {
     res.setValue( v.getNumber() );
    } else {
     res.setValue( ( (Double) result ).doubleValue() );
     res.setValue( ( (java.lang.Byte) result ).longValue() );
    } else if ( classname.equalsIgnoreCase( "java.lang.Short" ) ) {
     res.setValue( ( (Short) result ).longValue() );
    } else if ( classname.equalsIgnoreCase( "java.lang.Integer" ) ) {
     res.setValue( ( (Integer) result ).longValue() );
    } else if ( classname.equalsIgnoreCase( "java.lang.Long" ) ) {
     res.setValue( ( (Long) result ).longValue() );
    } else if ( classname.equalsIgnoreCase( "org.mozilla.javascript.Undefined" ) ) {
     res.setNull();
    } else if ( classname.equalsIgnoreCase( "org.mozilla.javascript.NativeJavaObject" ) ) {
     res.setValue( v.getInteger() );
    } else {
     res.setValue( Math.round( ( (Double) result ).doubleValue() ) );
      res.setValue( v.getString() );
     } catch ( Exception ev ) {
origin: pentaho/pentaho-kettle

if ( isNull() || v.isNull() ) {
 setNull();
 return this;
if ( ( v.isString() && isNumeric() ) || ( v.isNumeric() && isString() ) ) {
 StringBuilder s;
 String append = "";
 int n;
 if ( v.isString() ) {
  s = new StringBuilder( v.getString() );
  append = v.getString();
  n = (int) getInteger();
 } else {
  s = new StringBuilder( getString() );
  append = getString();
  n = (int) v.getInteger();
 setValue( s );
} else if ( isBigNumber() || v.isBigNumber() ) {
 setValue( ValueDataUtil.multiplyBigDecimals( getBigNumber(), v.getBigNumber(), null ) );
} else if ( isNumber() || v.isNumber() ) {
 setValue( getNumber() * v.getNumber() );
} else if ( isInteger() || v.isInteger() ) {
 setValue( getInteger() * v.getInteger() );
} else {
 throw new KettleValueException( "Multiplication can only be done with numbers or a number and a string!" );
origin: pentaho/pentaho-kettle

public void writeObj( DataOutputStream dos ) throws IOException {
 int type = getType();
 dos.writeInt( getType() );
 dos.writeInt( getLength() );
 dos.writeInt( getPrecision() );
 dos.writeBoolean( isNull() );
 if ( !isNull() ) {
  switch ( type ) {
   case VALUE_TYPE_STRING:
    if ( getString() == null ) {
     dos.writeInt( -1 ); // -1 == null string
    } else {
     String string = getString();
     byte[] chars = string.getBytes( Const.XML_ENCODING );
     dos.writeInt( chars.length );
    if ( getBigNumber() == null ) {
     dos.writeInt( -1 ); // -1 == null string
    } else {
     String string = getBigNumber().toString();
     dos.writeInt( string.length() );
     dos.writeChars( string );
    dos.writeBoolean( getDate() != null );
    if ( getDate() != null ) {
     dos.writeLong( getDate().getTime() );
origin: pentaho/pentaho-kettle

public Value trunc() throws KettleValueException {
 if ( isNull() ) {
  return this; // don't do anything, leave it at NULL!
 }
 if ( isInteger() ) {
  // Nothing
  return this;
 }
 if ( isBigNumber() ) {
  getBigNumber().setScale( 0, BigDecimal.ROUND_FLOOR );
 } else if ( isNumber() ) {
  setValue( Math.floor( getNumber() ) );
 } else if ( isDate() ) {
  Calendar cal = Calendar.getInstance();
  cal.setTime( getDate() );
  cal.set( Calendar.MILLISECOND, 0 );
  cal.set( Calendar.SECOND, 0 );
  cal.set( Calendar.MINUTE, 0 );
  cal.set( Calendar.HOUR_OF_DAY, 0 );
  setValue( cal.getTime() );
 } else {
  throw new KettleValueException( "Function TRUNC only works on numbers and dates" );
 }
 return this;
}
origin: pentaho/pentaho-kettle

if ( other == null || !getName().equals( other.getName() ) || getType() != other.getType() ) {
 return;
switch ( getType() ) {
 case VALUE_TYPE_BIGNUMBER:
  if ( getBigNumber() == null ) {
   setValue( other.getBigNumber() );
  if ( getBytes() == null || getBytes().length == 0 ) {
   if ( other.getBytes() != null && other.getBytes().length > 0 ) {
    setValue( other.getBytes() );
  if ( getDate() == null ) {
   setValue( other.getDate() );
  if ( getInteger() == 0l ) {
   setValue( other.getInteger() );
  if ( getNumber() == 0.0 ) {
   setValue( other.getNumber() );
  if ( Utils.isEmpty( getString() ) && !Utils.isEmpty( other.getString() ) ) {
   setValue( other.getString() );
origin: pentaho/pentaho-kettle

public Value lpad( int len, String padstr ) {
 if ( isNull() ) {
  setType( VALUE_TYPE_STRING );
 } else {
  if ( getType() != VALUE_TYPE_STRING ) {
   // also lpad other types!
   setValue( getString() );
  }
  if ( getString() != null ) {
   StringBuilder result = new StringBuilder( getString() );
   int pad = len;
   int l = ( pad - result.length() ) / padstr.length() + 1;
   int i;
   for ( i = 0; i < l; i++ ) {
    result.insert( 0, padstr );
   }
   // Maybe we added one or two too many!
   i = result.length();
   while ( i > pad && pad > 0 ) {
    result.deleteCharAt( 0 );
    i--;
   }
   setValue( result.toString() );
  } else {
   setNull();
  }
 }
 setLength( len );
 return this;
}
origin: pentaho/pentaho-kettle

/**
 * Constructs a new Value as a copy of another value
 *
 * @param v
 *          The Value to be copied
 */
public Value( Value v ) {
 if ( v != null ) {
  // setType(v.getType()); // Is this really needed???
  value = v.getValueCopy();
  setName( v.getName() );
  setLength( v.getLength(), v.getPrecision() );
  setNull( v.isNull() );
  setOrigin( v.origin );
 } else {
  clearValue();
  setNull( true );
 }
}
origin: pentaho/pentaho-kettle

newValue( theType );
setName( new String( nameBuffer ) );
setLength( dis.readInt(), dis.readInt() );
setNull( dis.readBoolean() );
if ( !isNull() ) {
 switch ( getType() ) {
  case VALUE_TYPE_STRING:
    setValue( (String) null );
   } else {
    byte[] chars = new byte[stringLength];
    dis.readFully( chars );
    setValue( new String( chars, Const.XML_ENCODING ) );
    setValue( (BigDecimal) null );
   } else {
    StringBuilder buffer = new StringBuilder();
    setValue( buffer.toString() );
    try {
     convertString( VALUE_TYPE_BIGNUMBER );
    } catch ( KettleValueException e ) {
     throw new IOException(
      "Unable to convert String to BigNumber while reading from data input stream ["
       + getString() + "]" );
origin: pentaho/pentaho-kettle

public Value dat2num() throws KettleValueException {
 if ( isNull() ) {
  setType( VALUE_TYPE_INTEGER );
  return this;
 }
 if ( getType() == VALUE_TYPE_DATE ) {
  if ( getString() == null ) {
   setNull();
   setValue( 0L );
  } else {
   setValue( getInteger() );
  }
 } else {
  throw new KettleValueException( "Function DAT2NUM works only on dates" );
 }
 return this;
}
origin: pentaho/pentaho-kettle

if ( value == null || value.isNull() ) {
 return null;
  return value.getString();
 case ValueMetaInterface.TYPE_NUMBER:
  return value.getNumber();
 case ValueMetaInterface.TYPE_INTEGER:
  return value.getInteger();
 case ValueMetaInterface.TYPE_DATE:
  return value.getDate();
 case ValueMetaInterface.TYPE_BOOLEAN:
  return value.getBoolean();
 case ValueMetaInterface.TYPE_BIGNUMBER:
  return value.getBigNumber();
 case ValueMetaInterface.TYPE_BINARY:
  return value.getBytes();
 default:
  throw new KettleValueException( toString() + " : We can't convert original data type " + value.getTypeDesc()
    + " to a primitive data type" );
origin: pentaho/pentaho-kettle

public Value divide( Value v ) throws KettleValueException {
 if ( isNull() || v.isNull() ) {
  setNull();
 } else {
  switch ( getType() ) {
   case VALUE_TYPE_BIGNUMBER:
    setValue( getBigNumber().divide( v.getBigNumber(), BigDecimal.ROUND_HALF_UP ) );
    break;
   case VALUE_TYPE_NUMBER:
    setValue( getNumber() / v.getNumber() );
    break;
   case VALUE_TYPE_INTEGER:
    setValue( getInteger() / v.getInteger() );
    break;
   case VALUE_TYPE_BOOLEAN:
   case VALUE_TYPE_STRING:
   default:
    throw new KettleValueException( "Division can only be done with numeric data!" );
  }
 }
 return this;
}
origin: pentaho/pentaho-kettle

public Value plus( Value v ) {
 switch ( getType() ) {
  case VALUE_TYPE_BIGNUMBER:
   setValue( getBigNumber().add( v.getBigNumber() ) );
   break;
  case VALUE_TYPE_NUMBER:
   setValue( getNumber() + v.getNumber() );
   break;
  case VALUE_TYPE_INTEGER:
   setValue( getInteger() + v.getInteger() );
   break;
  case VALUE_TYPE_BOOLEAN:
   setValue( getBoolean() | v.getBoolean() );
   break;
  case VALUE_TYPE_STRING:
   setValue( getString() + v.getString() );
   break;
  default:
   break;
 }
 return this;
}
origin: pentaho/pentaho-kettle

public Value num2dat() throws KettleValueException {
 if ( isNull() ) {
  setType( VALUE_TYPE_DATE );
 } else {
  if ( isNumeric() ) {
   setValue( new Date( getInteger() ) );
   setLength( -1, -1 );
  } else {
   throw new KettleValueException( "Function NUM2DAT only works on a number" );
  }
 }
 return this;
}
org.pentaho.di.compatibilityValue

Javadoc

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.)

Most used methods

  • setValue
    Sets the Value to a byte array
  • <init>
    Construct a new Value and read the data from XML
  • getBigNumber
    Get the BigDecimal number of this Value. If the value is not of type BIG_NUMBER, a conversion is don
  • getDate
    Get the Date of this Value. If the Value is not of type DATE, a conversion is done first.
  • getInteger
    Get the long integer representation of this value. If the Value is not of type INTEGER, it will be c
  • getNumber
    Get the double precision floating point number of this Value. If the value is not of type NUMBER, a
  • getString
    Get the String text representing this value. If the value is not of type STRING, a conversion if don
  • isNull
    Checks wheter or not a value is null.
  • setLength
    Sets the length and the precision of the Number, Integer or String to the specified length & precisi
  • setName
    Sets the name of a Value
  • setNull
    Sets or unsets a value to null, no type is being changed.
  • setType
    Set the type of this Value
  • setNull,
  • setType,
  • toString,
  • atan2,
  • clearValue,
  • compare,
  • convertString,
  • convertTo,
  • dat2str,
  • divide

Popular in Java

  • Reading from database using SQL prepared statement
  • runOnUiThread (Activity)
  • startActivity (Activity)
  • setRequestProperty (URLConnection)
    Sets the general request property. If a property with the key already exists, overwrite its value wi
  • OutputStream (java.io)
    A writable sink for bytes.Most clients will use output streams that write data to the file system (
  • System (java.lang)
    Provides access to system-related information and resources including standard input and output. Ena
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • Stream (java.util.stream)
    A sequence of elements supporting sequential and parallel aggregate operations. The following exampl
  • BoxLayout (javax.swing)
  • JButton (javax.swing)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now