Package wbs.utils.util.database
Class WbsRecord
java.lang.Object
wbs.utils.util.database.WbsRecord
-
Constructor Summary
ConstructorsConstructorDescriptionWbsRecord(WbsDatabase database) WbsRecord(WbsDatabase database, ResultSet set) WbsRecord(WbsDatabase database, Map<WbsField, Object> fieldsMap) -
Method Summary
Modifier and TypeMethodDescriptiongetAnonymousField(String anonName) getOrDefault(WbsField field) <T> TgetOrDefault(WbsField field, Class<T> clazz) <T> TbooleanbooleanInserts this record into the given table, ignoring fields not present on the table.booleaninsertIfNotDefault(WbsTable table) Conditionally inserts this record into the given table, ignoring fields not present on the table.booleanChecks if a given field on this object matches the default for the field.booleanisNonPrimaryDefault(WbsTable table) Returns true if this record is a default record for the given table, excluding the table's primary key.booleanintsize()booleanboolean
-
Constructor Details
-
WbsRecord
-
WbsRecord
-
WbsRecord
- Throws:
SQLExceptionWbsDatabaseException
-
-
Method Details
-
setField
-
getValue
-
getOrDefault
-
getValue
-
getOrDefault
-
getAnonymousField
-
upsert
-
insert
Inserts this record into the given table, ignoring fields not present on the table.- Parameters:
table- The table to insert into.- Returns:
- True if the record was inserted without issue, false if an error was encountered.
-
insertIfNotDefault
Conditionally inserts this record into the given table, ignoring fields not present on the table. The record will only be inserted if its fields do not match the defaults specified on the table's fields.- Parameters:
table- The table to insert into.- Returns:
- True if the record was inserted without issue, false if an error was encountered or if the record was default.
-
update
-
hasValue
-
isDefault
Checks if a given field on this object matches the default for the field. If no field default is set, and this record has a non-null value, this will return false.- Parameters:
field- The field to check- Returns:
- True if the set field matches the field default.
-
isNonPrimaryDefault
Returns true if this record is a default record for the given table, excluding the table's primary key.- Returns:
- True if all fields except the primary key are default.
-
size
public int size()
-