|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.fudgemsg.types.PrimitiveFieldTypesConverter<Target>
Target
- primitive field type to convert topublic abstract class PrimitiveFieldTypesConverter<Target>
Basic conversions between the types defined in PrimitiveFieldTypes
. Conversion which will lose
data (i.e. out of range) are not permitted and will trigger exceptions. The main use of these is to
support field value conversion between the various width integral types.
Field Summary | |
---|---|
static PrimitiveFieldTypesConverter<Boolean> |
BOOLEAN_CONVERTER
Singleton converter for the Boolean type. |
static PrimitiveFieldTypesConverter<Byte> |
BYTE_CONVERTER
Singleton converter for the Byte type. |
static PrimitiveFieldTypesConverter<Double> |
DOUBLE_CONVERTER
Singleton converter for the Double type. |
static PrimitiveFieldTypesConverter<Float> |
FLOAT_CONVERTER
Singleton converter for the Float type. |
static PrimitiveFieldTypesConverter<Integer> |
INT_CONVERTER
Singleton converter for the Integer type. |
static PrimitiveFieldTypesConverter<Long> |
LONG_CONVERTER
Singleton converter for the Long type. |
static PrimitiveFieldTypesConverter<Short> |
SHORT_CONVERTER
Singleton converter for the Short type. |
Method Summary | |
---|---|
boolean |
canConvertPrimary(Class<?> clazz)
Returns true if this converter can manipulate the requested class. |
protected String |
getTargetTypeName()
Returns the descriptive target type name (e.g. |
Target |
primaryToSecondary(Object value)
Converts an object to the secondary type this converter supports. |
protected double |
rangeCheck(double value)
Checks a value is within the range specified at construction |
protected double |
rangeCheck(double lo,
double hi,
double value)
Checks a value is within the range (inclusive) |
protected int |
rangeCheck(int value)
Checks a value is within the range specified at construction. |
protected long |
rangeCheck(long value)
Checks a value is within the range specified at construction. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final PrimitiveFieldTypesConverter<Boolean> BOOLEAN_CONVERTER
Boolean
type.
public static final PrimitiveFieldTypesConverter<Byte> BYTE_CONVERTER
Byte
type.
public static final PrimitiveFieldTypesConverter<Short> SHORT_CONVERTER
Short
type.
public static final PrimitiveFieldTypesConverter<Integer> INT_CONVERTER
Integer
type.
public static final PrimitiveFieldTypesConverter<Long> LONG_CONVERTER
Long
type.
public static final PrimitiveFieldTypesConverter<Float> FLOAT_CONVERTER
Float
type.
public static final PrimitiveFieldTypesConverter<Double> DOUBLE_CONVERTER
Double
type.
Method Detail |
---|
protected String getTargetTypeName()
protected int rangeCheck(int value)
value
- value to check
IllegalArgumentException
- if the value is out of rangeprotected long rangeCheck(long value)
value
- value to check
IllegalArgumentException
- if the value is out of rangeprotected double rangeCheck(double value)
value
- value to check
IllegalArgumentException
- if the value is out of rangeprotected double rangeCheck(double lo, double hi, double value)
lo
- lower-bound of the rangehi
- upper-bound of the rangevalue
- value to check
IllegalArgumentException
- if the value is out of rangepublic boolean canConvertPrimary(Class<?> clazz)
canConvertPrimary
in interface FudgeTypeConverter<Object,Target>
clazz
- to query
true
if a call to FudgeTypeConverter.primaryToSecondary(Primary)
will succeed, false
if it would failpublic Target primaryToSecondary(Object value)
primaryToSecondary
in interface FudgeTypeConverter<Object,Target>
value
- to convert
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |