当前位置: 首页>>代码示例>>Java>>正文


Java Value.getInteger方法代码示例

本文整理汇总了Java中org.pentaho.di.compatibility.Value.getInteger方法的典型用法代码示例。如果您正苦于以下问题:Java Value.getInteger方法的具体用法?Java Value.getInteger怎么用?Java Value.getInteger使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.pentaho.di.compatibility.Value的用法示例。


在下文中一共展示了Value.getInteger方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getValueData

import org.pentaho.di.compatibility.Value; //导入方法依赖的package包/类
/**
 * Extracts the primitive data from an old style Value object 
 * @param value the old style Value object 
 * @return the value's data, NOT the meta data.
 * @throws KettleValueException  case there is a data conversion problem
 */
public Object getValueData(Value value) throws KettleValueException
{
   if (value==null || value.isNull()) return null;
   
   // So far the old types and the new types map to the same thing.
   // For compatibility we just ask the old-style value to convert to the new one.
   // In the old transformation this would happen sooner or later anyway.
   // It doesn't throw exceptions or complain either (unfortunately).
   //
   
   switch(getType())
   {
   case ValueMetaInterface.TYPE_STRING       : 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();
   // -- Begin GeoKettle modification --
   case ValueMetaInterface.TYPE_GEOMETRY     : return value.getGeometry();
   // -- End GeoKettle modification --
   default: throw new KettleValueException(toString()+" : We can't convert original data type "+value.getTypeDesc()+" to a primitive data type");
   }
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:32,代码来源:ValueMeta.java

示例2: getValueData

import org.pentaho.di.compatibility.Value; //导入方法依赖的package包/类
/**
 * Extracts the primitive data from an old style Value object 
 * @param value the old style Value object 
 * @return the value's data, NOT the meta data.
 * @throws KettleValueException  case there is a data conversion problem
 */
public Object getValueData(Value value) throws KettleValueException
{
   if (value==null || value.isNull()) return null;
   
   // So far the old types and the new types map to the same thing.
   // For compatibility we just ask the old-style value to convert to the new one.
   // In the old transformation this would happen sooner or later anyway.
   // It doesn't throw exceptions or complain either (unfortunately).
   //
   
   switch(getType())
   {
   case ValueMetaInterface.TYPE_STRING       : 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");
   }
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:29,代码来源:ValueMeta.java

示例3: getValueData

import org.pentaho.di.compatibility.Value; //导入方法依赖的package包/类
/**
 * Extracts the primitive data from an old style Value object
 * 
 * @param value
 *          the old style Value object
 * @return the value's data, NOT the meta data.
 * @throws KettleValueException
 *           case there is a data conversion problem
 */
public Object getValueData(Value value) throws KettleValueException {
  if (value == null || value.isNull())
    return null;

  // So far the old types and the new types map to the same thing.
  // For compatibility we just ask the old-style value to convert to the new
  // one.
  // In the old transformation this would happen sooner or later anyway.
  // It doesn't throw exceptions or complain either (unfortunately).
  //

  switch (getType()) {
  case ValueMetaInterface.TYPE_STRING:
    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");
  }
}
 
开发者ID:jjeb,项目名称:kettle-trunk,代码行数:41,代码来源:ValueMetaBase.java

示例4: jsToInteger

import org.pentaho.di.compatibility.Value; //导入方法依赖的package包/类
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() );
    }
  }
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:28,代码来源:JavaScriptUtils.java

示例5: getValueData

import org.pentaho.di.compatibility.Value; //导入方法依赖的package包/类
/**
 * Extracts the primitive data from an old style Value object
 *
 * @param value
 *          the old style Value object
 * @return the value's data, NOT the meta data.
 * @throws KettleValueException
 *           case there is a data conversion problem
 */
@Override
public Object getValueData( Value value ) throws KettleValueException {
  if ( value == null || value.isNull() ) {
    return null;
  }

  // So far the old types and the new types map to the same thing.
  // For compatibility we just ask the old-style value to convert to the new
  // one.
  // In the old transformation this would happen sooner or later anyway.
  // It doesn't throw exceptions or complain either (unfortunately).
  //

  switch ( getType() ) {
    case ValueMetaInterface.TYPE_STRING:
      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" );
  }
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:43,代码来源:ValueMetaBase.java


注:本文中的org.pentaho.di.compatibility.Value.getInteger方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。