Class DBField

java.lang.Object
ch.autumo.beetroot.utils.database.DBField

public class DBField extends Object
DB field.
  • Field Details

    • LOG

      protected static final org.slf4j.Logger LOG
      Logger for this class.
  • Constructor Details

    • DBField

      public DBField(String name, String type, boolean isNullable, boolean unique, String defaultVal)
      Constructor.
      Parameters:
      name - column name
      type - column type
      isNullable - is nullable?
      unique - is unique?
      defaultVal - column default value
  • Method Details

    • getDefaultVal

      public String getDefaultVal()
      Returns the default value.
      Returns:
      the default value
    • getName

      public String getName()
      Returns the field name.
      Returns:
      the field name
    • getType

      public String getType()
      Returns the field type.
      Returns:
      the field type
    • isUnique

      public boolean isUnique()
      Checks whether the field is unique.
      Returns:
      true if the field is unique
    • isNullable

      public boolean isNullable()
      Checks whether the field is nullable.
      Returns:
      true if the field is nullable
    • toString

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

      public String serialize(DBField field) throws com.fasterxml.jackson.core.JsonProcessingException
      Serialize this field to JSON.
      Parameters:
      field - field
      Returns:
      JSON string
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException - JSON processing exception