Enum Class BooleanConverters

java.lang.Object
java.lang.Enum<BooleanConverters>
com.jbstrap.ui.converters.BooleanConverters
All Implemented Interfaces:
Converter, Serializable, Comparable<BooleanConverters>, Constable

public enum BooleanConverters extends Enum<BooleanConverters> implements Converter
Boolean converter implementation.
Since:
4.0
Author:
JBStrap
  • Enum Constant Details

    • YES_NO

      public static final BooleanConverters YES_NO
      If you choose this implementation, boolean values are converted to “Y” and “N”. A “Y” corresponds to true and an “N” to false. In case of a reverse conversion, a “Y” value is the equivalent of true and all other values are equal to false.
    • NUMBER

      public static final BooleanConverters NUMBER
      If you choose this implementation, boolean values are converted to 1 and 0. A 1 corresponds to true and 0 to false. In case of a reverse conversion, a 1 value is the equivalent of true and all other values are equal to false.
    • BOOLEAN

      public static final BooleanConverters BOOLEAN
      If you choose this implementation, boolean values are not converted.
    • BOOLEAN_STRING

      public static final BooleanConverters BOOLEAN_STRING
      If you choose this implementation, boolean values are converted to “true” and “false”. A true corresponds to “true” and a false to “false”. In case of a reverse conversion, a “true” value is the equivalent of true and all other values are equal to false.
  • Method Details

    • values

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

      public static BooleanConverters valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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 class has no constant with the specified name
      NullPointerException - if the argument is null
    • toJava

      public Object toJava(Object value)
      Reconverts any value to a boolean value.
      Specified by:
      toJava in interface Converter
      Parameters:
      value - Database value
      Returns:
      Boolean value
    • toDatabase

      public Object toDatabase(Object value)
      Converts a boolean value.
      Specified by:
      toDatabase in interface Converter
      Parameters:
      value - Boolean value to be converted
      Returns:
      Converted value (saved to database)