Class Record

java.lang.Object
org.apache.wayang.basic.data.Record
All Implemented Interfaces:
Serializable, Comparable<Record>, Copyable<Record>

public class Record extends Object implements Serializable, Copyable<Record>, Comparable<Record>
A Type that represents a record with a schema, might be replaced with something standard like JPA entity.
See Also:
  • Constructor Details

    • Record

      public Record(Object... values)
    • Record

      public Record(List<Object> values)
  • Method Details

    • getValues

      public Object[] getValues()
    • copy

      public Record copy()
      Description copied from interface: Copyable
      Create a (potentially shallow) copy of this instance.
      Specified by:
      copy in interface Copyable<Record>
      Returns:
      the copy
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getField

      public Object getField(int index)
    • getDouble

      public double getDouble(int index)
      Retrieve a field as a double. It must be castable as such.
      Parameters:
      index - the index of the field
      Returns:
      the double representation of the field
    • getLong

      public long getLong(int index)
      Retrieve a field as a long. It must be castable as such.
      Parameters:
      index - the index of the field
      Returns:
      the long representation of the field
    • getInt

      public int getInt(int index)
      Retrieve a field as a int. It must be castable as such.
      Parameters:
      index - the index of the field
      Returns:
      the int representation of the field
    • getString

      public String getString(int index)
      Retrieve a field as a String.
      Parameters:
      index - the index of the field
      Returns:
      the field as a String (obtained via Object.toString()) or null if the field is null
    • setField

      public void setField(int index, Object field)
      Set a field of this instance, at a given index.
      Parameters:
      index - the index of the field
      field - the new value of the field to be set
    • addField

      public void addField(Object field)
      Append a field to this instance.
      Parameters:
      field - the field to add
    • size

      public int size()
      Retrieve the size of this instance.
      Returns:
      the number of fields in this instance
    • compareTo

      public int compareTo(Record that) throws IllegalStateException
      Compares the fields of this record to the fields of another record.
      Specified by:
      compareTo in interface Comparable<Record>
      Parameters:
      that - another record not null
      Returns:
      Throws:
      IllegalStateException - if the two records do not have the same types in values