org.kuali.rice.krad.data.jpa.converters
Class BooleanYNConverter

java.lang.Object
  extended by 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 Summary
protected static Set<String> YES_VALUES
          Defines the set of values that all correspond to yes.
 
Constructor Summary
BooleanYNConverter()
           
 
Method Summary
 String convertToDatabaseColumn(Boolean objectValue)
           This implementation will convert from a false or true value to an "N" or "Y" value.
 Boolean convertToEntityAttribute(String dataValue)
           This implementation will convert from a "F" or any of the yes values to a false or true.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

YES_VALUES

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

Constructor Detail

BooleanYNConverter

public BooleanYNConverter()
Method Detail

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>


Copyright © 2005–2014 The Kuali Foundation. All rights reserved.