Package org.apache.solr.client.solrj.io
Class Tuple
- java.lang.Object
-
- org.apache.solr.client.solrj.io.Tuple
-
- All Implemented Interfaces:
Cloneable,MapSerializable,MapWriter,NavigableObject
- Direct Known Subclasses:
DbscanEvaluator.ClusterTuple,KmeansEvaluator.ClusterTuple,KnnRegressionEvaluator.KnnRegressionTuple,LoessEvaluator.LoessRegressionTuple,OLSRegressionEvaluator.MultipleRegressionTuple,RegressionEvaluator.RegressionTuple
public class Tuple extends Object implements Cloneable, MapWriter
A simple abstraction of a record containing key/value pairs. Convenience methods are provided for returning single and multiValue String, Long and Double values. Note that ints and floats are treated as longs and doubles respectively.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.solr.common.MapWriter
MapWriter.EntryWriter
-
-
Field Summary
Fields Modifier and Type Field Description booleanEOFWhen EOF field is true the Tuple marks the end of the stream.booleanEXCEPTIONWhen EXCEPTION field is true the Tuple marks an exception in the stream and the corresponding "EXCEPTION" field contains a related message.Map<String,String>fieldLabelsDeprecated.usegetFieldLabels()instead of this public field.List<String>fieldNamesDeprecated.usegetFieldNames()instead of this public field.Map<Object,Object>fieldsDeprecated.usegetFields()instead of this public field.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description Tupleclone()static TupleEOF()Create a new empty tuple marked as EOF.static TupleEXCEPTION(String msg, boolean eof)Create a new empty tuple marked as EXCEPTION, and optionally EOF.Objectget(Object key)BooleangetBool(Object key)List<Boolean>getBools(Object key)DategetDate(Object key)List<Date>getDates(Object key)DoublegetDouble(Object key)List<Double>getDoubles(Object key)StringgetException()Map<String,String>getFieldLabels()This represents the mapping of external field labels to the tuple's internal field names if they are different from field names.List<String>getFieldNames()A list of field names to serialize.Map<Object,Object>getFields()Return all tuple fields and their values.LonggetLong(Object key)List<Long>getLongs(Object key)MapgetMap()Deprecated.usegetFields()instead.List<Map>getMaps(Object key)Map<String,Map>getMetrics()StringgetString(Object key)List<String>getStrings(Object key)voidmerge(Tuple other)voidput(Object key, Object value)voidremove(Object key)voidsetFieldLabels(Map<String,String> fieldLabels)voidsetFieldNames(List<String> fieldNames)voidsetMaps(Object key, List<Map> maps)voidsetMetrics(Map<String,Map> metrics)voidwriteMap(MapWriter.EntryWriter ew)-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.solr.common.NavigableObject
_forEachEntry, _forEachEntry, _forEachEntry, _get, _get, _getStr, _getStr
-
-
-
-
Field Detail
-
EOF
public boolean EOF
When EOF field is true the Tuple marks the end of the stream. The EOF Tuple will not contain a record from the stream, but it may contain metrics/aggregates gathered by underlying streams.
-
EXCEPTION
public boolean EXCEPTION
When EXCEPTION field is true the Tuple marks an exception in the stream and the corresponding "EXCEPTION" field contains a related message.
-
fields
@Deprecated public Map<Object,Object> fields
Deprecated.usegetFields()instead of this public field.Tuple fields.
-
fieldNames
@Deprecated public List<String> fieldNames
Deprecated.usegetFieldNames()instead of this public field.External serializable field names.
-
fieldLabels
@Deprecated public Map<String,String> fieldLabels
Deprecated.usegetFieldLabels()instead of this public field.Mapping of external field names to internal tuple field names.
-
-
Constructor Detail
-
Tuple
public Tuple()
-
Tuple
public Tuple(Map<?,?> fields)
A copy constructor.- Parameters:
fields- map containing keys and values to be copied to this tuple
-
Tuple
public Tuple(Object... fields)
Constructor that accepts an even number of arguments as key / value pairs.- Parameters:
fields- a list of key / value pairs, with keys at odd and values at even positions.
-
-
Method Detail
-
remove
public void remove(Object key)
-
getException
public String getException()
-
getMap
@Deprecated public Map getMap()
Deprecated.usegetFields()instead.Return all tuple fields.
-
getFieldLabels
public Map<String,String> getFieldLabels()
This represents the mapping of external field labels to the tuple's internal field names if they are different from field names.- Returns:
- field labels or null
-
getFieldNames
public List<String> getFieldNames()
A list of field names to serialize. This list (together with the mapping ingetFieldLabels()determines what tuple values are serialized and their external (serialized) names.- Returns:
- list of external field names or null
-
merge
public void merge(Tuple other)
-
writeMap
public void writeMap(MapWriter.EntryWriter ew) throws IOException
- Specified by:
writeMapin interfaceMapWriter- Throws:
IOException
-
EOF
public static Tuple EOF()
Create a new empty tuple marked as EOF.
-
-