com.googlecode.objectify.impl.conv
Class BooleanConverter
java.lang.Object
com.googlecode.objectify.impl.conv.BooleanConverter
- All Implemented Interfaces:
- Converter
public class BooleanConverter
- extends java.lang.Object
- implements Converter
Knows how to convert Booleans. This is only required because of the Java's
funky incoherence of primitive types vs wrapper types - when you have a primitive
type field, the value will be Boolean.class but the fieldType will be Boolean.TYPE.
The normal assignableTo test will fail and we'll go through the converters. This
converter is just smart enough to recognize Boolean.TYPE and continue on as normal
for the (expected) wrapper type.
Method Summary |
java.lang.Object |
forDatastore(java.lang.Object value,
ConverterSaveContext ctx)
Convert the value into an object suitable for storage in the datastore. |
java.lang.Object |
forPojo(java.lang.Object value,
java.lang.Class<?> fieldType,
ConverterLoadContext ctx,
java.lang.Object onPojo)
Convert the value into an object suitable for setting on a field with
the specified type. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BooleanConverter
public BooleanConverter()
forDatastore
public java.lang.Object forDatastore(java.lang.Object value,
ConverterSaveContext ctx)
- Description copied from interface:
Converter
- Convert the value into an object suitable for storage in the datastore.
The first thing converters should do is test whether they are appropriate
for the input data; if not, return null.
- Specified by:
forDatastore
in interface Converter
- Parameters:
value
- will never be null
- Returns:
- null to indicate that this converter does nothing with the value
forPojo
public java.lang.Object forPojo(java.lang.Object value,
java.lang.Class<?> fieldType,
ConverterLoadContext ctx,
java.lang.Object onPojo)
- Description copied from interface:
Converter
- Convert the value into an object suitable for setting on a field with
the specified type.
The first thing converters should do is test whether they are appropriate
for the input data; if not, return null.
- Specified by:
forPojo
in interface Converter
- Parameters:
value
- will never be nullfieldType
- is the type that the value should be converted toonPojo
- is the actual pojo object that this value will eventually be set upon
- Returns:
- null to indicate that this converter does nothing with the value
Copyright © 2011 Jeff Schnitzer and a gang of pirates. All Rights Reserved. Build version: 3.1