java.lang.Object
org.springframework.data.cassandra.core.cql.keyspace.DefaultOption
All Implemented Interfaces:
Option

public class DefaultOption extends Object implements Option
A default implementation of Option.
Author:
Matthew T. Adams, Mark Paluch
  • Constructor Details

    • DefaultOption

      public DefaultOption(String name, Class<?> type, boolean requiresValue, boolean escapesValue, boolean quotesValue)
  • Method Details

    • isCoerceable

      public boolean isCoerceable(Object value)
      Description copied from interface: Option
      Tests whether the given value can be coerced into the type given by Option.getType().
      Specified by:
      isCoerceable in interface Option
    • getType

      public Class<?> getType()
      Description copied from interface: Option
      The type that values must be able to be coerced into for this option.
      Specified by:
      getType in interface Option
    • getName

      public String getName()
      Description copied from interface: Option
      The (usually lower-cased, underscore-separated) name of this table option.
      Specified by:
      getName in interface Option
    • takesValue

      public boolean takesValue()
      Description copied from interface: Option
      Whether this option takes a value.
      Specified by:
      takesValue in interface Option
    • requiresValue

      public boolean requiresValue()
      Description copied from interface: Option
      Whether this option requires a value.
      Specified by:
      requiresValue in interface Option
    • escapesValue

      public boolean escapesValue()
      Description copied from interface: Option
      Whether this option should escape single quotes in its value.
      Specified by:
      escapesValue in interface Option
    • quotesValue

      public boolean quotesValue()
      Description copied from interface: Option
      Whether this option's value should be single-quoted.
      Specified by:
      quotesValue in interface Option
    • checkValue

      public void checkValue(@Nullable Object value)
      Description copied from interface: Option
      Checks that the given value can be coerced into the type given by Option.getType().
      Specified by:
      checkValue in interface Option
    • toString

      public String toString(@Nullable Object value)
      Description copied from interface: Option
      First ensures that the given value is coerceable into the type expected by this option, then returns the result of Object.toString() called on the given value. If this option is escaping quotes (Option.escapesValue() is true), then single quotes will be escaped, and if this option is quoting values ( Option.quotesValue() is true), then the value will be surrounded by single quotes. Given null, returns an empty string.
      Specified by:
      toString in interface Option
      See Also:
    • toString

      public String toString()
      Overrides:
      toString in class Object