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


Java ColumnDefinitions.getType方法代码示例

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


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

示例1: doesRowSatisfyCondition

import com.datastax.driver.core.ColumnDefinitions; //导入方法依赖的package包/类
public boolean doesRowSatisfyCondition(Row row, Map<String, Object> condition){
	ColumnDefinitions colInfo = row.getColumnDefinitions();
	
	for (Map.Entry<String, Object> entry : condition.entrySet()){
		String colName = entry.getKey();
		DataType colType = colInfo.getType(colName);
		Object columnValue = getColValue(row, colName, colType);
		Object conditionValue = convertToActualDataType(colType, entry.getValue());
		if(columnValue.equals(conditionValue) == false)
			return false;		
	}
	return true;	
}
 
开发者ID:att,项目名称:music,代码行数:14,代码来源:MusicDataStore.java

示例2: equalsColumns

import com.datastax.driver.core.ColumnDefinitions; //导入方法依赖的package包/类
@SuppressWarnings("rawtypes")
private void equalsColumns(ColumnDefinitions resCols, Map<String, String> dataTableColumns) {
    Iterator it = dataTableColumns.entrySet().iterator();
    while (it.hasNext()) {
        Map.Entry e = (Map.Entry) it.next();
        assertThat(resCols.toString()).as("The table not contains the column.").contains(e.getKey().toString());
        DataType type = resCols.getType(e.getKey().toString());
        assertThat(type.getName().toString()).as("The column type is not equals.").isEqualTo(e.getValue().toString());
    }
}
 
开发者ID:Stratio,项目名称:bdt,代码行数:11,代码来源:ThenGSpec.java

示例3: mapRow

import com.datastax.driver.core.ColumnDefinitions; //导入方法依赖的package包/类
final void mapRow(FieldMapContext context, Row row, ColumnDefinitions columns, IndexDocument target,
		Set<String> filePathSet)
		throws InstantiationException, IllegalAccessException, ClassNotFoundException, SearchLibException,
		ParseException, IOException, SyntaxError, URISyntaxException, InterruptedException {

	for (GenericLink<SourceField, CommonFieldTarget> link : getList()) {
		final String columnName = link.getSource().getUniqueName();
		if (!columns.contains(columnName))
			continue;
		final DataType columnType = columns.getType(columnName);
		final CommonFieldTarget targetField = link.getTarget();
		if (targetField.isCrawlFile() && columnType.getName().isCompatibleWith(DataType.Name.BLOB)) {
			handleBlob(context, row, columns, target, filePathSet, columnName, targetField);
			continue;
		}
		final Object rowValue = row.getObject(columnName);
		if (rowValue != null) {
			if (rowValue instanceof Collection) {
				for (Object value : ((Collection) rowValue))
					if (value != null)
						mapFieldTarget(context, link.getTarget(), false, value.toString(), target, filePathSet);
			} else
				mapFieldTarget(context, link.getTarget(), false, rowValue.toString(), target, filePathSet);
		}
	}

}
 
开发者ID:jaeksoft,项目名称:opensearchserver,代码行数:28,代码来源:DatabaseCassandraFieldMap.java

示例4: activate

import com.datastax.driver.core.ColumnDefinitions; //导入方法依赖的package包/类
@Override
public void activate(Context.OperatorContext context)
{
  com.datastax.driver.core.ResultSet rs
      = store.getSession().execute("select * from " + store.keyspace + "." + tablename);
  final ColumnDefinitions rsMetaData = rs.getColumnDefinitions();

  if (fieldInfos == null) {
    populateFieldInfosFromPojo(rsMetaData);
  }

  for (FieldInfo fieldInfo : getFieldInfos()) {
    // get the designated column's data type.
    final DataType type = rsMetaData.getType(fieldInfo.getColumnName());
    columnDataTypes.add(type);
    final Object getter;
    final String getterExpr = fieldInfo.getPojoFieldExpression();
    switch (type.getName()) {
      case ASCII:
      case TEXT:
      case VARCHAR:
        getter = PojoUtils.createGetter(pojoClass, getterExpr, String.class);
        break;
      case BOOLEAN:
        getter = PojoUtils.createGetterBoolean(pojoClass, getterExpr);
        break;
      case INT:
        getter = PojoUtils.createGetterInt(pojoClass, getterExpr);
        break;
      case BIGINT:
      case COUNTER:
        getter = PojoUtils.createGetterLong(pojoClass, getterExpr);
        break;
      case FLOAT:
        getter = PojoUtils.createGetterFloat(pojoClass, getterExpr);
        break;
      case DOUBLE:
        getter = PojoUtils.createGetterDouble(pojoClass, getterExpr);
        break;
      case DECIMAL:
        getter = PojoUtils.createGetter(pojoClass, getterExpr, BigDecimal.class);
        break;
      case SET:
        getter = PojoUtils.createGetter(pojoClass, getterExpr, Set.class);
        break;
      case MAP:
        getter = PojoUtils.createGetter(pojoClass, getterExpr, Map.class);
        break;
      case LIST:
        getter = PojoUtils.createGetter(pojoClass, getterExpr, List.class);
        break;
      case TIMESTAMP:
        getter = PojoUtils.createGetter(pojoClass, getterExpr, Date.class);
        break;
      case UUID:
        getter = PojoUtils.createGetter(pojoClass, getterExpr, UUID.class);
        break;
      default:
        getter = PojoUtils.createGetter(pojoClass, getterExpr, Object.class);
        break;
    }
    getters.add(getter);
  }
  super.activate(context);
}
 
开发者ID:apache,项目名称:apex-malhar,代码行数:66,代码来源:CassandraPOJOOutputOperator.java

示例5: activate

import com.datastax.driver.core.ColumnDefinitions; //导入方法依赖的package包/类
@Override
public void activate(OperatorContext context)
{
  Long keyToken;
  if (startRow != null) {
    if ((keyToken = fetchKeyTokenFromDB(startRow)) != null) {
      startRowToken = keyToken;
    }
  }

  com.datastax.driver.core.ResultSet rs = store.getSession().execute("select * from " + store.keyspace + "." + tablename + " LIMIT " + 1);
  ColumnDefinitions rsMetaData = rs.getColumnDefinitions();

  if (query.contains("%t")) {
    query = query.replace("%t", tablename);
  }
  if (query.contains("%p")) {
    query = query.replace("%p", primaryKeyColumn);
  }
  if (query.contains("%l")) {
    query = query.replace("%l", limit + "");
  }

  LOG.debug("query is {}", query);

  for (FieldInfo fieldInfo : fieldInfos) {
    // Get the designated column's data type.
    DataType type = rsMetaData.getType(fieldInfo.getColumnName());
    columnDataTypes.add(type);
    Object setter;
    final String setterExpr = fieldInfo.getPojoFieldExpression();
    switch (type.getName()) {
      case ASCII:
      case TEXT:
      case VARCHAR:
        setter = PojoUtils.createSetter(pojoClass, setterExpr, String.class);
        break;
      case BOOLEAN:
        setter = PojoUtils.createSetterBoolean(pojoClass, setterExpr);
        break;
      case INT:
        setter = PojoUtils.createSetterInt(pojoClass, setterExpr);
        break;
      case BIGINT:
      case COUNTER:
        setter = PojoUtils.createSetterLong(pojoClass, setterExpr);
        break;
      case FLOAT:
        setter = PojoUtils.createSetterFloat(pojoClass, setterExpr);
        break;
      case DOUBLE:
        setter = PojoUtils.createSetterDouble(pojoClass, setterExpr);
        break;
      case DECIMAL:
        setter = PojoUtils.createSetter(pojoClass, setterExpr, BigDecimal.class);
        break;
      case SET:
        setter = PojoUtils.createSetter(pojoClass, setterExpr, Set.class);
        break;
      case MAP:
        setter = PojoUtils.createSetter(pojoClass, setterExpr, Map.class);
        break;
      case LIST:
        setter = PojoUtils.createSetter(pojoClass, setterExpr, List.class);
        break;
      case TIMESTAMP:
        setter = PojoUtils.createSetter(pojoClass, setterExpr, Date.class);
        break;
      case UUID:
        setter = PojoUtils.createSetter(pojoClass, setterExpr, UUID.class);
        break;
      default:
        setter = PojoUtils.createSetter(pojoClass, setterExpr, Object.class);
        break;
    }
    setters.add(setter);
  }
}
 
开发者ID:apache,项目名称:apex-malhar,代码行数:79,代码来源:CassandraPOJOInputOperator.java

示例6: of

import com.datastax.driver.core.ColumnDefinitions; //导入方法依赖的package包/类
public static DatastaxColumnKey of(ColumnDefinitions metaData, int column) {
	return new DatastaxColumnKey(metaData.getName(column), column , metaData.getType(column));
}
 
开发者ID:arnaudroger,项目名称:SimpleFlatMapper,代码行数:4,代码来源:DatastaxColumnKey.java

示例7: getDataEntryFromRow

import com.datastax.driver.core.ColumnDefinitions; //导入方法依赖的package包/类
private DataEntry getDataEntryFromRow(Row row, ColumnDefinitions defs) throws DataServiceFault {
    boolean useColumnNumbers = this.isUsingColumnNumbers();
    DataType columnType;
    DataEntry entry = new DataEntry();
    ParamValue paramValue = null;
    for (int i = 0; i < defs.size(); i++) {
        columnType = defs.getType(i);
        if (columnType.getName().equals(DataType.Name.ASCII)) {
            paramValue = new ParamValue(row.getString(i));
        } else if (columnType.getName().equals(DataType.Name.VARCHAR)) {
            paramValue = new ParamValue(row.getString(i));
        } else if (columnType.getName().equals(DataType.Name.TEXT)) {
            paramValue = new ParamValue(row.getString(i));
        } else if (columnType.getName().equals(DataType.Name.BIGINT)) {
            paramValue = new ParamValue(row.isNull(i) ? null : Long.toString(row.getLong(i)));
        } else if (columnType.getName().equals(DataType.Name.BLOB)) {
            paramValue = new ParamValue(this.base64EncodeByteBuffer(row.getBytes(i)));
        } else if (columnType.getName().equals(DataType.Name.BOOLEAN)) {
            paramValue = new ParamValue(row.isNull(i) ? null : Boolean.toString(row.getBool(i)));
        } else if (columnType.getName().equals(DataType.Name.COUNTER)) {
            paramValue = new ParamValue(row.isNull(i) ? null : Long.toString(row.getLong(i)));
        } else if (columnType.getName().equals(DataType.Name.CUSTOM)) {
            paramValue = new ParamValue(this.base64EncodeByteBuffer(row.getBytes(i)));
        } else if (columnType.getName().equals(DataType.Name.DECIMAL)) {
            paramValue = new ParamValue(row.isNull(i) ? null : row.getDecimal(i).toString());
        } else if (columnType.getName().equals(DataType.Name.DOUBLE)) {
            paramValue = new ParamValue(row.isNull(i) ? null : Double.toString(row.getDouble(i)));
        } else if (columnType.getName().equals(DataType.Name.FLOAT)) {
            paramValue = new ParamValue(row.isNull(i) ? null : Float.toString(row.getFloat(i)));
        } else if (columnType.getName().equals(DataType.Name.INET)) {
            paramValue = new ParamValue(row.isNull(i) ? null :row.getInet(i).toString());
        } else if (columnType.getName().equals(DataType.Name.INT)) {
            paramValue = new ParamValue(row.isNull(i) ? null : Integer.toString(row.getInt(i)));
        } else if (columnType.getName().equals(DataType.Name.LIST)) {
            paramValue = new ParamValue(row.isNull(i) ? null : Arrays.toString(row.getList(i, Object.class)
                                                                                  .toArray()));
        } else if (columnType.getName().equals(DataType.Name.MAP)) {
            paramValue = new ParamValue(row.getMap(i, Object.class, Object.class).toString());
        } else if (columnType.getName().equals(DataType.Name.SET)) {
            paramValue = new ParamValue(row.getSet(i, Object.class).toString());
        } else if (columnType.getName().equals(DataType.Name.TIMESTAMP)) {
            paramValue = new ParamValue(row.isNull(i) ? null : ConverterUtil.convertToString(row.getTimestamp(i)));
        } else if (columnType.getName().equals(DataType.Name.TIMEUUID)) {
            paramValue = new ParamValue(row.getUUID(i).toString());
        } else if (columnType.getName().equals(DataType.Name.UUID)) {
            paramValue = new ParamValue(row.getUUID(i).toString());
        } else if (columnType.getName().equals(DataType.Name.VARINT)) {
            paramValue = new ParamValue(row.getVarint(i).toString());
        } else if (columnType.getName().equals(DataType.Name.UDT)) {
            paramValue = new ParamValue(row.isNull(i) ? null : ConverterUtil.convertToString(row.getUDTValue(i)));
        } else if (columnType.getName().equals(DataType.Name.TUPLE)) {
            paramValue = new ParamValue(row.isNull(i) ? null : ConverterUtil.convertToString(row.getTupleValue(i)));
        } else if (columnType.getName().equals(DataType.Name.TINYINT)) {
            paramValue = new ParamValue(row.isNull(i) ? null : Integer.toString(row.getByte(i)));
        } else if (columnType.getName().equals(DataType.Name.SMALLINT)) {
            paramValue = new ParamValue(row.isNull(i) ? null : Integer.toString(row.getShort(i)));
        } else if (columnType.getName().equals(DataType.Name.TIME)) {
            paramValue = new ParamValue(row.isNull(i) ? null : ConverterUtil.convertToString(row.getTime(i)));
        } else if (columnType.getName().equals(DataType.Name.DATE)) {
            paramValue = new ParamValue(row.isNull(i) ? null : ConverterUtil.convertToString(row.getDate(i)));
        }
        entry.addValue(useColumnNumbers ? Integer.toString(i) : defs.getName(i), paramValue);
    }
    return entry;
}
 
开发者ID:wso2,项目名称:carbon-data,代码行数:66,代码来源:CassandraQuery.java

示例8: getColumnValue

import com.datastax.driver.core.ColumnDefinitions; //导入方法依赖的package包/类
private static Object getColumnValue(String columnName, com.datastax.driver.core.Row row) {
    ColumnDefinitions columns = row.getColumnDefinitions();
    DataType columnType = columns.getType(columnName);
    switch (columnType.getName()) {
    case BIGINT:
        return row.getVarint(columnName);
    case COUNTER:
        return row.getLong(columnName);
    case BLOB:
        return row.getBytes(columnName);
    case BOOLEAN:
        return row.getBool(columnName);
    case DECIMAL:
        return row.getDecimal(columnName);
    case DOUBLE:
        return row.getDouble(columnName);
    case FLOAT:
        return row.getFloat(columnName);
    case INT:
        return row.getInt(columnName);
    case TEXT:
        return row.getString(columnName);
    case TIMESTAMP:
        return row.getTimestamp(columnName);
    case UUID:
        return row.getUUID(columnName);
    case VARCHAR:
        return row.getString(columnName);
    case VARINT:
        return row.getVarint(columnName);
    case LIST:
        return row.getList(columnName, List.class);
    case MAP:
        return row.getMap(columnName, Map.class, String.class);
    case SET:
        return row.getSet(columnName, Set.class);
    case INET:
        return row.getInet(columnName);
    default:
        return row.getString(columnName);
    }
}
 
开发者ID:apache,项目名称:metamodel,代码行数:43,代码来源:CassandraUtils.java


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