Class BooleanYNConverter

java.lang.Object
org.kuali.rice.krad.data.jpa.converters.BooleanYNConverter
All Implemented Interfaces:
javax.persistence.AttributeConverter<Boolean,String>

public class BooleanYNConverter extends Object implements javax.persistence.AttributeConverter<Boolean,String>
Converts true/false represented by a set of yes characters and the character "N" to and from true and false.

The conversion treats the values as follows: "Y", "y", "true", and "TRUE" are all true and "N" is false.

Author:
Kuali Rice Team (rice.collab@kuali.org)
  • Field Details

    • YES_VALUES

      protected static final Set<String> YES_VALUES
      Defines the set of values that all correspond to yes.
  • Constructor Details

    • BooleanYNConverter

      public BooleanYNConverter()
  • Method Details

    • convertToDatabaseColumn

      public String convertToDatabaseColumn(Boolean objectValue)
      This implementation will convert from a false or true value to an "N" or "Y" value.
      Specified by:
      convertToDatabaseColumn in interface javax.persistence.AttributeConverter<Boolean,String>
    • convertToEntityAttribute

      public Boolean convertToEntityAttribute(String dataValue)
      This implementation will convert from a "F" or any of the yes values to a false or true.
      Specified by:
      convertToEntityAttribute in interface javax.persistence.AttributeConverter<Boolean,String>