org.jooq
Interface Store<E>

Type Parameters:
E - The store's element type
All Superinterfaces:
Adapter, Attachable, Serializable
All Known Subinterfaces:
ArrayRecord<E>, Record, TableRecord<R>, UDTRecord<R>, UpdatableRecord<R>
All Known Implementing Classes:
ArrayRecordImpl, CustomRecord, TableRecordImpl, UDTRecordImpl, UpdatableRecordImpl

public interface Store<E>
extends Attachable

A common base type for Record and ArrayRecord providing common, index-based functionality for storage objects

Store implements Attachable, as some stores need a reference to an open JDBC connection to perform some actions on their elements.

Author:
Lukas Eder

Method Summary
 E getValue(int index)
          Get a value from this Store, providing a field index.
<T> T
getValue(int index, Class<? extends T> type)
          Get a converted value from this Store, providing a field index.
<T> T
getValue(int index, Class<? extends T> type, T defaultValue)
          Get a converted value from this Store, providing a field index.
 E getValue(int index, E defaultValue)
          Get a value from this Store, providing a field index.
 BigDecimal getValueAsBigDecimal(int index)
          Get a value from this Store, providing a field index.
 BigDecimal getValueAsBigDecimal(int index, BigDecimal defaultValue)
          Get a value from this Store, providing a field index.
 BigInteger getValueAsBigInteger(int index)
          Get a value from this Store, providing a field index.
 BigInteger getValueAsBigInteger(int index, BigInteger defaultValue)
          Get a value from this Store, providing a field index.
 Boolean getValueAsBoolean(int index)
          Get a value from this Store, providing a field index.
 Boolean getValueAsBoolean(int index, Boolean defaultValue)
          Get a value from this Store, providing a field index.
 Byte getValueAsByte(int index)
          Get a value from this Store, providing a field index.
 Byte getValueAsByte(int index, Byte defaultValue)
          Get a value from this Store, providing a field index.
 Date getValueAsDate(int index)
          Get a value from this Store, providing a field index.
 Date getValueAsDate(int index, Date defaultValue)
          Get a value from this Store, providing a field index.
 Double getValueAsDouble(int index)
          Get a value from this Store, providing a field index.
 Double getValueAsDouble(int index, Double defaultValue)
          Get a value from this Store, providing a field index.
 Float getValueAsFloat(int index)
          Get a value from this Store, providing a field index.
 Float getValueAsFloat(int index, Float defaultValue)
          Get a value from this Store, providing a field index.
 Integer getValueAsInteger(int index)
          Get a value from this Store, providing a field index.
 Integer getValueAsInteger(int index, Integer defaultValue)
          Get a value from this Store, providing a field index.
 Long getValueAsLong(int index)
          Get a value from this Store, providing a field index.
 Long getValueAsLong(int index, Long defaultValue)
          Get a value from this Store, providing a field index.
 Short getValueAsShort(int index)
          Get a value from this Store, providing a field index.
 Short getValueAsShort(int index, Short defaultValue)
          Get a value from this Store, providing a field index.
 String getValueAsString(int index)
          Get a value from this Store, providing a field index.
 String getValueAsString(int index, String defaultValue)
          Get a value from this Store, providing a field index.
 Time getValueAsTime(int index)
          Get a value from this Store, providing a field index.
 Time getValueAsTime(int index, Time defaultValue)
          Get a value from this Store, providing a field index.
 Timestamp getValueAsTimestamp(int index)
          Get a value from this Store, providing a field index.
 Timestamp getValueAsTimestamp(int index, Timestamp defaultValue)
          Get a value from this Store, providing a field index.
 int size()
          Get the size of this Store.
 
Methods inherited from interface org.jooq.Attachable
attach
 
Methods inherited from interface org.jooq.Adapter
internalAPI
 

Method Detail

size

int size()
Get the size of this Store.

If this is an ArrayRecord, then the array size is returned. If this is a Record, then the number of fields is returned.

It can be said that getValue(size() - 1) will return a value, if size > 0


getValue

E getValue(int index)
           throws IllegalArgumentException
Get a value from this Store, providing a field index.

Parameters:
index - The field's index
Returns:
The value of a field's index contained in this Store
Throws:
IllegalArgumentException - If the argument index is not contained in the Store

getValue

E getValue(int index,
           E defaultValue)
           throws IllegalArgumentException
Get a value from this Store, providing a field index.

Parameters:
index - The field's index
defaultValue - The default value instead of null
Returns:
The value of a field's index contained in this Store, or defaultValue, if null
Throws:
IllegalArgumentException - If the argument index is not contained in the Store

getValueAsBigDecimal

BigDecimal getValueAsBigDecimal(int index)
                                throws IllegalArgumentException,
                                       DataTypeException
Get a value from this Store, providing a field index.

Parameters:
index - The field's index
Returns:
The converted value of a field's index contained in this Store
Throws:
IllegalArgumentException - If the argument index is not contained in the Store
DataTypeException - wrapping data type conversion exception that might have occurred

getValueAsBigDecimal

BigDecimal getValueAsBigDecimal(int index,
                                BigDecimal defaultValue)
                                throws IllegalArgumentException,
                                       DataTypeException
Get a value from this Store, providing a field index.

Parameters:
index - The field's index
defaultValue - The default value instead of null
Returns:
The converted value of a field's index contained in this Store, or defaultValue, if null
Throws:
IllegalArgumentException - If the argument index is not contained in the Store
DataTypeException - wrapping data type conversion exception that might have occurred

getValueAsBoolean

Boolean getValueAsBoolean(int index)
                          throws IllegalArgumentException,
                                 DataTypeException
Get a value from this Store, providing a field index.

boolean values for true are any of these case-insensitive strings:

boolean values for false are any of these case-insensitive strings:

All other values evaluate to null

Parameters:
index - The field's index
Returns:
The converted value of a field's index contained in this Store
Throws:
IllegalArgumentException - If the argument index is not contained in the Store
DataTypeException - wrapping data type conversion exception that might have occurred

getValueAsBoolean

Boolean getValueAsBoolean(int index,
                          Boolean defaultValue)
                          throws IllegalArgumentException,
                                 DataTypeException
Get a value from this Store, providing a field index.

boolean values for true are any of these case-insensitive strings:

boolean values for false are any of these case-insensitive strings:

All other values evaluate to null

Parameters:
index - The field's index
defaultValue - The default value instead of null
Returns:
The converted value of a field's index contained in this Store, or defaultValue, if null
Throws:
IllegalArgumentException - If the argument index is not contained in the Store
DataTypeException - wrapping data type conversion exception that might have occurred

getValueAsBigInteger

BigInteger getValueAsBigInteger(int index)
                                throws IllegalArgumentException,
                                       DataTypeException
Get a value from this Store, providing a field index.

Parameters:
index - The field's index
Returns:
The converted value of a field's index contained in this Store
Throws:
IllegalArgumentException - If the argument index is not contained in the Store
DataTypeException - wrapping data type conversion exception that might have occurred

getValueAsBigInteger

BigInteger getValueAsBigInteger(int index,
                                BigInteger defaultValue)
                                throws IllegalArgumentException,
                                       DataTypeException
Get a value from this Store, providing a field index.

Parameters:
index - The field's index
defaultValue - The default value instead of null
Returns:
The converted value of a field's index contained in this Store, or defaultValue, if null
Throws:
IllegalArgumentException - If the argument index is not contained in the Store
DataTypeException - wrapping data type conversion exception that might have occurred

getValueAsByte

Byte getValueAsByte(int index)
                    throws IllegalArgumentException,
                           DataTypeException
Get a value from this Store, providing a field index.

Parameters:
index - The field's index
Returns:
The converted value of a field's index contained in this Store
Throws:
IllegalArgumentException - If the argument index is not contained in the Store
DataTypeException - wrapping data type conversion exception that might have occurred

getValueAsByte

Byte getValueAsByte(int index,
                    Byte defaultValue)
                    throws IllegalArgumentException,
                           DataTypeException
Get a value from this Store, providing a field index.

Parameters:
index - The field's index
defaultValue - The default value instead of null
Returns:
The converted value of a field's index contained in this Store, or defaultValue, if null
Throws:
IllegalArgumentException - If the argument index is not contained in the Store
DataTypeException - wrapping data type conversion exception that might have occurred

getValueAsDate

Date getValueAsDate(int index)
                    throws IllegalArgumentException,
                           DataTypeException
Get a value from this Store, providing a field index.

Parameters:
index - The field's index
Returns:
The converted value of a field's index contained in this Store
Throws:
IllegalArgumentException - If the argument index is not contained in the Store
DataTypeException - wrapping data type conversion exception that might have occurred

getValueAsDate

Date getValueAsDate(int index,
                    Date defaultValue)
                    throws IllegalArgumentException,
                           DataTypeException
Get a value from this Store, providing a field index.

Parameters:
index - The field's index
defaultValue - The default value instead of null
Returns:
The converted value of a field's index contained in this Store, or defaultValue, if null
Throws:
IllegalArgumentException - If the argument index is not contained in the Store
DataTypeException - wrapping data type conversion exception that might have occurred

getValueAsDouble

Double getValueAsDouble(int index)
                        throws IllegalArgumentException,
                               DataTypeException
Get a value from this Store, providing a field index.

Parameters:
index - The field's index
Returns:
The converted value of a field's index contained in this Store
Throws:
IllegalArgumentException - If the argument index is not contained in the Store
DataTypeException - wrapping data type conversion exception that might have occurred

getValueAsDouble

Double getValueAsDouble(int index,
                        Double defaultValue)
                        throws IllegalArgumentException,
                               DataTypeException
Get a value from this Store, providing a field index.

Parameters:
index - The field's index
defaultValue - The default value instead of null
Returns:
The converted value of a field's index contained in this Store, or defaultValue, if null
Throws:
IllegalArgumentException - If the argument index is not contained in the Store
DataTypeException - wrapping data type conversion exception that might have occurred

getValueAsFloat

Float getValueAsFloat(int index)
                      throws IllegalArgumentException,
                             DataTypeException
Get a value from this Store, providing a field index.

Parameters:
index - The field's index
Returns:
The converted value of a field's index contained in this Store
Throws:
IllegalArgumentException - If the argument index is not contained in the Store
DataTypeException - wrapping data type conversion exception that might have occurred

getValueAsFloat

Float getValueAsFloat(int index,
                      Float defaultValue)
                      throws IllegalArgumentException,
                             DataTypeException
Get a value from this Store, providing a field index.

Parameters:
index - The field's index
defaultValue - The default value instead of null
Returns:
The converted value of a field's index contained in this Store, or defaultValue, if null
Throws:
IllegalArgumentException - If the argument index is not contained in the Store
DataTypeException - wrapping data type conversion exception that might have occurred

getValueAsInteger

Integer getValueAsInteger(int index)
                          throws IllegalArgumentException,
                                 DataTypeException
Get a value from this Store, providing a field index.

Parameters:
index - The field's index
Returns:
The converted value of a field's index contained in this Store
Throws:
IllegalArgumentException - If the argument index is not contained in the Store
DataTypeException - wrapping data type conversion exception that might have occurred

getValueAsInteger

Integer getValueAsInteger(int index,
                          Integer defaultValue)
                          throws IllegalArgumentException,
                                 DataTypeException
Get a value from this Store, providing a field index.

Parameters:
index - The field's index
defaultValue - The default value instead of null
Returns:
The converted value of a field's index contained in this Store, or defaultValue, if null
Throws:
IllegalArgumentException - If the argument index is not contained in the Store
DataTypeException - wrapping data type conversion exception that might have occurred

getValueAsLong

Long getValueAsLong(int index)
                    throws IllegalArgumentException,
                           DataTypeException
Get a value from this Store, providing a field index.

Parameters:
index - The field's index
Returns:
The converted value of a field's index contained in this Store
Throws:
IllegalArgumentException - If the argument index is not contained in the Store
DataTypeException - wrapping data type conversion exception that might have occurred

getValueAsLong

Long getValueAsLong(int index,
                    Long defaultValue)
                    throws IllegalArgumentException,
                           DataTypeException
Get a value from this Store, providing a field index.

Parameters:
index - The field's index
defaultValue - The default value instead of null
Returns:
The converted value of a field's index contained in this Store, or defaultValue, if null
Throws:
IllegalArgumentException - If the argument index is not contained in the Store
DataTypeException - wrapping data type conversion exception that might have occurred

getValueAsShort

Short getValueAsShort(int index)
                      throws IllegalArgumentException,
                             DataTypeException
Get a value from this Store, providing a field index.

Parameters:
index - The field's index
Returns:
The converted value of a field's index contained in this Store
Throws:
IllegalArgumentException - If the argument index is not contained in the Store
DataTypeException - wrapping data type conversion exception that might have occurred

getValueAsShort

Short getValueAsShort(int index,
                      Short defaultValue)
                      throws IllegalArgumentException,
                             DataTypeException
Get a value from this Store, providing a field index.

Parameters:
index - The field's index
defaultValue - The default value instead of null
Returns:
The converted value of a field's index contained in this Store, or defaultValue, if null
Throws:
IllegalArgumentException - If the argument index is not contained in the Store
DataTypeException - wrapping data type conversion exception that might have occurred

getValueAsString

String getValueAsString(int index)
                        throws IllegalArgumentException,
                               DataTypeException
Get a value from this Store, providing a field index.

Parameters:
index - The field's index
Returns:
The converted value of a field's index contained in this Store
Throws:
IllegalArgumentException - If the argument index is not contained in the Store
DataTypeException - wrapping data type conversion exception that might have occurred

getValueAsString

String getValueAsString(int index,
                        String defaultValue)
                        throws IllegalArgumentException,
                               DataTypeException
Get a value from this Store, providing a field index.

Parameters:
index - The field's index
defaultValue - The default value instead of null
Returns:
The converted value of a field's index contained in this Store, or defaultValue, if null
Throws:
IllegalArgumentException - If the argument index is not contained in the Store
DataTypeException - wrapping data type conversion exception that might have occurred

getValueAsTime

Time getValueAsTime(int index)
                    throws IllegalArgumentException,
                           DataTypeException
Get a value from this Store, providing a field index.

Parameters:
index - The field's index
Returns:
The converted value of a field's index contained in this Store
Throws:
IllegalArgumentException - If the argument index is not contained in the Store
DataTypeException - wrapping data type conversion exception that might have occurred

getValueAsTime

Time getValueAsTime(int index,
                    Time defaultValue)
                    throws IllegalArgumentException,
                           DataTypeException
Get a value from this Store, providing a field index.

Parameters:
index - The field's index
defaultValue - The default value instead of null
Returns:
The converted value of a field's index contained in this Store, or defaultValue, if null
Throws:
IllegalArgumentException - If the argument index is not contained in the Store
DataTypeException - wrapping data type conversion exception that might have occurred

getValueAsTimestamp

Timestamp getValueAsTimestamp(int index)
                              throws IllegalArgumentException,
                                     DataTypeException
Get a value from this Store, providing a field index.

Parameters:
index - The field's index
Returns:
The converted value of a field's index contained in this Store
Throws:
IllegalArgumentException - If the argument index is not contained in the Store
DataTypeException - wrapping data type conversion exception that might have occurred

getValueAsTimestamp

Timestamp getValueAsTimestamp(int index,
                              Timestamp defaultValue)
                              throws IllegalArgumentException,
                                     DataTypeException
Get a value from this Store, providing a field index.

Parameters:
index - The field's index
defaultValue - The default value instead of null
Returns:
The converted value of a field's index contained in this Store, or defaultValue, if null
Throws:
IllegalArgumentException - If the argument index is not contained in the Store
DataTypeException - wrapping data type conversion exception that might have occurred

getValue

<T> T getValue(int index,
               Class<? extends T> type)
           throws IllegalArgumentException,
                  DataTypeException
Get a converted value from this Store, providing a field index.

Type Parameters:
T - The conversion type parameter
Parameters:
index - The field's index
type - The conversion type
Returns:
The value of a field's index contained in this Store
Throws:
IllegalArgumentException - If the argument index is not contained in the Store
DataTypeException - wrapping data type conversion exception that might have occurred
See Also:
Convert.convert(Object, Class)

getValue

<T> T getValue(int index,
               Class<? extends T> type,
               T defaultValue)
           throws IllegalArgumentException,
                  DataTypeException
Get a converted value from this Store, providing a field index.

Type Parameters:
T - The conversion type parameter
Parameters:
index - The field's index
type - The conversion type
defaultValue - The default value instead of null
Returns:
The value of a field's index contained in this Store, or defaultValue, if null
Throws:
IllegalArgumentException - If the argument index is not contained in the Store
DataTypeException - wrapping data type conversion exception that might have occurred
See Also:
Convert.convert(Object, Class)


Copyright © 2012. All Rights Reserved.