Class MultiValue

java.lang.Object
org.smartparam.engine.core.output.MultiValue

public class MultiValue extends Object

Represents single row of matrix returned from parameter querying. Immutable. Each method returning value can throw:

* InvalidRowIndexException * InvalidValueIndexException * GettingWrongTypeException * UnknownLevelNameException
Since:
1.0.0
Version:
1.0.3
Author:
Przemek Hertel
  • Constructor Details

  • Method Details

    • getHolder

      public ValueHolder getHolder(int position)
      Raw holder of stored at given position.
      Parameters:
      position - size of Object table
      Returns:
      raw holder of stored at given position.
    • get

      public <T> T get(int position)
      Value of column at given position cast to generic return value.
      Type Parameters:
      T - type
      Parameters:
      position - size of Object table
      Returns:
      value of column at given position casted to T
    • get

      public <T> T get(int position, Class<T> clazz)
      Return value of column at given position cast to object of class clazz.
      Type Parameters:
      T - type
      Parameters:
      position - index, starts with 0
      clazz - class
      Returns:
      value of column at given position cast to object of class clazz
    • getString

      public String getString(int position)
      Return value of column at given position as String.
      Parameters:
      position - index, starts with 0
      Returns:
      value of column at given position as String
    • getBigDecimal

      public BigDecimal getBigDecimal(int position)
      Return value of column at given position as BigDecimal.
      Parameters:
      position - index, starts with 0
      Returns:
      value of column at given position as BigDecimal
    • getDate

      public Date getDate(int position)
      Return value of column at given position as Date.
      Parameters:
      position - index, starts with 0
      Returns:
      value of column at given position as Date
    • getDatetime

      public Date getDatetime(int position)
      Return value of column at given position as datetime.
      Parameters:
      position - index, starts with 0
      Returns:
      value of column at given position as datetime
    • getLocalDate

      public LocalDate getLocalDate(int position)
      Return value of column at given position as LocalDate.
      Parameters:
      position - index, starts with 0
      Returns:
      value of column at given position as LocalDate
    • getLocalDatetime

      public LocalDateTime getLocalDatetime(int position)
      Return value of column at given position as LocalDateTime.
      Parameters:
      position - index, starts with 0
      Returns:
      value of column at given position as LocalDateTime
    • getInteger

      public Integer getInteger(int position)
      Return value of column at given position as Integer.
      Parameters:
      position - index, starts with 0
      Returns:
      value of column at given position as Integer
    • getBoolean

      public Boolean getBoolean(int position)
      Return value of column at given position as Boolean.
      Parameters:
      position - index, starts with 0
      Returns:
      value of column at given position as Boolean
    • getLong

      public Long getLong(int position)
      Return value of column at given position as Long.
      Parameters:
      position - index, starts with 0
      Returns:
      value of column at given position as Long
    • getHolder

      public ValueHolder getHolder(String name)
      Return raw value holder of column with given name.
      Parameters:
      name - column name
      Returns:
      raw value holder of column with given name
    • get

      public <T> T get(String name)
      Return value of column with given name cast to generic return value.
      Type Parameters:
      T - type
      Parameters:
      name - column name
      Returns:
      value of column with given name cast to generic return value
    • get

      public <T> T get(String name, Class<T> clazz)
      Return value of column with given name cast to object of class clazz.
      Type Parameters:
      T - type
      Parameters:
      name - column name
      clazz - class
      Returns:
      value of column with given name cast to object of class clazz
    • getString

      public String getString(String name)
      Return value of column with given name as String.
      Parameters:
      name - column name
      Returns:
      value of column with given name as String
    • getBigDecimal

      public BigDecimal getBigDecimal(String name)
      Return value of column with given name as BigDecimal.
      Parameters:
      name - column name
      Returns:
      value of column with given name as BigDecimal
    • getDate

      public Date getDate(String name)
      Return value of column with given name as Date.
      Parameters:
      name - column name
      Returns:
      value of column with given name as Date
    • getDatetime

      public Date getDatetime(String name)
      Return value of column with given name as datetime (java.util.Date).
      Parameters:
      name - column name
      Returns:
      value of column with given name as datetime
    • getLocalDate

      public LocalDate getLocalDate(String name)
      Return value of column with given name as LocalDate.
      Parameters:
      name - column name
      Returns:
      value of column with given name as LocalDate
    • getLocalDatetime

      public LocalDateTime getLocalDatetime(String name)
      Return value of column with given name as LocalDateTime.
      Parameters:
      name - column name
      Returns:
      value of column with given name as LocalDateTime
    • getInteger

      public Integer getInteger(String name)
      Return value of column with given name as Integer.
      Parameters:
      name - column name
      Returns:
      value of column with given name as Integer
    • getBoolean

      public Boolean getBoolean(String name)
      Return value of column with given name as Boolean.
      Parameters:
      name - column name
      Returns:
      value of column with given name as Boolean
    • getLong

      public Long getLong(String name)
      Return value of column with given name as Long.
      Parameters:
      name - column name
      Returns:
      value of column with given name as Long
    • getEnum

      public <T extends Enum<T>> T getEnum(int position, Class<T> enumClass)
      Parses string value as enum entry, using Enum.valueOf(java.lang.Class, java.lang.String) method.
      Type Parameters:
      T - type
      Parameters:
      position - index, starts with 0
      enumClass - enum
      Returns:
      string value as enum entry
    • getEnum

      public <T extends Enum<T>> T getEnum(String name, Class<T> enumClass)
      Return value of column with given name as enum.
      Type Parameters:
      T - type
      Parameters:
      name - column name
      enumClass - enum
      Returns:
      alue of column with given name as enum
    • getArray

      public ValueHolder[] getArray(int position)
      Return array of values stored at position. Should be used if parameter level contained list of values (Level.isArray(). This string list is split into array of values using separator defined at parameter level (Parameter.getArraySeparator()). Type of each value holder in array is the same, defined by level type.
      Parameters:
      position - index starts with 0
      Returns:
      array of values stored at position
    • isArray

      public boolean isArray(int position)
    • isArray

      public boolean isArray(String name)
    • unwrap

      public Object[] unwrap()
      Return array of unwrapped objects, this is a raw representation of contents of AbstractHolders from MultiValue object. Each array element is either value of ValueHolder.getValue() } if level stores single value or array of ValueHolder.getValue() } if level stores an array.
      Returns:
      array of unwrapped objects
    • getStringArray

      public String[] getStringArray(int position)
      Return value of column at given position as String array.
      Parameters:
      position - index starts with 0
      Returns:
      value of column at given position as String array
    • getDateArray

      public Date[] getDateArray(int position)
      Return value of column at given position as Date array.
      Parameters:
      position - index starts with 0
      Returns:
      value of column at given position as Date array
    • getLocalDateArray

      public LocalDate[] getLocalDateArray(int position)
      Return value of column at given position as LocalDate array.
      Parameters:
      position - index starts with 0
      Returns:
      value of column at given position as LocalDate array
    • getLocalDateTimeArray

      public LocalDateTime[] getLocalDateTimeArray(int position)
      Return value of column at given position as LocalDate array.
      Parameters:
      position - index starts with 0
      Returns:
      value of column at given position as LocalDate array
    • getIntegerArray

      public Integer[] getIntegerArray(int position)
      Return value of column at given position as Integer array.
      Parameters:
      position - index starts with 0
      Returns:
      value of column at given position as Integer array
    • getLongArray

      public Long[] getLongArray(int position)
      Return value of column at given position as Long array.
      Parameters:
      position - index starts with 0
      Returns:
      value of column at given position as Long array
    • getBigDecimalArray

      public BigDecimal[] getBigDecimalArray(int position)
      Return value of column at given position as BigDecimal array.
      Parameters:
      position - index starts with 0
      Returns:
      value of column at given position as BigDecimal array
    • getArray

      public ValueHolder[] getArray(String name)
      Return value of column under given name as array of raw value holders.
      Parameters:
      name - column name
      Returns:
      value of column under given name as array of raw value holders
    • getStringArray

      public String[] getStringArray(String name)
      Return value of column under given name as array of strings.
      Parameters:
      name - column name
      Returns:
      value of column under given name as array of strings
    • getBigDecimalArray

      public BigDecimal[] getBigDecimalArray(String name)
      Return value of column under given name as array of raw big decimals.
      Parameters:
      name - column name
      Returns:
      value of column under given name as array of raw big decimals
    • getDateArray

      public Date[] getDateArray(String name)
      Return value of column under given name as array of dates.
      Parameters:
      name - column name
      Returns:
      value of column under given name as array of dates
    • getIntegerArray

      public Integer[] getIntegerArray(String name)
      Return value of column under given name as array of integers.
      Parameters:
      name - column name
      Returns:
      value of column under given name as array of integers
    • getLongArray

      public Long[] getLongArray(String name)
      Return value of column under given name as array of longs.
      Parameters:
      name - column name
      Returns:
      value of column under given name as array of longs
    • asStrings

      public String[] asStrings()
      Returns row values as strings, equivalent to calling getString(int) on every row value.
      Returns:
      row values as strings
    • asBigDecimals

      public BigDecimal[] asBigDecimals()
      Returns row values as BigDecimals, equivalent to calling getBigDecimal(int) on every row value.
      Returns:
      row values as BigDecimals
    • toString

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

      public String toStringInline()
      Returns toString, but in single line.
      Returns:
      toString, but in single line
    • nextHolder

      public ValueHolder nextHolder()
      Iteration mode, return raw value holder of next row element.
      Returns:
      raw value holder of next row element
    • next

      public <T> T next()
      Iteration mode, return value of next row element cast to generic type.
      Type Parameters:
      T - type
      Returns:
      value of next row element cast to generic type
    • next

      public <T> T next(Class<T> clazz)
      Iteration mode, return value of next row element cast to object of class clazz.
      Type Parameters:
      T - type
      Parameters:
      clazz - class
      Returns:
      value of next row element cast to object of class clazz
    • nextString

      public String nextString()
      Iteration mode, get string value of next row element.
      Returns:
      value of next row element
    • nextBigDecimal

      public BigDecimal nextBigDecimal()
      Iteration mode, get BigDecimal value of next row element.
      Returns:
      value of next row element
    • nextDate

      public Date nextDate()
      Iteration mode, get Date value of next row element.
      Returns:
      value of next row element
    • nextLocalDate

      public LocalDate nextLocalDate()
      Iteration mode, get LocalDate value of next row element.
      Returns:
      value of next row element
    • nextLocalDatetime

      public LocalDateTime nextLocalDatetime()
      Iteration mode, get LocalDateTime value of next row element.
      Returns:
      value of next row element
    • nextInteger

      public Integer nextInteger()
      Iteration mode, get integer value of next row element.
      Returns:
      value of next row element
    • nextLong

      public Long nextLong()
      Iteration mode, get long value of next row element.
      Returns:
      value of next row element
    • nextEnum

      public <T extends Enum<T>> T nextEnum(Class<T> enumClass)
      Iteration mode, get enum value of next row element.
      Type Parameters:
      T - class
      Parameters:
      enumClass - enum
      Returns:
      value of next row element
    • nextArray

      public ValueHolder[] nextArray()
      Iteration mode, return value of next row element as holder array.
      Returns:
      value of next row element as holder array
    • nextStringArray

      public String[] nextStringArray()
      Iteration mode, return value of next row element as string array.
      Returns:
      value of next row element as string array
    • nextBigDecimalArray

      public BigDecimal[] nextBigDecimalArray()
      Iteration mode, return value of next row element as BigDecimal array.
      Returns:
      value of next row element as BigDecimal array
    • nextDateArray

      public Date[] nextDateArray()
      Iteration mode, return value of next row element as Date array.
      Returns:
      return value of next row element as Date array
    • nextLocalDateArray

      public LocalDate[] nextLocalDateArray()
      Iteration mode, return value of next row element as LocalDate array.
      Returns:
      return value of next row element as LocalDate array
    • nextLocalDateTimeArray

      public LocalDateTime[] nextLocalDateTimeArray()
      Iteration mode, return value of next row element as LocalDateTime array.
      Returns:
      return value of next row element as LocalDateTime array
    • nextIntegerArray

      public Integer[] nextIntegerArray()
      Iteration mode, return value of next row element as integer array.
      Returns:
      value of next row element as integer array
    • nextLongArray

      public Long[] nextLongArray()
      Iteration mode, return value of next row element as long array.
      Returns:
      value of next row element as long array
    • size

      public int size()
      Returns:
      length of row
    • all

      public Object[] all()
      Returns:
      internal table
    • isBlank

      public boolean isBlank()
      Returns:
      true if all holders (or arrays) are blank
    • equals

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

      public int hashCode()
      Overrides:
      hashCode in class Object