org.ubercraft.sucre.coercer
Class CoercerUtil

java.lang.Object
  extended by org.ubercraft.sucre.coercer.CoercerUtil

public final class CoercerUtil
extends Object


Field Summary
static Coercer DEFAULT_COERCER
           
 
Constructor Summary
CoercerUtil()
           
 
Method Summary
static BigDecimal coerceToBigDecimal(Object object, boolean strict)
           
static BigDecimal coerceToBigDecimal(Object object, boolean strict, BigDecimal defaultValue)
           
static BigInteger coerceToBigInteger(Object object, boolean strict)
           
static BigInteger coerceToBigInteger(Object object, boolean strict, BigInteger defaultValue)
           
static Boolean coerceToBoolean(Object object, boolean strict)
           
static Boolean coerceToBoolean(Object object, boolean strict, Boolean defaultValue)
           
static Byte coerceToByte(Object object, boolean strict)
           
static Byte coerceToByte(Object object, boolean strict, Byte defaultValue)
           
static Character coerceToChar(Object object, boolean strict)
           
static Character coerceToChar(Object object, boolean strict, Character defaultValue)
           
static Double coerceToDouble(Object object, boolean strict)
           
static Double coerceToDouble(Object object, boolean strict, Double defaultValue)
           
static Enum<?> coerceToEnum(Class<? extends Enum> type, Object object, boolean strict)
           
static Enum<?> coerceToEnum(Class<? extends Enum> type, Object object, boolean strict, Enum<?> defaultValue)
           
static Integer coerceToInteger(Object object, boolean strict)
           
static Integer coerceToInteger(Object object, boolean strict, Integer defaultValue)
           
static Long coerceToLong(Object object, boolean strict)
           
static Long coerceToLong(Object object, boolean strict, Long defaultValue)
           
static Short coerceToShort(Object object, boolean strict)
           
static Short coerceToShort(Object object, boolean strict, Short defaultValue)
           
static String coerceToString(Object object)
           
static String coerceToString(Object object, String defaultValue)
           
static
<T> T
coerceValue(Object value, Class<? extends T> type, boolean strict)
           
static
<T> T
coerceValue(Object value, Class<? extends T> type, boolean strict, T defaultValue)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_COERCER

public static final Coercer DEFAULT_COERCER
Constructor Detail

CoercerUtil

public CoercerUtil()
Method Detail

coerceToString

public static String coerceToString(Object object)

coerceToString

public static String coerceToString(Object object,
                                    String defaultValue)

coerceToBoolean

public static Boolean coerceToBoolean(Object object,
                                      boolean strict)

coerceToBoolean

public static Boolean coerceToBoolean(Object object,
                                      boolean strict,
                                      Boolean defaultValue)

coerceToInteger

public static Integer coerceToInteger(Object object,
                                      boolean strict)

coerceToInteger

public static Integer coerceToInteger(Object object,
                                      boolean strict,
                                      Integer defaultValue)

coerceToDouble

public static Double coerceToDouble(Object object,
                                    boolean strict)

coerceToDouble

public static Double coerceToDouble(Object object,
                                    boolean strict,
                                    Double defaultValue)

coerceToLong

public static Long coerceToLong(Object object,
                                boolean strict)

coerceToLong

public static Long coerceToLong(Object object,
                                boolean strict,
                                Long defaultValue)

coerceToByte

public static Byte coerceToByte(Object object,
                                boolean strict)

coerceToByte

public static Byte coerceToByte(Object object,
                                boolean strict,
                                Byte defaultValue)

coerceToShort

public static Short coerceToShort(Object object,
                                  boolean strict)

coerceToShort

public static Short coerceToShort(Object object,
                                  boolean strict,
                                  Short defaultValue)

coerceToChar

public static Character coerceToChar(Object object,
                                     boolean strict)

coerceToChar

public static Character coerceToChar(Object object,
                                     boolean strict,
                                     Character defaultValue)

coerceToBigInteger

public static BigInteger coerceToBigInteger(Object object,
                                            boolean strict)

coerceToBigInteger

public static BigInteger coerceToBigInteger(Object object,
                                            boolean strict,
                                            BigInteger defaultValue)

coerceToBigDecimal

public static BigDecimal coerceToBigDecimal(Object object,
                                            boolean strict)

coerceToBigDecimal

public static BigDecimal coerceToBigDecimal(Object object,
                                            boolean strict,
                                            BigDecimal defaultValue)

coerceToEnum

public static Enum<?> coerceToEnum(Class<? extends Enum> type,
                                   Object object,
                                   boolean strict)

coerceToEnum

public static Enum<?> coerceToEnum(Class<? extends Enum> type,
                                   Object object,
                                   boolean strict,
                                   Enum<?> defaultValue)

coerceValue

public static <T> T coerceValue(Object value,
                                Class<? extends T> type,
                                boolean strict)

coerceValue

public static <T> T coerceValue(Object value,
                                Class<? extends T> type,
                                boolean strict,
                                T defaultValue)


Copyright © 2013. All Rights Reserved.