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

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

Best Java code snippets using org.pentaho.di.compatibility.Value.getInteger (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

/**
 * Check whether this value is equal to the Integer supplied.
 *
 * @param number
 *          The Integer to check for equality
 * @return true if the Integer representation of the value is equal to number.
 */
public boolean isEqualTo( long number ) {
 return getInteger() == number;
}
origin: pentaho/pentaho-kettle

/**
 * Check whether this value is equal to the Integer supplied.
 *
 * @param number
 *          The Integer to check for equality
 * @return true if the Integer representation of the value is equal to number.
 */
public boolean isEqualTo( int number ) {
 return getInteger() == number;
}
origin: pentaho/pentaho-kettle

/**
 * Check whether this value is equal to the Integer supplied.
 *
 * @param number
 *          The Integer to check for equality
 * @return true if the Integer representation of the value is equal to number.
 */
public boolean isEqualTo( byte number ) {
 return getInteger() == number;
}
origin: pentaho/pentaho-kettle

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

public Value and( Value v ) {
 long n1 = getInteger();
 long n2 = v.getInteger();
 long res = n1 & n2;
 setValue( res );
 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

/**
 * Search for a value, if it doesn't occur in the row, return the default value.
 *
 * @param valuename
 *          The valuename to look for
 * @param def
 *          The default value to return
 * @return The long integer representation of the value found or the default
 */
public long getInteger( String valuename, long def ) {
 Value v = searchValue( valuename );
 if ( v == null ) {
  return def;
 }
 return v.getInteger();
}
origin: pentaho/pentaho-kettle

/**
 * Search for a value, if it doesn't occur in the row, return the default value.
 *
 * @param valuename
 *          The valuename to look for
 * @param def
 *          The default value to return
 * @return The short integer representation of the value found or the default
 */
public long getShort( String valuename, int def ) {
 Value v = searchValue( valuename );
 if ( v == null ) {
  return def;
 }
 return (int) v.getInteger();
}
origin: pentaho/pentaho-kettle

public static Long jsToInteger( Object value, Class<?> clazz ) {
 if ( Number.class.isAssignableFrom( clazz ) ) {
  return ( (Number) value ).longValue();
 } else {
  String classType = clazz.getName();
  if ( classType.equalsIgnoreCase( "java.lang.String" ) ) {
   return ( new Long( (String) value ) );
  } else if ( classType.equalsIgnoreCase( "org.mozilla.javascript.Undefined" ) ) {
   return null;
  } else if ( classType.equalsIgnoreCase( "org.mozilla.javascript.NativeNumber" ) ) {
   Number nb = Context.toNumber( value );
   return nb.longValue();
  } else if ( classType.equalsIgnoreCase( "org.mozilla.javascript.NativeJavaObject" ) ) {
   // Is it a Value?
   //
   try {
    Value v = (Value) Context.jsToJava( value, Value.class );
    return v.getInteger();
   } catch ( Exception e2 ) {
    String string = Context.toString( value );
    return Long.parseLong( Const.trim( string ) );
   }
  } else {
   return Long.parseLong( value.toString() );
  }
 }
}
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;
}
origin: pentaho/pentaho-kettle

public Value minus( Value v ) throws KettleValueException {
 switch ( getType() ) {
  case VALUE_TYPE_BIGNUMBER:
   value.setBigNumber( getBigNumber().subtract( v.getBigNumber() ) );
   break;
  case VALUE_TYPE_NUMBER:
   value.setNumber( getNumber() - v.getNumber() );
   break;
  case VALUE_TYPE_INTEGER:
   value.setInteger( getInteger() - v.getInteger() );
   break;
  case VALUE_TYPE_BOOLEAN:
  case VALUE_TYPE_STRING:
  default:
   throw new KettleValueException( "Subtraction can only be done with numbers!" );
 }
 return this;
}
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

if ( getInteger() > 0 ) {
 value.setInteger( 1 );
} else if ( getInteger() < 0 ) {
 value.setInteger( -1 );
} else {
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

  s = new StringBuilder( v.getString() );
  append = v.getString();
  n = (int) getInteger();
 } else {
  s = new StringBuilder( getString() );
  append = getString();
  n = (int) v.getInteger();
} 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 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

/**
 * Convert this Value from type String to another type
 *
 * @param newtype
 *          The Value type to convert to.
 */
public void convertString( int newtype ) throws KettleValueException {
 switch ( newtype ) {
  case VALUE_TYPE_STRING:
   break;
  case VALUE_TYPE_NUMBER:
   setValue( getNumber() );
   break;
  case VALUE_TYPE_DATE:
   setValue( getDate() );
   break;
  case VALUE_TYPE_BOOLEAN:
   setValue( getBoolean() );
   break;
  case VALUE_TYPE_INTEGER:
   setValue( getInteger() );
   break;
  case VALUE_TYPE_BIGNUMBER:
   setValue( getBigNumber() );
   break;
  default:
   throw new KettleValueException( "Please specify the type to convert to from String type." );
 }
}
origin: pentaho/pentaho-kettle

 return value.getNumber();
case ValueMetaInterface.TYPE_INTEGER:
 return value.getInteger();
case ValueMetaInterface.TYPE_DATE:
 return value.getDate();
origin: pentaho/pentaho-kettle

if ( getInteger() == 0l ) {
 setValue( other.getInteger() );
org.pentaho.di.compatibilityValuegetInteger

Javadoc

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:00

Date: always false.

Popular methods of Value

  • 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.
  • 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
  • toString
    a String text representation of this Value, optionally padded to the specified length
  • setType,
  • toString,
  • atan2,
  • clearValue,
  • compare,
  • convertString,
  • convertTo,
  • dat2str,
  • divide

Popular in Java

  • Making http post requests using okhttp
  • putExtra (Intent)
  • onRequestPermissionsResult (Fragment)
  • getSystemService (Context)
  • ConnectException (java.net)
    A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
  • Socket (java.net)
    Provides a client-side TCP socket.
  • Callable (java.util.concurrent)
    A task that returns a result and may throw an exception. Implementors define a single method with no
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
  • SSLHandshakeException (javax.net.ssl)
    The exception that is thrown when a handshake could not be completed successfully.
  • Options (org.apache.commons.cli)
    Main entry-point into the library. Options represents a collection of Option objects, which describ
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