org.joda.beans.ser
Class SerOptional

java.lang.Object
  extended by org.joda.beans.ser.SerOptional

public class SerOptional
extends Object

Assists with serialization and deserialization of optional properties.


Constructor Summary
SerOptional()
           
 
Method Summary
static Class<?> extractType(MetaProperty<?> metaProp, Class<?> beanType)
          Extracts the value of the property from a bean, unwrapping any optional.
static Object extractValue(MetaProperty<?> metaProp, Bean bean)
          Extracts the value of the property from a bean, unwrapping any optional.
static Object wrapValue(MetaProperty<?> metaProp, Class<?> beanType, Object value)
          Wraps the value of a property if it is an optional.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SerOptional

public SerOptional()
Method Detail

extractValue

public static Object extractValue(MetaProperty<?> metaProp,
                                  Bean bean)
Extracts the value of the property from a bean, unwrapping any optional.

Parameters:
metaProp - the property to query, not null
bean - the bean to query, not null
Returns:
the value of the property, with any optional wrapper removed

extractType

public static Class<?> extractType(MetaProperty<?> metaProp,
                                   Class<?> beanType)
Extracts the value of the property from a bean, unwrapping any optional.

Parameters:
metaProp - the property to query, not null
beanType - the type of the bean, not null
Returns:
the type of the property with any optional wrapper removed

wrapValue

public static Object wrapValue(MetaProperty<?> metaProp,
                               Class<?> beanType,
                               Object value)
Wraps the value of a property if it is an optional.

Parameters:
metaProp - the property to query, not null
beanType - the type of the bean, not null
value - the value to wrap, may be null
Returns:
the value of the property, with any optional wrapper added


Copyright © 2007–2017 Joda.org. All rights reserved.