net.stickycode.coercion
Interface Coercion<T>

Type Parameters:
T - The type that can be converted to

public interface Coercion<T>

Contract for a converter of strings to a define type.


Method Summary
 T coerce(CoercionTarget type, String value)
          Coerce the given string value into the type represented by this coercion.
 boolean isApplicableTo(CoercionTarget type)
          Return true if this coercion is applicable for the given target type
 

Method Detail

coerce

T coerce(CoercionTarget type,
         String value)
         throws AbstractFailedToCoerceValueException
Coerce the given string value into the type represented by this coercion.

Parameters:
value - The string value to convert. WILL NOT be null.
Returns:
A non null string value
Throws:
A - subtype of AbstractFailedToCoerceValueException if the value was not valid
AbstractFailedToCoerceValueException

isApplicableTo

boolean isApplicableTo(CoercionTarget type)
Return true if this coercion is applicable for the given target type



Copyright © 2003-2011 RedEngine Ltd. All Rights Reserved.