Java Code Examples for backtype.storm.tuple.Tuple#getFields()

The following examples show how to use backtype.storm.tuple.Tuple#getFields() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StreamConvertHelper.java    From eagle with Apache License 2.0 5 votes vote down vote up
private static Map tupleToMap(Tuple tuple) {
    Map values = new HashMap<>();
    for (String field : tuple.getFields()) {
        values.put(field, tuple.getValueByField(field));
    }
    return values;
}
 
Example 2
Source File: DelimitedRecordFormat.java    From storm-hdfs with Apache License 2.0 5 votes vote down vote up
@Override
public byte[] format(Tuple tuple) {
    StringBuilder sb = new StringBuilder();
    Fields fields = this.fields == null ? tuple.getFields() : this.fields;
    int size = fields.size();
    for(int i = 0; i < size; i++){
        sb.append(tuple.getValueByField(fields.get(i)));
        if(i != size - 1){
            sb.append(this.fieldDelimiter);
        }
    }
    sb.append(this.recordDelimiter);
    return sb.toString().getBytes();
}
 
Example 3
Source File: DelimitedRecordFormat.java    From jstorm with Apache License 2.0 5 votes vote down vote up
@Override
public byte[] format(Tuple tuple) {
    StringBuilder sb = new StringBuilder();
    Fields fields = this.fields == null ? tuple.getFields() : this.fields;
    int size = fields.size();
    for(int i = 0; i < size; i++){
        sb.append(tuple.getValueByField(fields.get(i)));
        if(i != size - 1){
            sb.append(this.fieldDelimiter);
        }
    }
    sb.append(this.recordDelimiter);
    return sb.toString().getBytes();
}