Class WbsRecord

java.lang.Object
wbs.utils.util.database.WbsRecord

public class WbsRecord extends Object
  • Constructor Details

  • Method Details

    • setField

      public boolean setField(WbsField field, Object value)
    • getValue

      public <T> T getValue(WbsField field, Class<T> clazz)
    • getOrDefault

      public <T> T getOrDefault(WbsField field, Class<T> clazz)
    • getValue

      public Object getValue(WbsField field)
    • getOrDefault

      public Object getOrDefault(WbsField field)
    • getAnonymousField

      public Object getAnonymousField(String anonName)
    • upsert

      public boolean upsert(WbsTable table)
    • insert

      public boolean insert(WbsTable table)
      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

      public boolean insertIfNotDefault(WbsTable table)
      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

      public boolean update(WbsTable table)
    • hasValue

      public boolean hasValue(WbsField field)
    • isDefault

      public boolean isDefault(@NotNull @NotNull WbsField field)
      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

      public boolean isNonPrimaryDefault(WbsTable table)
      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()