org.kitesdk.morphline.api
Class Record

java.lang.Object
  extended by org.kitesdk.morphline.api.Record

public final class Record
extends Object

A record is a set of named fields where each field has a list of one or more values. A value can be of any type, i.e. any Java Object. That is, a record is a ListMultimap as in Guava’s ArrayListMultimap. Note that a field can be multi-valued and that any two records need not use common field names. This flexible data model corresponds exactly to the characteristics of the Solr/Lucene data model (i.e. a record is a SolrInputDocument). A field with zero values is removed from the record - it does not exist as such.


Constructor Summary
Record()
          Creates a new empty record.
 
Method Summary
 Record copy()
          Returns a shallow copy of this record.
 boolean equals(Object other)
           
 List get(String key)
          Returns a view of the values associated with the given key.
 com.google.common.collect.ListMultimap<String,Object> getFields()
          Returns the fields that are stored in this record.
 Object getFirstValue(String key)
          Returns the first value associated with the given key, or null if no such value exists
 int hashCode()
           
 void put(String key, Object value)
          Adds the given value to the values currently associated with the given key.
 void putIfAbsent(String key, Object value)
          Adds the given value to the values currently associated with the given key, iff the key isn't already associated with that same value.
 void removeAll(String key)
          Removes all values that are associated with the given key
 void replaceValues(String key, Object value)
          Removes all values that are associated with the given key, and then associates the given value with the given key.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Record

public Record()
Creates a new empty record.

Method Detail

copy

public Record copy()
Returns a shallow copy of this record.


getFields

public com.google.common.collect.ListMultimap<String,Object> getFields()
Returns the fields that are stored in this record.


get

public List get(String key)
Returns a view of the values associated with the given key. An empty collection may be returned, but never null.


put

public void put(String key,
                Object value)
Adds the given value to the values currently associated with the given key.


getFirstValue

public Object getFirstValue(String key)
Returns the first value associated with the given key, or null if no such value exists


replaceValues

public void replaceValues(String key,
                          Object value)
Removes all values that are associated with the given key, and then associates the given value with the given key.


removeAll

public void removeAll(String key)
Removes all values that are associated with the given key


putIfAbsent

public void putIfAbsent(String key,
                        Object value)
Adds the given value to the values currently associated with the given key, iff the key isn't already associated with that same value.


equals

public boolean equals(Object other)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2013–2014. All rights reserved.