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


Java ValueMetaInterface.TYPE_SERIALIZABLE属性代码示例

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


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

示例1: getCassandraTypeForValueMeta

/**
 * Return the Cassandra column type (internal cassandra class name relative to
 * org.apache.cassandra.db.marshal) for the given Kettle column.
 * 
 * @param vm the ValueMetaInterface for the Kettle column
 * @return the corresponding internal cassandra type.
 */
public static String getCassandraTypeForValueMeta(ValueMetaInterface vm) {
  switch (vm.getType()) {
  case ValueMetaInterface.TYPE_STRING:
    return "UTF8Type";
  case ValueMetaInterface.TYPE_BIGNUMBER:
    return "DecimalType";
  case ValueMetaInterface.TYPE_BOOLEAN:
    return "BooleanType";
  case ValueMetaInterface.TYPE_INTEGER:
    return "LongType";
  case ValueMetaInterface.TYPE_NUMBER:
    return "DoubleType";
  case ValueMetaInterface.TYPE_DATE:
    return "DateType";
  case ValueMetaInterface.TYPE_BINARY:
  case ValueMetaInterface.TYPE_SERIALIZABLE:
    return "BytesType";
  }

  return "UTF8Type";
}
 
开发者ID:javachen,项目名称:learning-hadoop,代码行数:28,代码来源:CassandraColumnMetaData.java

示例2: getCQLTypeForValueMeta

/**
 * Return the Cassandra CQL column/key type for the given Kettle column. We
 * use this type for CQL create column family statements since, for some
 * reason, the internal type isn't recognized for the key. Internal types
 * *are* recognized for column definitions. The CQL reference guide states
 * that fully qualified (or relative to org.apache.cassandra.db.marshal) class
 * names can be used instead of CQL types - however, using these when defining
 * the key type always results in BytesType getting set for the key for some
 * reason.
 * 
 * @param vm the ValueMetaInterface for the Kettle column
 * @return the corresponding CQL type
 */
public static String getCQLTypeForValueMeta(ValueMetaInterface vm) {
  switch (vm.getType()) {
  case ValueMetaInterface.TYPE_STRING:
    return "varchar";
  case ValueMetaInterface.TYPE_BIGNUMBER:
    return "decimal";
  case ValueMetaInterface.TYPE_BOOLEAN:
    return "boolean";
  case ValueMetaInterface.TYPE_INTEGER:
    return "bigint";
  case ValueMetaInterface.TYPE_NUMBER:
    return "double";
  case ValueMetaInterface.TYPE_DATE:
    return "timestamp";
  case ValueMetaInterface.TYPE_BINARY:
  case ValueMetaInterface.TYPE_SERIALIZABLE:
    return "blob";
  }

  return "blob";
}
 
开发者ID:javachen,项目名称:learning-hadoop,代码行数:34,代码来源:CassandraColumnMetaData.java

示例3: convertDataType

public static int convertDataType(DataType type) {
    switch (type.getName()) {
    	case SMALLINT: 
        case INT:
        case BIGINT:
        case COUNTER:
        case TIME:
        	return ValueMetaInterface.TYPE_INTEGER; // 5 > java.lang.Long
        case ASCII:
        case TEXT:
        case VARCHAR:
        case UUID:
        case TIMEUUID:            	
            return ValueMetaInterface.TYPE_STRING; // 2 > java.lang.String
        case INET:
        	return ValueMetaInterface.TYPE_INET; // 10 > 
        case BOOLEAN:
            return ValueMetaInterface.TYPE_BOOLEAN; // 4 > java.lang.Boolean
        case DECIMAL:
        case FLOAT:
        case DOUBLE:
            return ValueMetaInterface.TYPE_NUMBER; // 1 > java.lang.Double
        case VARINT:
            return ValueMetaInterface.TYPE_BIGNUMBER; // 6 > java.math.BigDecimal
        case TIMESTAMP:
            return ValueMetaInterface.TYPE_DATE; // 3 > java.util.Date
        case BLOB:
        	return ValueMetaInterface.TYPE_BINARY; // 8 > java.lang.byte[]
        case LIST:
        case MAP:
        case SET:
        	return ValueMetaInterface.TYPE_SERIALIZABLE; // 0
        default:
        	return ValueMetaInterface.TYPE_STRING;
    }
}
 
开发者ID:bcolas,项目名称:pentaho-cassandra-plugin,代码行数:36,代码来源:Utils.java

示例4: messageArrived

@Override public void messageArrived( String topic, MqttMessage mqttMessage ) throws Exception {
  Object[] outRow = RowDataUtil.allocateRowData( m_data.m_outputRowMeta.size() );
  outRow[0] = topic;
  Object converted = null;

  byte[] raw = mqttMessage.getPayload();
  ByteBuffer buff = null;
  switch ( m_messageValueMeta.getType() ) {
    case ValueMetaInterface.TYPE_INTEGER:
      buff = ByteBuffer.wrap( raw );
      outRow[1] = raw.length == 4 ? (long) buff.getInt() : buff.getLong();
      break;
    case ValueMetaInterface.TYPE_STRING:
    case ValueMetaInterface.TYPE_NONE:
      outRow[1] = new String( raw );
      break;
    case ValueMetaInterface.TYPE_NUMBER:
      buff = ByteBuffer.wrap( raw );
      outRow[1] = raw.length == 4 ? (double) buff.getFloat() : buff.getDouble();
      break;
    case ValueMetaInterface.TYPE_DATE:
      buff = ByteBuffer.wrap( raw );
      outRow[1] = new Date( buff.getLong() );
      break;
    case ValueMetaInterface.TYPE_BINARY:
      outRow[1] = raw;
      break;
    case ValueMetaInterface.TYPE_BOOLEAN:
      outRow[1] = raw[0] > 0;
      break;
    case ValueMetaInterface.TYPE_TIMESTAMP:
      buff = ByteBuffer.wrap( raw );
      long time = buff.getLong();
      int nanos = buff.getInt();
      Timestamp t = new Timestamp( time );
      t.setNanos( nanos );
      outRow[1] = t;
      break;
    case ValueMetaInterface.TYPE_SERIALIZABLE:
      ObjectInputStream ois = new ObjectInputStream( new ByteArrayInputStream( raw ) );
      outRow[1] = ois.readObject();
      break;
    default:
      throw new KettleException( "Unhandled type" );
  }
  putRow( m_data.m_outputRowMeta, outRow );
}
 
开发者ID:pentaho-labs,项目名称:pentaho-mqtt-plugin,代码行数:47,代码来源:MQTTSubscriber.java

示例5: messageToBytes

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,代码行数:56,代码来源:MQTTPublisher.java

示例6: getGetSignature

public static String getGetSignature(String accessor, ValueMetaInterface v) {
	StringBuilder sb = new StringBuilder();
	
	switch (v.getType()) {
		case ValueMetaInterface.TYPE_BIGNUMBER:
			sb.append("BigDecimal ");
			break;
		case ValueMetaInterface.TYPE_BINARY:
			sb.append("byte[] ");
			break;
		case ValueMetaInterface.TYPE_BOOLEAN:
			sb.append("Boolean ");
			break;
		case ValueMetaInterface.TYPE_DATE:
			sb.append("Date ");
			break;
		case ValueMetaInterface.TYPE_INTEGER:
			sb.append("Long ");
			break;
		case ValueMetaInterface.TYPE_NUMBER:
			sb.append("Double ");
			break;
		case ValueMetaInterface.TYPE_STRING:
			sb.append("String ");
			break;
		case ValueMetaInterface.TYPE_SERIALIZABLE:
		default:
			sb.append("Object ");
			break;
	}

	if (validJavaIdentifier.matcher(v.getName()).matches()) {
		sb.append(v.getName());
	} else {
		sb.append("value");
	}
	String typeDesc = v.getTypeDesc();
	sb.append(" = ").append(accessor)
	  .append(".get").append("-".equals(typeDesc) ? "Object" : typeDesc).append("(r);");
	
	return sb.toString();
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:42,代码来源:FieldHelper.java


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