|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.commons.convert.conversion.DefaultValueDecorator
public class DefaultValueDecorator
A utility class for decorating conversions and factories with default value behaviour.
Each public static method on this class will decorate the input conversion/factory with additional behaviour. Depending on the method it may return a default value in the case of an exception or null value
To use this facility, create an instance of the conversion/factory as normal.
Then pass it to one of the static methods on this class.
Finally add it as per normal to the ConverterRegistry.
| Constructor Summary | |
|---|---|
protected |
DefaultValueDecorator()
Restricted constructor. |
| Method Summary | |
|---|---|
static ConversionFactory |
defaultException(ConversionFactory factory,
Object defaultValue)
Creates a ConversionFactory that decorates the original and adds behaviour to return a default value when the conversion throws an exception. |
static Conversion |
defaultException(Conversion conversion,
Object defaultValue)
Creates a Conversion that decorates the original and adds behaviour to return a default value when the conversion throws an exception. |
static ConversionFactory |
defaultNullAndException(ConversionFactory factory,
Object defaultValue)
Creates a ConversionFactory that decorates the original and adds behaviour to return a default value for null input, null result and when an exception occurs. |
static Conversion |
defaultNullAndException(Conversion conversion,
Object defaultValue)
Creates a Conversion that decorates the original and adds behaviour to return a default value for null input, null result and when an exception occurs. |
static ConversionFactory |
defaultNullInput(ConversionFactory factory,
Object defaultValue)
Creates a ConversionFactory that decorates the original and adds behaviour to return a default value when the conversion input is null. |
static Conversion |
defaultNullInput(Conversion conversion,
Object defaultValue)
Creates a Conversion that decorates the original and adds behaviour to return a default value when the conversion input is null. |
static ConversionFactory |
defaultNullResult(ConversionFactory factory,
Object defaultValue)
Creates a ConversionFactory that decorates the original and adds behaviour to return a default value when the conversion results in null. |
static Conversion |
defaultNullResult(Conversion conversion,
Object defaultValue)
Creates a Conversion that decorates the original and adds behaviour to return a default value when the conversion results in null. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
protected DefaultValueDecorator()
| Method Detail |
|---|
public static Conversion defaultNullResult(Conversion conversion,
Object defaultValue)
conversion - the conversion to decorate, not nulldefaultValue - the value to return if conversion result is null
public static Conversion defaultNullInput(Conversion conversion,
Object defaultValue)
conversion - the conversion to decorate, not nulldefaultValue - the value to return if conversion input is null
public static Conversion defaultException(Conversion conversion,
Object defaultValue)
conversion - the conversion to decorate, not nulldefaultValue - the value to return if conversion throws an exception
public static Conversion defaultNullAndException(Conversion conversion,
Object defaultValue)
conversion - the conversion to decorate, not nulldefaultValue - the default value to return
public static ConversionFactory defaultNullResult(ConversionFactory factory,
Object defaultValue)
factory - the factory to decorate, not nulldefaultValue - the value to return if conversion result is null
public static ConversionFactory defaultNullInput(ConversionFactory factory,
Object defaultValue)
factory - the factory to decorate, not nulldefaultValue - the value to return if conversion input is null
public static ConversionFactory defaultException(ConversionFactory factory,
Object defaultValue)
factory - the factory to decorate, not nulldefaultValue - the value to return if conversion throws an exception
public static ConversionFactory defaultNullAndException(ConversionFactory factory,
Object defaultValue)
factory - the factory to decorate, not nulldefaultValue - the default value to return
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||