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


Java ValueMetaInterface.getBoolean方法代码示例

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


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

示例1: getPrimitive

import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的package包/类
public static Object getPrimitive(ValueMetaInterface valueMeta, Object valueData) throws KettleValueException
{
    switch(valueMeta.getType())
    {
    case ValueMetaInterface.TYPE_BIGNUMBER: return valueMeta.getBigNumber(valueData);
    case ValueMetaInterface.TYPE_BINARY: return valueMeta.getBinary(valueData);
    case ValueMetaInterface.TYPE_BOOLEAN: return valueMeta.getBoolean(valueData);
    case ValueMetaInterface.TYPE_DATE: return valueMeta.getDate(valueData);
    case ValueMetaInterface.TYPE_INTEGER: valueMeta.getInteger(valueData);
    case ValueMetaInterface.TYPE_NUMBER: return valueMeta.getNumber(valueData);
    // case ValueMetaInterface.TYPE_SERIALIZABLE: return valueMeta.(valueData);
    case ValueMetaInterface.TYPE_STRING: return valueMeta.getString(valueData);
    default: return null;
    }
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:16,代码来源:RowForumulaContext.java

示例2: messageToBytes

import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的package包/类
protected byte[] messageToBytes( Object message, ValueMetaInterface messageValueMeta ) throws KettleValueException {
  if ( message == null || Const.isEmpty( message.toString() ) ) {
    return null;
  }

  byte[] result = null;
  try {
    ByteBuffer buff = null;
    switch ( messageValueMeta.getType() ) {
      case ValueMetaInterface.TYPE_STRING:
        result = message.toString().getBytes( "UTF-8" );
        break;
      case ValueMetaInterface.TYPE_INTEGER:
      case ValueMetaInterface.TYPE_DATE: // send the date as a long (milliseconds) value
        buff = ByteBuffer.allocate( 8 );
        buff.putLong( messageValueMeta.getInteger( message ) );
        result = buff.array();
        break;
      case ValueMetaInterface.TYPE_NUMBER:
        buff = ByteBuffer.allocate( 8 );
        buff.putDouble( messageValueMeta.getNumber( message ) );
        result = buff.array();
        break;
      case ValueMetaInterface.TYPE_TIMESTAMP:
        buff = ByteBuffer.allocate( 12 );
        Timestamp ts = (Timestamp) message;
        buff.putLong( ts.getTime() );
        buff.putInt( ts.getNanos() );
        result = buff.array();
        break;
      case ValueMetaInterface.TYPE_BINARY:
        result = messageValueMeta.getBinary( message );
        break;
      case ValueMetaInterface.TYPE_BOOLEAN:
        result = new byte[1];
        if ( messageValueMeta.getBoolean( message ) ) {
          result[0] = 1;
        }
        break;
      case ValueMetaInterface.TYPE_SERIALIZABLE:
        if ( !( message instanceof Serializable ) ) {
          throw new KettleValueException( "Message value is not serializable!" );
        }
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        ObjectOutputStream oos = new ObjectOutputStream( bos );
        oos.writeObject( message );
        oos.flush();
        result = bos.toByteArray();
        break;
    }
  } catch ( Exception ex ) {
    throw new KettleValueException( ex );
  }

  return result;
}
 
开发者ID:pentaho-labs,项目名称:pentaho-mqtt-plugin,代码行数:57,代码来源:MQTTPublisher.java

示例3: rowsToCSV

import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的package包/类
protected static StringBuilder rowsToCSV( RowMetaInterface meta, List<Object[]> rows ) throws KettleValueException {
  StringBuilder builder = new StringBuilder();
  // header row
  int i = 0;
  for ( ValueMetaInterface v : meta.getValueMetaList() ) {
    String name = quote( v.getName() );
    builder.append( i > 0 ? "," : "" ).append( name );
    i++;
  }
  builder.append( "\n" );
  for ( Object[] row : rows ) {
    for ( i = 0; i < meta.size(); i++ ) {
      String value;
      ValueMetaInterface vm = meta.getValueMeta( i );
      if ( row[i] == null || Const.isEmpty( vm.getString( row[i] ) ) ) {
        value = "?";
      } else {
        //switch ( meta.getValueMetaList().get( i ).getType() ) {
        switch ( vm.getType() ) {
          case ValueMetaInterface.TYPE_NUMBER:
          case ValueMetaInterface.TYPE_INTEGER:
          case ValueMetaInterface.TYPE_BIGNUMBER:
            value = vm.getString( row[i] );
            break;
          case ValueMetaInterface.TYPE_DATE:
            int offset = TZ.getOffset( vm.getDate( row[i] ).getTime() );
            value = "" + ( vm.getDate( row[i] ).getTime() + offset );
            break;
          case ValueMetaInterface.TYPE_TIMESTAMP:
            offset = TZ.getOffset( vm.getDate( row[i] ).getTime() );
            value = "" + ( vm.getDate( row[i] ).getTime() + offset );
            break;
          case ValueMetaInterface.TYPE_BOOLEAN:
            value = "" + ( vm.getBoolean( row[i] ) ? "1" : "0" );
            break;
          // TODO throw an exception for Serializable/Binary
          default:
            value = quote( vm.getString( row[i] ) );
        }
      }
      builder.append( i > 0 ? "," : "" ).append( value );
    }
    builder.append( "\n" );
  }

  return builder;
}
 
开发者ID:pentaho-labs,项目名称:pentaho-cpython-plugin,代码行数:48,代码来源:ServerUtils.java

示例4: writeRowToBulk

import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的package包/类
private void writeRowToBulk(RowMetaInterface rowMeta, Object[] r) throws KettleException {

    	try {
    		for (int i=0;i<data.keynrs.length;i++) {
	    		int index = data.keynrs[i];
	    		ValueMetaInterface valueMeta = rowMeta.getValueMeta(index);
	    		Object valueData = r[index];
	    		

	    		switch(valueMeta.getType()) {
	    		case ValueMetaInterface.TYPE_STRING :
	    			data.fifoStream.write(TeraDataBulkLoaderRoutines.convertVarchar(valueMeta.getString(valueData)));
	    			break;
	    		case ValueMetaInterface.TYPE_INTEGER:
	    			data.fifoStream.write(TeraDataBulkLoaderRoutines.convertLong(valueMeta.getInteger(valueData)));
	    			break;
	    		case ValueMetaInterface.TYPE_DATE:
	    			Date date = valueMeta.getDate(valueData);
	    			data.fifoStream.write(TeraDataBulkLoaderRoutines.convertDateTime(date));
	    			break;
	    		case ValueMetaInterface.TYPE_BOOLEAN:
	    			Boolean b= valueMeta.getBoolean(valueData);
	    			data.fifoStream.write(TeraDataBulkLoaderRoutines.convertBoolean(b));
	    			break;
	    		case ValueMetaInterface.TYPE_NUMBER:
	    			Double d = valueMeta.getNumber(valueData);
	    			data.fifoStream.write(TeraDataBulkLoaderRoutines.convertFloat(d));
	    			break;
	    		case ValueMetaInterface.TYPE_BIGNUMBER:
	    			BigDecimal bn = valueMeta.getBigNumber(valueData);
	    			data.fifoStream.write(TeraDataBulkLoaderRoutines.convertBignum(bn));
	    			break;
	    		default:
	    			logError("This is seen when a type in the PDI stream is not handleed by the step.  Type is "+valueMeta.getType());
	    			throw new KettleException("Unsupported type in stream");
	    		}
    		}
			
    	}
    	catch(IOException e)
    	{
    		// If something went wrong with writing to the fifo, get the underlying error from MySQL  
    		try{
    			logError("IOException writing to fifo.  Waiting up to " + this.threadWaitTimeText + " for the tbuild command thread to return with the error.");
    		}
    		catch (Exception loadEx){
         		logError("Caught Loadex error :"+ loadEx);
    			throw new KettleException("loadEx Error serializing rows of data to the fifo file 1", loadEx);
    		}
    		
			// throw the generic "Pipe" exception.
    		logError("Caught IO error (pipe?):"+ e);
			throw new KettleException("IO Error serializing rows of data to the fifo file 2", e);

    	}
    	catch (Exception e2){ 
    		logError("Caught some error :"+ e2);
    		// Null pointer exceptions etc.
    		throw new KettleException("Error serializing rows of data to the fifo file", e2);
    	}
	}
 
开发者ID:jbleuel,项目名称:pdi-teradata-tpt-plugin,代码行数:62,代码来源:TeraDataBulkLoader.java

示例5: createObjectsForRow

import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的package包/类
public static Object[] createObjectsForRow(RowMetaInterface rowMeta, Object[] rowData) throws KettleValueException
{
    Object[] values = new Object[rowMeta.size()];
    for (int i=0;i<rowMeta.size();i++)
    {
        ValueMetaInterface valueMeta = rowMeta.getValueMeta(i);
        Object valueData = rowData[i];
        
        int length = valueMeta.getLength();
        
        switch(valueMeta.getType())
        {
        case ValueMetaInterface.TYPE_INTEGER:
            if (length<3)
            {
                values[i] = new Byte( valueMeta.getInteger(valueData).byteValue() );
            }
            else
            {
                if (length<5)
                {
                    values[i] = new Short(valueMeta.getInteger(valueData).shortValue());
                }
                else
                {
                    values[i] = valueMeta.getInteger(valueData);
                }
            }
            break;
        case ValueMetaInterface.TYPE_NUMBER:
            values[i] = valueMeta.getNumber(valueData);
            break;
        case ValueMetaInterface.TYPE_DATE:
            values[i] = valueMeta.getDate(valueData);
            break;
        case ValueMetaInterface.TYPE_STRING:
            values[i] = valueMeta.getString(valueData);
            break;
        case ValueMetaInterface.TYPE_BINARY:
            values[i] = valueMeta.getBinary(valueData);
            break;
        case ValueMetaInterface.TYPE_BOOLEAN:
            values[i] = valueMeta.getBoolean(valueData);
            break;
        case ValueMetaInterface.TYPE_BIGNUMBER:
            values[i] = valueMeta.getNumber(valueData);
            break;
        default: break;
        }
    }
    return values;
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:53,代码来源:AccessOutputMeta.java

示例6: createObjectsForRow

import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的package包/类
public static Object[] createObjectsForRow(RowMetaInterface rowMeta, Object[] rowData) throws KettleValueException
{
    Object[] values = new Object[rowMeta.size()];
    for (int i=0;i<rowMeta.size();i++)
    {
        ValueMetaInterface valueMeta = rowMeta.getValueMeta(i);
        Object valueData = rowData[i];

        // Prevent a NullPointerException below
        if (valueData == null || valueMeta == null)
        {
          values[i] = null;
          continue;
        }

        int length = valueMeta.getLength();
        
        switch(valueMeta.getType())
        {
        case ValueMetaInterface.TYPE_INTEGER:
            if (length<3)
            {
                values[i] = new Byte( valueMeta.getInteger(valueData).byteValue() );
            }
            else
            {
                if (length<5)
                {
                    values[i] = new Short(valueMeta.getInteger(valueData).shortValue());
                }
                else
                {
                    values[i] = valueMeta.getInteger(valueData);
                }
            }
            break;
        case ValueMetaInterface.TYPE_NUMBER:
            values[i] = valueMeta.getNumber(valueData);
            break;
        case ValueMetaInterface.TYPE_DATE:
            values[i] = valueMeta.getDate(valueData);
            break;
        case ValueMetaInterface.TYPE_STRING:
            values[i] = valueMeta.getString(valueData);
            break;
        case ValueMetaInterface.TYPE_BINARY:
            values[i] = valueMeta.getBinary(valueData);
            break;
        case ValueMetaInterface.TYPE_BOOLEAN:
            values[i] = valueMeta.getBoolean(valueData);
            break;
        case ValueMetaInterface.TYPE_BIGNUMBER:
            values[i] = valueMeta.getNumber(valueData);
            break;
        default: break;
        }
    }
    return values;
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:60,代码来源:AccessOutputMeta.java


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