cascading.tuple.TupleEntry.setRaw()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(2.6k)|赞(0)|评价(0)|浏览(83)

本文整理了Java中cascading.tuple.TupleEntry.setRaw()方法的一些代码示例,展示了TupleEntry.setRaw()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TupleEntry.setRaw()方法的具体详情如下:
包路径:cascading.tuple.TupleEntry
类名称:TupleEntry
方法名:setRaw

TupleEntry.setRaw介绍

[英]Method set sets the value in the given position.

No coercion is performed if there is an associated coercible type.
[中]方法集设置给定位置的值。
如果存在关联的可强制类型,则不执行强制。

代码示例

代码示例来源:origin: com.hotels/plunger

/**
 * Sets the value by field in the current {@link Tuple}. The field specified can be the {@link Fields} instance, the
 * field name, or the field position. See also the {@link ServiceLoader} for more information on this.
 */
public DataBuilder set(Comparable<?> field, Object value) {
 if (tupleEntry == null) {
  throw new IllegalStateException();
 }
 tupleEntry.setRaw(field, value);
 return this;
}

代码示例来源:origin: com.hotels/plunger

public DataBuilder setTuple(Object... values) {
 if (values.length != fieldMask.size()) {
  throw new IllegalArgumentException("arguments.length {" + values.length + "} != current fieldMask.size() {"
    + fieldMask.size() + ", values=" + Arrays.toString(values) + "}");
 }
 for (int i = 0; i < fieldMask.size(); i++) {
  tupleEntry.setRaw(fieldMask.get(i), values[i]);
 }
 return this;
}

代码示例来源:origin: LiveRamp/cascading_ext

public static <T> void populateOutputTupleEntry(CombinerDefinition<T> definition, TupleEntry output, Tuple resultTuple) {
 //set the ID so we can differentiate later
 output.setRaw(MultiCombiner.ID_FIELD, definition.getId());
 //our tuples are of the form groupFields+outputFields, set the TupleEntry fields appropriately
 Fields groupFields = definition.getGroupFields();
 int index = 0;
 for (int i = 0; i < groupFields.size(); i++) {
  output.setRaw(groupFields.get(i), resultTuple.getObject(index));
  index++;
 }
 Fields outputFields = definition.getOutputFields();
 for (int i = 0; i < outputFields.size(); i++) {
  output.setRaw(outputFields.get(i), resultTuple.getObject(index));
  index++;
 }
}

代码示例来源:origin: cwensel/cascading

results.setString( 1, stringDate );
results.setObject( 2, date );
results.setRaw( 3, date ); // performs no coercion
results.setString( 4, Long.toString( date.getTime() ) );

代码示例来源:origin: cwensel/cascading

@Test
public void testUnmodifiable()
 {
 TupleEntry entryA = new TupleEntry( new Fields( "a", "b" ), true );
 Tuple tuple = new Tuple( "a", "b" );
 entryA.setTuple( tuple );
 assertEquals( "wrong size", 2, tuple.size() );
 assertEquals( "not equal: tuple.get(0)", "a", tuple.getObject( 0 ) );
 try
  {
  entryA.setRaw( "a", "A" );
  fail( "did not fail" );
  }
 catch( Exception exception )
  {
  // do nothing
  }
 try
  {
  entryA.getTuple().set( 0, "A" );
  fail( "did not fail" );
  }
 catch( Exception exception )
  {
  // do nothing
  }
 }

相关文章