Enum PutMethod

java.lang.Object
java.lang.Enum<PutMethod>
io.datarouter.storage.config.PutMethod
All Implemented Interfaces:
io.datarouter.util.enums.IntegerEnum<PutMethod>, io.datarouter.util.enums.PersistentString, io.datarouter.util.enums.StringEnum<PutMethod>, Serializable, Comparable<PutMethod>, java.lang.constant.Constable

public enum PutMethod
extends Enum<PutMethod>
implements io.datarouter.util.enums.IntegerEnum<PutMethod>, io.datarouter.util.enums.StringEnum<PutMethod>
Defines the strategy used when writing a databean to a datastore, especially the behavior when trying to put a databean which has a key that already exists.
  • Enum Constant Details

    • SELECT_FIRST_OR_LOOK_AT_PRIMARY_KEY

      public static final PutMethod SELECT_FIRST_OR_LOOK_AT_PRIMARY_KEY
      Get the primary key first to determine whether to update or insert. Slow, and may not be thread safe.
    • UPDATE_OR_INSERT

      public static final PutMethod UPDATE_OR_INSERT
      Try to update, and in case of failure, issue an insert. Good to use when rows are usually there.
    • INSERT_OR_UPDATE

      public static final PutMethod INSERT_OR_UPDATE
      Try to insert, and in case of failure, issue an update.
    • INSERT_OR_BUST

      public static final PutMethod INSERT_OR_BUST
      Try to insert the databean, and throw an exception if the primary key already exists.
    • UPDATE_OR_BUST

      public static final PutMethod UPDATE_OR_BUST
      Try to update the row at this primary key, and throw an exception if the primary key does not exist.
    • MERGE

      public static final PutMethod MERGE
    • INSERT_IGNORE

      public static final PutMethod INSERT_IGNORE
      Try to insert the databean and ignore any error that may come up. If the key already exists, or any other error happens, silently abort the put.
    • INSERT_ON_DUPLICATE_UPDATE

      public static final PutMethod INSERT_ON_DUPLICATE_UPDATE
      Try to insert, or update all the non-key fields if the key already exists. Performs the put as a single operation if the datastore supports it. This is the default.
    • UPDATE_IGNORE

      public static final PutMethod UPDATE_IGNORE
      Try to update the databean and ignore any error that may come up, like if the primary key does not exist.
  • Field Details

  • Method Details

    • values

      public static PutMethod[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static PutMethod valueOf​(String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum type has no constant with the specified name
      NullPointerException - if the argument is null
    • getShouldAutoCommit

      public boolean getShouldAutoCommit()
    • getPersistentInteger

      public Integer getPersistentInteger()
      Specified by:
      getPersistentInteger in interface io.datarouter.util.enums.IntegerEnum<PutMethod>
    • fromPersistentInteger

      public PutMethod fromPersistentInteger​(Integer integer)
      Specified by:
      fromPersistentInteger in interface io.datarouter.util.enums.IntegerEnum<PutMethod>
    • getPersistentString

      public String getPersistentString()
      Specified by:
      getPersistentString in interface io.datarouter.util.enums.PersistentString
    • fromPersistentString

      public PutMethod fromPersistentString​(String string)
      Specified by:
      fromPersistentString in interface io.datarouter.util.enums.StringEnum<PutMethod>