本文整理了Java中cascading.tuple.Tuple.isEmpty()
方法的一些代码示例,展示了Tuple.isEmpty()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Tuple.isEmpty()
方法的具体详情如下:
包路径:cascading.tuple.Tuple
类名称:Tuple
方法名:isEmpty
[英]Method isEmpty returns true if this Tuple instance has no values.
[中]如果此元组实例没有值,则方法isEmpty返回true。
代码示例来源:origin: elastic/elasticsearch-hadoop
@Override
public void convert(Object from, BytesArray to) {
// expect a tuple holding one field - chararray or bytearray
Assert.isTrue(from instanceof SinkCall,
String.format("Unexpected object type, expecting [%s], given [%s]", SinkCall.class, from.getClass()));
// handle common cases
SinkCall sinkCall = (SinkCall) from;
Tuple rawTuple = sinkCall.getOutgoingEntry().getTuple();
if (rawTuple == null || rawTuple.isEmpty()) {
to.bytes("{}");
return;
}
Assert.isTrue(rawTuple.size() == 1, "When using JSON input, only one field is expected");
// postpone the coercion
Tuple tuple = CascadingUtils.coerceToString(sinkCall);
super.convert(tuple.getObject(0), to);
}
}
代码示例来源:origin: org.elasticsearch/elasticsearch-hadoop
@Override
public void convert(Object from, BytesArray to) {
// expect a tuple holding one field - chararray or bytearray
Assert.isTrue(from instanceof SinkCall,
String.format("Unexpected object type, expecting [%s], given [%s]", SinkCall.class, from.getClass()));
// handle common cases
SinkCall sinkCall = (SinkCall) from;
Tuple rawTuple = sinkCall.getOutgoingEntry().getTuple();
if (rawTuple == null || rawTuple.isEmpty()) {
to.bytes("{}");
return;
}
Assert.isTrue(rawTuple.size() == 1, "When using JSON input, only one field is expected");
// postpone the coercion
Tuple tuple = CascadingUtils.coerceToString(sinkCall);
super.convert(tuple.getObject(0), to);
}
}
内容来源于网络,如有侵权,请联系作者删除!