public class UpdatableRecordImpl<R extends UpdatableRecord<R>> extends TableRecordImpl<R> implements UpdatableRecord<R>
This type is for JOOQ INTERNAL USE only. Do not reference directly
| Constructor and Description |
|---|
UpdatableRecordImpl(UpdatableTable<R> table) |
| Modifier and Type | Method and Description |
|---|---|
void |
attach(Configuration c)
Attach this object to a new
Configuration |
boolean |
changed()
Check if this record has been changed from its original as fetched from
the database.
|
R |
copy()
Duplicate this record (in memory) and reset all fields from the primary
key or main unique key, such that a subsequent call to
UpdatableRecord.store()
will result in an INSERT statement. |
protected Factory |
create()
This method is used in generated code!
|
int |
delete()
Deletes this record from the database, based on the value of the primary
key or main unique key.
|
boolean |
equals(Object obj) |
void |
from(Object source)
Load data into this record from a source.
|
protected void |
from(Record source)
This method was implemented with [#799].
|
List<Attachable> |
getAttachables()
Get the list of dependent
Attachables
This method is for JOOQ INTERNAL USE only. |
Configuration |
getConfiguration()
Get the underlying configuration
|
<T> Field<T> |
getField(Field<T> field)
Get a specific field from this field provider.
|
Field<?> |
getField(int index)
Get a specific field from this field provider.
|
Field<?> |
getField(String name)
Get a specific field from this field provider.
|
List<Field<?>> |
getFields() |
int |
getIndex(Field<?> field)
Get a fields index from this field provider
|
UpdatableTable<R> |
getTable()
The table from which this record was read
|
<T> T |
getValue(Field<?> field,
Class<? extends T> type)
Get a converted value from this Record, providing a field.
|
<T> T |
getValue(Field<?> field,
Class<? extends T> type,
T defaultValue)
Get a converted value from this record, providing a field.
|
<T> T |
getValue(Field<T> field)
Get a value from this Record, providing a field.
|
<T,U> U |
getValue(Field<T> field,
Converter<? super T,U> converter)
Get a converted value from this Record, providing a field.
|
<T,U> U |
getValue(Field<T> field,
Converter<? super T,U> converter,
U defaultValue)
Get a converted value from this record, providing a field.
|
<T> T |
getValue(Field<T> field,
T defaultValue)
Get a value from this record, providing a field.
|
Object |
getValue(int index)
Get a value from this record, providing a field index.
|
<Z> Z |
getValue(int index,
Class<? extends Z> type)
Get a converted value from this Store, providing a field index.
|
<Z> Z |
getValue(int index,
Class<? extends Z> type,
Z defaultValue)
Get a converted value from this Store, providing a field index.
|
<U> U |
getValue(int index,
Converter<?,U> converter)
Get a converted value from this record, providing a field index.
|
<U> U |
getValue(int index,
Converter<?,U> converter,
U defaultValue)
Get a converted value from this record, providing a field index.
|
T |
getValue(int index,
T defaultValue)
Get a value from this Store, providing a field index.
|
Object |
getValue(String fieldName)
Get a value from this Record, providing a field name.
|
<T> T |
getValue(String fieldName,
Class<? extends T> type)
Get a converted value from this Record, providing a field name.
|
<Z> Z |
getValue(String fieldName,
Class<? extends Z> type,
Z defaultValue)
Get a converted value from this record, providing a field name.
|
<U> U |
getValue(String fieldName,
Converter<?,U> converter)
Get a converted value from this Record, providing a field name.
|
<U> U |
getValue(String fieldName,
Converter<?,U> converter,
U defaultValue)
Get a converted value from this record, providing a field name.
|
Object |
getValue(String fieldName,
Object defaultValue)
Get a value from this record, providing a field name.
|
<A extends ArrayRecord<T>,T> |
getValueAsArray(Field<A> field)
Get an array value from this Record, providing an
ArrayRecord
field. |
<A extends ArrayRecord<T>,T> |
getValueAsArray(Field<A> field,
T[] defaultValue)
Get an array value from this Record, providing an
ArrayRecord
field. |
BigDecimal |
getValueAsBigDecimal(Field<?> field)
Get a value from this Record, providing a field.
|
BigDecimal |
getValueAsBigDecimal(Field<?> field,
BigDecimal defaultValue)
Get a value from this record, providing a field.
|
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.
|
BigDecimal |
getValueAsBigDecimal(String fieldName)
Get a value from this Record, providing a field name.
|
BigDecimal |
getValueAsBigDecimal(String fieldName,
BigDecimal defaultValue)
Get a value from this record, providing a field name.
|
BigInteger |
getValueAsBigInteger(Field<?> field)
Get a value from this Record, providing a field.
|
BigInteger |
getValueAsBigInteger(Field<?> field,
BigInteger defaultValue)
Get a value from this record, providing a field.
|
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.
|
BigInteger |
getValueAsBigInteger(String fieldName)
Get a value from this Record, providing a field name.
|
BigInteger |
getValueAsBigInteger(String fieldName,
BigInteger defaultValue)
Get a value from this record, providing a field name.
|
Boolean |
getValueAsBoolean(Field<?> field)
Get a value from this Record, providing a field.
|
Boolean |
getValueAsBoolean(Field<?> field,
Boolean defaultValue)
Get a value from this record, providing a field.
|
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.
|
Boolean |
getValueAsBoolean(String fieldName)
Get a value from this Record, providing a field name.
|
Boolean |
getValueAsBoolean(String fieldName,
Boolean defaultValue)
Get a value from this record, providing a field name.
|
Byte |
getValueAsByte(Field<?> field)
Get a value from this Record, providing a field.
|
Byte |
getValueAsByte(Field<?> field,
Byte defaultValue)
Get a value from this record, providing a field.
|
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.
|
Byte |
getValueAsByte(String fieldName)
Get a value from this Record, providing a field name.
|
Byte |
getValueAsByte(String fieldName,
Byte defaultValue)
Get a value from this record, providing a field name.
|
Date |
getValueAsDate(Field<?> field)
Get a value from this Record, providing a field.
|
Date |
getValueAsDate(Field<?> field,
Date defaultValue)
Get a value from this record, providing a field.
|
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.
|
Date |
getValueAsDate(String fieldName)
Get a value from this Record, providing a field name.
|
Date |
getValueAsDate(String fieldName,
Date defaultValue)
Get a value from this record, providing a field name.
|
Double |
getValueAsDouble(Field<?> field)
Get a value from this Record, providing a field.
|
Double |
getValueAsDouble(Field<?> field,
Double defaultValue)
Get a value from this record, providing a field.
|
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.
|
Double |
getValueAsDouble(String fieldName)
Get a value from this Record, providing a field name.
|
Double |
getValueAsDouble(String fieldName,
Double defaultValue)
Get a value from this record, providing a field name.
|
Float |
getValueAsFloat(Field<?> field)
Get a value from this Record, providing a field.
|
Float |
getValueAsFloat(Field<?> field,
Float defaultValue)
Get a value from this record, providing a field.
|
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.
|
Float |
getValueAsFloat(String fieldName)
Get a value from this Record, providing a field name.
|
Float |
getValueAsFloat(String fieldName,
Float defaultValue)
Get a value from this record, providing a field name.
|
Integer |
getValueAsInteger(Field<?> field)
Get a value from this Record, providing a field.
|
Integer |
getValueAsInteger(Field<?> field,
Integer defaultValue)
Get a value from this record, providing a field.
|
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.
|
Integer |
getValueAsInteger(String fieldName)
Get a value from this Record, providing a field name.
|
Integer |
getValueAsInteger(String fieldName,
Integer defaultValue)
Get a value from this record, providing a field name.
|
Long |
getValueAsLong(Field<?> field)
Get a value from this Record, providing a field.
|
Long |
getValueAsLong(Field<?> field,
Long defaultValue)
Get a value from this record, providing a field.
|
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.
|
Long |
getValueAsLong(String fieldName)
Get a value from this Record, providing a field name.
|
Long |
getValueAsLong(String fieldName,
Long defaultValue)
Get a value from this record, providing a field name.
|
Short |
getValueAsShort(Field<?> field)
Get a value from this Record, providing a field.
|
Short |
getValueAsShort(Field<?> field,
Short defaultValue)
Get a value from this record, providing a field.
|
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.
|
Short |
getValueAsShort(String fieldName)
Get a value from this Record, providing a field name.
|
Short |
getValueAsShort(String fieldName,
Short defaultValue)
Get a value from this record, providing a field name.
|
String |
getValueAsString(Field<?> field)
Get a value from this Record, providing a field.
|
String |
getValueAsString(Field<?> field,
String defaultValue)
Get a value from this record, providing a field.
|
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.
|
String |
getValueAsString(String fieldName)
Get a value from this Record, providing a field name.
|
String |
getValueAsString(String fieldName,
String defaultValue)
Get a value from this record, providing a field name.
|
Time |
getValueAsTime(Field<?> field)
Get a value from this Record, providing a field.
|
Time |
getValueAsTime(Field<?> field,
Time defaultValue)
Get a value from this record, providing a field.
|
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.
|
Time |
getValueAsTime(String fieldName)
Get a value from this Record, providing a field name.
|
Time |
getValueAsTime(String fieldName,
Time defaultValue)
Get a value from this record, providing a field name.
|
Timestamp |
getValueAsTimestamp(Field<?> field)
Get a value from this Record, providing a field.
|
Timestamp |
getValueAsTimestamp(Field<?> field,
Timestamp defaultValue)
Get a value from this record, providing a field.
|
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.
|
Timestamp |
getValueAsTimestamp(String fieldName)
Get a value from this Record, providing a field name.
|
Timestamp |
getValueAsTimestamp(String fieldName,
Timestamp defaultValue)
Get a value from this record, providing a field name.
|
int |
hashCode() |
<I> I |
internalAPI(Class<I> internalType)
Adapt to an internal type assuming its functionality
This is for JOOQ INTERNAL USE only.
|
<E> E |
into(Class<? extends E> type)
Map resulting records onto a custom type.
|
<E> E |
into(E object)
Map resulting records onto a custom type.
|
<R extends Record> |
into(Table<R> table)
Map resulting records onto a custom record type.
|
Object[] |
intoArray()
Convert this record into an array.
|
Map<String,Object> |
intoMap()
Return this record as a name/value map.
|
<E> E |
map(RecordMapper<Record,E> mapper)
Map this record into a custom mapper callback
|
void |
refresh()
Refresh this record from the database, based on the value of the primary
key or main unique key.
|
<T> void |
setValue(Field<T> field,
T value)
Set a value into this record.
|
<T,U> void |
setValue(Field<T> field,
U value,
Converter<T,? super U> converter)
Set a value into this record.
|
int |
size()
Get the number of fields of this record.
|
int |
store()
Store this record back to the database.
|
String |
toString() |
deleteUsing, original, refreshUsing, storeUsingclone, finalize, getClass, notify, notifyAll, wait, wait, waitdeleteUsing, original, refreshUsing, storeUsingchanged, from, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValueAsArray, getValueAsArray, getValueAsBigDecimal, getValueAsBigDecimal, getValueAsBigDecimal, getValueAsBigDecimal, getValueAsBigInteger, getValueAsBigInteger, getValueAsBigInteger, getValueAsBigInteger, getValueAsBoolean, getValueAsBoolean, getValueAsBoolean, getValueAsBoolean, getValueAsByte, getValueAsByte, getValueAsByte, getValueAsByte, getValueAsDate, getValueAsDate, getValueAsDate, getValueAsDate, getValueAsDouble, getValueAsDouble, getValueAsDouble, getValueAsDouble, getValueAsFloat, getValueAsFloat, getValueAsFloat, getValueAsFloat, getValueAsInteger, getValueAsInteger, getValueAsInteger, getValueAsInteger, getValueAsLong, getValueAsLong, getValueAsLong, getValueAsLong, getValueAsShort, getValueAsShort, getValueAsShort, getValueAsShort, getValueAsString, getValueAsString, getValueAsString, getValueAsString, getValueAsTime, getValueAsTime, getValueAsTime, getValueAsTime, getValueAsTimestamp, getValueAsTimestamp, getValueAsTimestamp, getValueAsTimestamp, into, into, into, intoArray, intoMap, map, setValue, setValue, sizegetField, getField, getField, getFields, getIndexgetValueAsBigDecimal, getValueAsBigDecimal, getValueAsBigInteger, getValueAsBigInteger, getValueAsBoolean, getValueAsBoolean, getValueAsByte, getValueAsByte, getValueAsDate, getValueAsDate, getValueAsDouble, getValueAsDouble, getValueAsFloat, getValueAsFloat, getValueAsInteger, getValueAsInteger, getValueAsLong, getValueAsLong, getValueAsShort, getValueAsShort, getValueAsString, getValueAsString, getValueAsTime, getValueAsTime, getValueAsTimestamp, getValueAsTimestampattachinternalAPIpublic UpdatableRecordImpl(UpdatableTable<R> table)
public final UpdatableTable<R> getTable()
TableRecordgetTable in interface TableRecord<R extends UpdatableRecord<R>>getTable in interface UpdatableRecord<R extends UpdatableRecord<R>>getTable in class TableRecordImpl<R extends UpdatableRecord<R>>public final int store()
UpdatableRecord
Depending on the state of the primary key's or main unique key's value,
an INSERT or an UPDATE statement is executed.
INSERT
statement is executedINSERT statement is executed. jOOQ expects that
primary key values will never change due to the principle of
normalisation in RDBMS. So if client code changes primary key values,
this is interpreted by jOOQ as client code wanting to duplicate this
record.UPDATE statement is executed.
In either statement type, only those fields are inserted/updated, which
had been explicitly set by client code, in order to allow for
DEFAULT values to be applied by the underlying RDBMS. If no
fields were modified, neither an UPDATE nor an
INSERT will be executed.
If there is an IDENTITY column defined on the record's
underlying table (see Table.getIdentity()), then the
auto-generated IDENTITY value is refreshed automatically on
INSERT's. Refreshing is done using
Statement.getGeneratedKeys(), where this is supported by the JDBC
driver. See also InsertQuery.getReturnedRecord() for more details
jOOQ can auto-generate "version" and "timestamp" values that can be used
for optimistic locking. If this is an UpdatableRecord and if this
record returns fields for either
UpdatableTable.getRecordVersion() or
UpdatableTable.getRecordTimestamp(), then these values are set
onto the INSERT or UPDATE statement being
executed. On execution success, the generated values are set to this
record. Use the code-generation configuration to specify naming patterns
for auto-generated "version" and "timestamp" columns.
Should you want to circumvent jOOQ-generated updates to these columns,
you can render an INSERT or UPDATE statement
manually using the various Factory.insertInto(Table),
Factory.update(Table) methods.
If an UPDATE statement is executed and
Settings.isExecuteWithOptimisticLocking() is set to
true, then this record will first be compared with the
latest state in the database. There are two modes of operation for
optimistic locking:
This is the preferred way of using optimistic locking in jOOQ. If this is
an UpdatableRecord and if this record returns fields for either
UpdatableTable.getRecordVersion() or
UpdatableTable.getRecordTimestamp(), then these values are
compared to the corresponding value in the database in the
WHERE clause of the executed DELETE statement.
In order to compare this record with the latest state, the database
record will be locked pessimistically using a
SELECT .. FOR UPDATE statement. Not all databases support
the FOR UPDATE clause natively. Namely, the following
databases will show slightly different behaviour:
SQLDialect.CUBRID and SQLDialect.SQLSERVER: jOOQ will
try to lock the database record using JDBC's
ResultSet.TYPE_SCROLL_SENSITIVE and
ResultSet.CONCUR_UPDATABLE.SQLDialect.SQLITE: No pessimistic locking is possible. Client
code must assure that no race-conditions can occur between jOOQ's
checking of database record state and the actual UPDATE
See SimpleSelectQuery.setForUpdate(boolean) for more details
Possible statements are
INSERT INTO [table] ([modified fields, including keys])
VALUES ([modified values, including keys])
UPDATE [table]
SET [modified fields = modified values, excluding keys]
WHERE [key fields = key values]
AND [version/timestamp fields = version/timestamp values]
This is in fact the same as calling
store(getTable().getMainKey().getFieldsArray())
store in interface UpdatableRecord<R extends UpdatableRecord<R>>1 if the record was stored to the database. 0
if storing was not necessary.public final int delete()
UpdatableRecord
If a DELETE statement is executed and
Settings.isExecuteWithOptimisticLocking() is set to
true, then this record will first be compared with the
latest state in the database. There are two modes of operation for
optimistic locking:
This is the preferred way of using optimistic locking in jOOQ. If this is
an UpdatableRecord and if this record returns fields for either
UpdatableTable.getRecordVersion() or
UpdatableTable.getRecordTimestamp(), then these values are
compared to the corresponding value in the database in the
WHERE clause of the executed DELETE statement.
In order to compare this record with the latest state, the database
record will be locked pessimistically using a
SELECT .. FOR UPDATE statement. Not all databases support
the FOR UPDATE clause natively. Namely, the following
databases will show slightly different behaviour:
SQLDialect.CUBRID and SQLDialect.SQLSERVER: jOOQ will
try to lock the database record using JDBC's
ResultSet.TYPE_SCROLL_SENSITIVE and
ResultSet.CONCUR_UPDATABLE.SQLDialect.SQLITE: No pessimistic locking is possible. Client
code must assure that no race-conditions can occur between jOOQ's
checking of database record state and the actual DELETE
See SimpleSelectQuery.setForUpdate(boolean) for more details
The executed statement is
DELETE FROM [table]
WHERE [key fields = key values]
AND [version/timestamp fields = version/timestamp values]
This is in fact the same as calling
delete(getTable().getMainKey().getFieldsArray())
delete in interface UpdatableRecord<R extends UpdatableRecord<R>>1 if the record was deleted from the database.
0 if deletion was not necessary.public final void refresh()
UpdatableRecord
This is in fact the same as calling
refresh(getTable().getMainKey().getFieldsArray())
The executed statement is
SELECT * FROM [table]
WHERE [main key fields = main key values]
refresh in interface UpdatableRecord<R extends UpdatableRecord<R>>public final R copy()
UpdatableRecordUpdatableRecord.store()
will result in an INSERT statement.copy in interface UpdatableRecord<R extends UpdatableRecord<R>>this record.public final List<Attachable> getAttachables()
AttachableInternalAttachables
This method is for JOOQ INTERNAL USE only. Do not reference directly
getAttachables in interface AttachableInternalpublic final List<Field<?>> getFields()
getFields in interface FieldProviderpublic final <T> Field<T> getField(Field<T> field)
FieldProviderUsually, this will return the field itself. However, if this is an aliased table, the field will be aliased accordingly.
getField in interface FieldProviderT - The generic field typefield - The field to fetchpublic final Field<?> getField(String name)
FieldProvidergetField in interface FieldProvidername - The field to fetchpublic final Field<?> getField(int index)
FieldProvidergetField in interface FieldProviderindex - The field's index of the field to fetchpublic final int size()
Recordpublic final int getIndex(Field<?> field)
FieldProvidergetIndex in interface FieldProviderfield - The field to look forpublic final <T> T getValue(Field<T> field)
Recordpublic final <T> T getValue(Field<T> field, T defaultValue)
Recordpublic final <T> void setValue(Field<T> field, T value)
Recordpublic final <T,U> void setValue(Field<T> field, U value, Converter<T,? super U> converter)
Recordpublic final String getValueAsString(Field<?> field)
RecordgetValueAsString in interface Recordfield - The fieldpublic final String getValueAsString(Field<?> field, String defaultValue)
RecordgetValueAsString in interface Recordfield - The fielddefaultValue - The default value instead of nullnullpublic final Byte getValueAsByte(Field<?> field)
RecordgetValueAsByte in interface Recordfield - The fieldpublic final Byte getValueAsByte(Field<?> field, Byte defaultValue)
RecordgetValueAsByte in interface Recordfield - The fielddefaultValue - The default value instead of nullnullpublic final Short getValueAsShort(Field<?> field)
RecordgetValueAsShort in interface Recordfield - The fieldpublic final Short getValueAsShort(Field<?> field, Short defaultValue)
RecordgetValueAsShort in interface Recordfield - The fielddefaultValue - The default value instead of nullnullpublic final Integer getValueAsInteger(Field<?> field)
RecordgetValueAsInteger in interface Recordfield - The fieldpublic final Integer getValueAsInteger(Field<?> field, Integer defaultValue)
RecordgetValueAsInteger in interface Recordfield - The fielddefaultValue - The default value instead of nullnullpublic final Long getValueAsLong(Field<?> field)
RecordgetValueAsLong in interface Recordfield - The fieldpublic final Long getValueAsLong(Field<?> field, Long defaultValue)
RecordgetValueAsLong in interface Recordfield - The fielddefaultValue - The default value instead of nullnullpublic final BigInteger getValueAsBigInteger(Field<?> field)
RecordgetValueAsBigInteger in interface Recordfield - The fieldpublic final BigInteger getValueAsBigInteger(Field<?> field, BigInteger defaultValue)
RecordgetValueAsBigInteger in interface Recordfield - The fielddefaultValue - The default value instead of nullnullpublic final Float getValueAsFloat(Field<?> field)
RecordgetValueAsFloat in interface Recordfield - The fieldpublic final Float getValueAsFloat(Field<?> field, Float defaultValue)
RecordgetValueAsFloat in interface Recordfield - The fielddefaultValue - The default value instead of nullnullpublic final Double getValueAsDouble(Field<?> field)
RecordgetValueAsDouble in interface Recordfield - The fieldpublic final Double getValueAsDouble(Field<?> field, Double defaultValue)
RecordgetValueAsDouble in interface Recordfield - The fielddefaultValue - The default value instead of nullnullpublic final BigDecimal getValueAsBigDecimal(Field<?> field)
RecordgetValueAsBigDecimal in interface Recordfield - The fieldpublic final BigDecimal getValueAsBigDecimal(Field<?> field, BigDecimal defaultValue)
RecordgetValueAsBigDecimal in interface Recordfield - The fielddefaultValue - The default value instead of nullnullpublic final Boolean getValueAsBoolean(Field<?> field)
Record
boolean values for true are any of these case-insensitive
strings:
1yyestrueonenabled
boolean values for false are any of these case-insensitive
strings:
0nnofalseoffdisabled
All other values evaluate to null
getValueAsBoolean in interface Recordfield - The fieldpublic final Boolean getValueAsBoolean(Field<?> field, Boolean defaultValue)
Record
boolean values for true are any of these case-insensitive
strings:
1yyestrueonenabled
boolean values for false are any of these case-insensitive
strings:
0nnofalseoffdisabled
All other values evaluate to null
getValueAsBoolean in interface Recordfield - The fielddefaultValue - The default value instead of nullnullpublic final Timestamp getValueAsTimestamp(Field<?> field)
RecordgetValueAsTimestamp in interface Recordfield - The fieldpublic final Timestamp getValueAsTimestamp(Field<?> field, Timestamp defaultValue)
RecordgetValueAsTimestamp in interface Recordfield - The fielddefaultValue - The default value instead of nullnullpublic final Date getValueAsDate(Field<?> field)
RecordgetValueAsDate in interface Recordfield - The fieldpublic final Date getValueAsDate(Field<?> field, Date defaultValue)
RecordgetValueAsDate in interface Recordfield - The fielddefaultValue - The default value instead of nullnullpublic final Time getValueAsTime(Field<?> field)
RecordgetValueAsTime in interface Recordfield - The fieldpublic final Time getValueAsTime(Field<?> field, Time defaultValue)
RecordgetValueAsTime in interface Recordfield - The fielddefaultValue - The default value instead of nullnullpublic final Object getValue(int index)
Recordpublic final Object getValue(String fieldName)
Recordpublic final Object getValue(String fieldName, Object defaultValue)
Recordpublic final <A extends ArrayRecord<T>,T> T[] getValueAsArray(Field<A> field)
RecordArrayRecord
field.getValueAsArray in interface RecordA - The generic field parameterT - The ArrayRecord type parameterfield - The fieldpublic final <A extends ArrayRecord<T>,T> T[] getValueAsArray(Field<A> field, T[] defaultValue)
RecordArrayRecord
field.getValueAsArray in interface RecordA - The generic field parameterT - The ArrayRecord type parameterfield - The fielddefaultValue - The default value instead of nullpublic final String getValueAsString(String fieldName)
RecordgetValueAsString in interface RecordfieldName - The field's namepublic final String getValueAsString(String fieldName, String defaultValue)
RecordgetValueAsString in interface RecordfieldName - The field's namedefaultValue - The default value instead of nullnullpublic final Byte getValueAsByte(String fieldName)
RecordgetValueAsByte in interface RecordfieldName - The field's namepublic final Byte getValueAsByte(String fieldName, Byte defaultValue)
RecordgetValueAsByte in interface RecordfieldName - The field's namedefaultValue - The default value instead of nullnullpublic final Short getValueAsShort(String fieldName)
RecordgetValueAsShort in interface RecordfieldName - The field's namepublic final Short getValueAsShort(String fieldName, Short defaultValue)
RecordgetValueAsShort in interface RecordfieldName - The field's namedefaultValue - The default value instead of nullnullpublic final Integer getValueAsInteger(String fieldName)
RecordgetValueAsInteger in interface RecordfieldName - The field's namepublic final Integer getValueAsInteger(String fieldName, Integer defaultValue)
RecordgetValueAsInteger in interface RecordfieldName - The field's namedefaultValue - The default value instead of nullnullpublic final Long getValueAsLong(String fieldName)
RecordgetValueAsLong in interface RecordfieldName - The field's namepublic final Long getValueAsLong(String fieldName, Long defaultValue)
RecordgetValueAsLong in interface RecordfieldName - The field's namedefaultValue - The default value instead of nullnullpublic final BigInteger getValueAsBigInteger(String fieldName)
RecordgetValueAsBigInteger in interface RecordfieldName - The field's namepublic final BigInteger getValueAsBigInteger(String fieldName, BigInteger defaultValue)
RecordgetValueAsBigInteger in interface RecordfieldName - The field's namedefaultValue - The default value instead of nullnullpublic final Float getValueAsFloat(String fieldName)
RecordgetValueAsFloat in interface RecordfieldName - The field's namepublic final Float getValueAsFloat(String fieldName, Float defaultValue)
RecordgetValueAsFloat in interface RecordfieldName - The field's namedefaultValue - The default value instead of nullnullpublic final Double getValueAsDouble(String fieldName)
RecordgetValueAsDouble in interface RecordfieldName - The field's namepublic final Double getValueAsDouble(String fieldName, Double defaultValue)
RecordgetValueAsDouble in interface RecordfieldName - The field's namedefaultValue - The default value instead of nullnullpublic final BigDecimal getValueAsBigDecimal(String fieldName)
RecordgetValueAsBigDecimal in interface RecordfieldName - The field's namepublic final BigDecimal getValueAsBigDecimal(String fieldName, BigDecimal defaultValue)
RecordgetValueAsBigDecimal in interface RecordfieldName - The field's namedefaultValue - The default value instead of nullnullpublic final Boolean getValueAsBoolean(String fieldName)
Record
boolean values for true are any of these case-insensitive
strings:
1yyestrueonenabled
boolean values for false are any of these case-insensitive
strings:
0nnofalseoffdisabled
All other values evaluate to null
getValueAsBoolean in interface RecordfieldName - The field's namepublic final Boolean getValueAsBoolean(String fieldName, Boolean defaultValue)
Record
boolean values for true are any of these case-insensitive
strings:
1yyestrueonenabled
boolean values for false are any of these case-insensitive
strings:
0nnofalseoffdisabled
All other values evaluate to null
getValueAsBoolean in interface RecordfieldName - The field's namedefaultValue - The default value instead of nullnullpublic final Timestamp getValueAsTimestamp(String fieldName)
RecordgetValueAsTimestamp in interface RecordfieldName - The field's namepublic final Timestamp getValueAsTimestamp(String fieldName, Timestamp defaultValue)
RecordgetValueAsTimestamp in interface RecordfieldName - The field's namedefaultValue - The default value instead of nullnullpublic final Date getValueAsDate(String fieldName)
RecordgetValueAsDate in interface RecordfieldName - The field's namepublic final Date getValueAsDate(String fieldName, Date defaultValue)
RecordgetValueAsDate in interface RecordfieldName - The field's namedefaultValue - The default value instead of nullnullpublic final Time getValueAsTime(String fieldName)
RecordgetValueAsTime in interface RecordfieldName - The field's namepublic final Time getValueAsTime(String fieldName, Time defaultValue)
RecordgetValueAsTime in interface RecordfieldName - The field's namedefaultValue - The default value instead of nullnullpublic final <T> T getValue(Field<?> field, Class<? extends T> type)
RecordgetValue in interface RecordT - The conversion type parameterfield - The fieldtype - The conversion typeConvert.convert(Object, Class)public final <T> T getValue(Field<?> field, Class<? extends T> type, T defaultValue)
RecordgetValue in interface RecordT - The conversion type parameterfield - The fieldtype - The conversion typedefaultValue - The default value instead of nullnullConvert.convert(Object, Class)public final <T> T getValue(String fieldName, Class<? extends T> type)
RecordgetValue in interface RecordT - The conversion type parameterfieldName - The field's nametype - The conversion typeConvert.convert(Object, Class)public final <Z> Z getValue(String fieldName, Class<? extends Z> type, Z defaultValue)
RecordgetValue in interface RecordZ - The conversion type parameterfieldName - The field's nametype - The conversion typedefaultValue - The default value instead of nullnullConvert.convert(Object, Class)public final <T,U> U getValue(Field<T> field, Converter<? super T,U> converter)
RecordgetValue in interface RecordT - The database type parameterU - The conversion type parameterfield - The fieldconverter - The data type converterConvert.convert(Object, Converter)public final <T,U> U getValue(Field<T> field, Converter<? super T,U> converter, U defaultValue)
RecordgetValue in interface RecordT - The database type parameterU - The conversion type parameterfield - The fieldconverter - The data type converterdefaultValue - The default value instead of nullnullConvert.convert(Object, Converter)public final <U> U getValue(int index,
Converter<?,U> converter)
RecordgetValue in interface RecordU - The conversion type parameterindex - The field's indexconverter - The data type converterConvert.convert(Object, Converter)public final <U> U getValue(int index,
Converter<?,U> converter,
U defaultValue)
RecordgetValue in interface RecordU - The conversion type parameterindex - The field's indexconverter - The data type converterdefaultValue - The default value instead of nullnullConvert.convert(Object, Converter)public final <U> U getValue(String fieldName, Converter<?,U> converter)
RecordgetValue in interface RecordU - The conversion type parameterfieldName - The field's nameconverter - The data type converterConvert.convert(Object, Converter)public final <U> U getValue(String fieldName, Converter<?,U> converter, U defaultValue)
RecordgetValue in interface RecordU - The conversion type parameterfieldName - The field's nameconverter - The data type converterdefaultValue - The default value instead of nullnullConvert.convert(Object, Converter)public final boolean changed()
Record
If this returns false, then it can be said that
record.equals(record.original()) is true.
changed in interface RecordRecord.original()public final Object[] intoArray()
RecordThe resulting array has the same number of elements as this record has fields. The resulting array contains data as such:
// For arbitrary values of i
record.getValue(i) == record.intoArray()[i]
This is the same as calling into(Object[].class)
public final Map<String,Object> intoMap()
Recordpublic final <E> E into(Class<? extends E> type)
RecordThe mapping algorithm is this:
type is an array:Record.intoArray(). Arrays more specific than
Object[] can be specified as well, e.g.
String[]. If conversion fails, a MappingException is
thrown, wrapping conversion exceptions.
Column
annotations are found on the provided type, only those are
used:type contains public single-argument instance methods
annotated with Column, those methods are invokedtype contains public no-argument instance methods
starting with getXXX or isXXX, annotated with
Column, then matching public setXXX() instance
methods are invokedtype contains public instance member fields annotated
with Column, those members are setColumn.name() must match Field.getName(). All other
annotation attributes are ignoredColumn annotations, or jOOQ can't find the
javax.persistence API on the classpath, jOOQ will map
Record values by naming convention:Field.getName() is MY_field (case-sensitive!), then
this field's value will be set on all of these:
MY_field(...)myField(...)setMY_field(...)setMyField(...)MY_fieldmyFieldConstructorProperties is available, that one
is usedConstructorProperties annotation is
used to match constructor arguments against POJO members or getters.Record values onto constructor arguments.Record values onto constructor arguments.Class.getDeclaredConstructors()Class.getDeclaredConstructors()Proxy
mechanisms. The returned proxy will wrap a HashMap containing
properties mapped by getters and setters of the supplied type. Methods
(even JPA-annotated ones) other than standard POJO getters and setters
are not supported. Details can be seen in Reflect.as(Class).
type must provide a default or a "matching" constructor.
Non-public default constructors are made accessible using
AccessibleObject.setAccessible(boolean)null, this
will result in setting the primitive type's default value (zero for
numbers, or false for booleans). Hence, there is no way of
distinguishing null and 0 in that case.into in interface RecordE - The generic entity type.type - The entity type.Record.from(Object)public final <E> E into(E object)
Record
This is the same as Record.into(Class), except that no new object is
instanciated as a result. Instead, you can provide your own custom POJO
instance.
into in interface RecordE - The generic entity type.object - The receiving bean.Record.from(Object)public final <R extends Record> R into(Table<R> table)
RecordThe mapping algorithm is this:
Record values by equal field names:table argument with
Field.getName() "MY_field" (case-sensitive!), a
corresponding field with the same name in this record will be searched.Field.getName(), then the first one returning true on
Field.equals(Object) will be returned. (e.g. qualified field
names match)Table.getRecordType() must return a class of type
TableRecord, which must provide a default constructor. Non-public
default constructors are made accessible using
AccessibleObject.setAccessible(boolean)public final <E> E map(RecordMapper<Record,E> mapper)
Recordpublic final void from(Object source)
RecordColumn annotations are found on the Class
of the provided source, only those are used. Matching
candidates are:ColumngetXXX
or isXXX, if there exists a matching public single-argument
setXXX() instance method that is annotated with
ColumnColumnColumn.name() must match Field.getName(). All other
annotation attributes are ignoredColumn annotations, or jOOQ can't
find the javax.persistence API on the classpath, jOOQ will
map members by naming convention:Field.getName() is
MY_field (case-sensitive!), then this field's value will be
fetched from the first of these:
MY_field()myField()getMY_field()getMyField()MY_fieldmyFieldUpdatableRecord.store() will perform an INSERT
statement. If you wish to store the record using an UPDATE
statement, use Factory.executeUpdate(UpdatableRecord) instead.from in interface Recordsource - The source object to copy data fromRecord.into(Class)protected final void from(Record source)
public final <I> I internalAPI(Class<I> internalType)
AdapterThis is for JOOQ INTERNAL USE only. If you need to access the internal API, these are the known possible interfaces:
QueryPartInternal: The internal API for QueryPartinternalAPI in interface AdapterI - The internal type's generic type parameter.internalType - The internal typepublic final void attach(Configuration c)
AttachableConfigurationattach in interface Attachablec - A configuration or null, if you wish to
detach this Attachable from its previous
configuration.public final Configuration getConfiguration()
AttachableInternalgetConfiguration in interface AttachableInternalprotected final Factory create()
public final T getValue(int index,
T defaultValue)
Storepublic final BigDecimal getValueAsBigDecimal(int index)
StoregetValueAsBigDecimal in interface Store<T>index - The field's indexpublic final BigDecimal getValueAsBigDecimal(int index, BigDecimal defaultValue)
StoregetValueAsBigDecimal in interface Store<T>index - The field's indexdefaultValue - The default value instead of nullnullpublic final Boolean getValueAsBoolean(int index)
Store
boolean values for true are any of these case-insensitive
strings:
1yyestrueonenabled
boolean values for false are any of these case-insensitive
strings:
0nnofalseoffdisabled
All other values evaluate to null
getValueAsBoolean in interface Store<T>index - The field's indexpublic final Boolean getValueAsBoolean(int index, Boolean defaultValue)
Store
boolean values for true are any of these case-insensitive
strings:
1yyestrueonenabled
boolean values for false are any of these case-insensitive
strings:
0nnofalseoffdisabled
All other values evaluate to null
getValueAsBoolean in interface Store<T>index - The field's indexdefaultValue - The default value instead of nullnullpublic final BigInteger getValueAsBigInteger(int index)
StoregetValueAsBigInteger in interface Store<T>index - The field's indexpublic final BigInteger getValueAsBigInteger(int index, BigInteger defaultValue)
StoregetValueAsBigInteger in interface Store<T>index - The field's indexdefaultValue - The default value instead of nullnullpublic final Byte getValueAsByte(int index)
StoregetValueAsByte in interface Store<T>index - The field's indexpublic final Byte getValueAsByte(int index, Byte defaultValue)
StoregetValueAsByte in interface Store<T>index - The field's indexdefaultValue - The default value instead of nullnullpublic final Date getValueAsDate(int index)
StoregetValueAsDate in interface Store<T>index - The field's indexpublic final Date getValueAsDate(int index, Date defaultValue)
StoregetValueAsDate in interface Store<T>index - The field's indexdefaultValue - The default value instead of nullnullpublic final Double getValueAsDouble(int index)
StoregetValueAsDouble in interface Store<T>index - The field's indexpublic final Double getValueAsDouble(int index, Double defaultValue)
StoregetValueAsDouble in interface Store<T>index - The field's indexdefaultValue - The default value instead of nullnullpublic final Float getValueAsFloat(int index)
StoregetValueAsFloat in interface Store<T>index - The field's indexpublic final Float getValueAsFloat(int index, Float defaultValue)
StoregetValueAsFloat in interface Store<T>index - The field's indexdefaultValue - The default value instead of nullnullpublic final Integer getValueAsInteger(int index)
StoregetValueAsInteger in interface Store<T>index - The field's indexpublic final Integer getValueAsInteger(int index, Integer defaultValue)
StoregetValueAsInteger in interface Store<T>index - The field's indexdefaultValue - The default value instead of nullnullpublic final Long getValueAsLong(int index)
StoregetValueAsLong in interface Store<T>index - The field's indexpublic final Long getValueAsLong(int index, Long defaultValue)
StoregetValueAsLong in interface Store<T>index - The field's indexdefaultValue - The default value instead of nullnullpublic final Short getValueAsShort(int index)
StoregetValueAsShort in interface Store<T>index - The field's indexpublic final Short getValueAsShort(int index, Short defaultValue)
StoregetValueAsShort in interface Store<T>index - The field's indexdefaultValue - The default value instead of nullnullpublic final String getValueAsString(int index)
StoregetValueAsString in interface Store<T>index - The field's indexpublic final String getValueAsString(int index, String defaultValue)
StoregetValueAsString in interface Store<T>index - The field's indexdefaultValue - The default value instead of nullnullpublic final Time getValueAsTime(int index)
StoregetValueAsTime in interface Store<T>index - The field's indexpublic final Time getValueAsTime(int index, Time defaultValue)
StoregetValueAsTime in interface Store<T>index - The field's indexdefaultValue - The default value instead of nullnullpublic final Timestamp getValueAsTimestamp(int index)
StoregetValueAsTimestamp in interface Store<T>index - The field's indexpublic final Timestamp getValueAsTimestamp(int index, Timestamp defaultValue)
StoregetValueAsTimestamp in interface Store<T>index - The field's indexdefaultValue - The default value instead of nullnullpublic final <Z> Z getValue(int index,
Class<? extends Z> type)
StoregetValue in interface Store<T>Z - The conversion type parameterindex - The field's indextype - The conversion typeConvert.convert(Object, Class)public final <Z> Z getValue(int index,
Class<? extends Z> type,
Z defaultValue)
StoregetValue in interface Store<T>Z - The conversion type parameterindex - The field's indextype - The conversion typedefaultValue - The default value instead of nullnullConvert.convert(Object, Class)Copyright © 2013. All Rights Reserved.