SOURCE - is the generic type of the values to convert.public interface GenericValueConverter<SOURCE>
<SOURCE>) to a given target-type ( <TARGET>). ComposedValueConverter,
StringValueConverter| Modifier and Type | Method and Description |
|---|---|
<TARGET> TARGET |
convertValue(SOURCE value,
Object valueSource,
Class<TARGET> targetClass)
This method converts the given
value to the given type. |
<TARGET> TARGET |
convertValue(SOURCE value,
Object valueSource,
Class<TARGET> targetClass,
TARGET defaultValue)
This method converts the given
value to the given type. |
<TARGET> TARGET |
convertValue(SOURCE value,
Object valueSource,
Class<TARGET> targetClass,
Type targetType)
This method converts the given
value to the given type. |
<TARGET> TARGET |
convertValue(SOURCE value,
Object valueSource,
Class<TARGET> targetClass,
Type targetType,
TARGET defaultValue)
This method converts the given
value to the given type. |
<TARGET extends Number> |
convertValue(SOURCE value,
Object valueSource,
TARGET minimum,
TARGET maximum)
This method converts the given
value to a numeric type and also validates that it is in the
given range from minimum to maximum. |
<TARGET extends Number> |
convertValue(SOURCE value,
Object valueSource,
TARGET minimum,
TARGET maximum,
TARGET defaultValue)
This method gets a numeric value and also validates that it is in the given range from
minimum to maximum. |
<TARGET> TARGET convertValue(SOURCE value, Object valueSource, Class<TARGET> targetClass) throws ValueNotSetException, WrongValueTypeException
value to the given type.TARGET - is the type to convert to.value - is the value to convert. It may be null.valueSource - describes the source of the value. This may be the filename where the value was read
from, an XPath where the value was located in an XML document, etc. It is used in exceptions
thrown if something goes wrong. This will help to find the problem easier.targetClass - is the type the value should be converted to.value converted to type.ValueNotSetException - if the given value is null.WrongValueTypeException - if the given value is NOT null but can NOT be
converted to the given type (e.g. if value is "12x" and
type is Integer.class).<TARGET> TARGET convertValue(SOURCE value, Object valueSource, Class<TARGET> targetClass, Type targetType) throws ValueNotSetException, WrongValueTypeException
value to the given type.TARGET - is the type to convert to.value - is the value to convert. It may be null.valueSource - describes the source of the value. This may be the filename where the value was read
from, an XPath where the value was located in an XML document, etc. It is used in exceptions
thrown if something goes wrong. This will help to find the problem easier.targetClass - is the type the value should be converted to. It is the raw-type of the
given targetType.targetType - is the type to convert the value to. It is potentially generic and
therefore contains more detailed information than targetClass. E.g. the
targetClass may be java.util.List while this targetType
could be java.util.List<Long>. This could help e.g. if the value
is a string like "2, 47, 4252525". The caller may supply the targetClass
again here.value converted to type.ValueNotSetException - if the given value is null.WrongValueTypeException - if the given value is NOT null but can NOT be
converted to the given type (e.g. if value is "12x" and
type is Integer.class).<TARGET> TARGET convertValue(SOURCE value, Object valueSource, Class<TARGET> targetClass, TARGET defaultValue) throws WrongValueTypeException
value to the given type.TARGET - is the type to convert to.value - is the value to convert. It may be null.valueSource - describes the source of the value. This may be the filename where the value was read
from, an XPath where the value was located in an XML document, etc. It is used in exceptions
thrown if something goes wrong. This will help to find the problem easier.targetClass - is the type the value should be converted to.defaultValue - is returned if the given value is null. It may also be
null.value converted to type or the defaultValue if
value was null. It will only return null if both
value and defaultValue are null.WrongValueTypeException - if the given value is NOT null but can NOT be
converted to the given type (e.g. if value is "12x" and
type is Integer.class).<TARGET> TARGET convertValue(SOURCE value, Object valueSource, Class<TARGET> targetClass, Type targetType, TARGET defaultValue) throws WrongValueTypeException
value to the given type.TARGET - is the type to convert to.value - is the value to convert. It may be null.valueSource - describes the source of the value. This may be the filename where the value was read
from, an XPath where the value was located in an XML document, etc. It is used in exceptions
thrown if something goes wrong. This will help to find the problem easier.targetClass - is the type the value should be converted to. It is the raw-type of the
given targetType.targetType - is the type to convert the value to. It is potentially generic and
therefore contains more detailed information than targetClass. E.g. the
targetClass may be java.util.List while this targetType
could be java.util.List<Long>. This could help e.g. if the value
is a string like "2, 47, 4252525". The caller may supply the targetClass
again here.defaultValue - is returned if the given value is null. It may also be
null.value converted to type or the defaultValue if
value was null. It will only return null if both
value and defaultValue are null.WrongValueTypeException - if the given value is NOT null but can NOT be
converted to the given type (e.g. if value is "12x" and
type is Integer.class).<TARGET extends Number> TARGET convertValue(SOURCE value, Object valueSource, TARGET minimum, TARGET maximum) throws ValueNotSetException, WrongValueTypeException, ValueOutOfRangeException
value to a numeric type and also validates that it is in the
given range from minimum to maximum.TARGET - is the numeric-type to convert to.value - is the value to convert. It may be null.valueSource - describes the source of the value. This may be the filename where the value was read
from, an XPath where the value was located in an XML document, etc. It is used in exceptions
thrown if something goes wrong. This will help to find the problem easier.minimum - is the minimum number allowed. Use MIN_VALUE (e.g. Double.MIN_VALUE) if unbound.maximum - is the maximum number allowed. Use MAX_VALUE (e.g. Long.MAX_VALUE) if unbound.minimum and maximum.ValueNotSetException - if the given value is null.WrongValueTypeException - if the value is NO number.ValueOutOfRangeException - if the value is NOT in the given range from minimum to
maximum.<TARGET extends Number> TARGET convertValue(SOURCE value, Object valueSource, TARGET minimum, TARGET maximum, TARGET defaultValue) throws WrongValueTypeException, ValueOutOfRangeException
minimum to maximum.TARGET - is the numeric-type to convert to.value - is the value to convert. It may be null.valueSource - describes the source of the value. This may be the filename where the value was read
from, an XPath where the value was located in an XML document, etc. It is used in exceptions
thrown if something goes wrong. This will help to find the problem easier.minimum - is the minimum number allowed. Use MIN_VALUE (e.g. Double.MIN_VALUE) if unbound.maximum - is the maximum number allowed. Use MAX_VALUE (e.g. Long.MAX_VALUE) if unbound.defaultValue - is the default returned if value is null. It may be
null. Else it must be in the given range from minimum to
maximum.value converted to <TARGET> in the range from
minimum to maximum or the defaultValue if
value is null. Will only be null if both
value and defaultValue are null.WrongValueTypeException - if the value is NO number.ValueOutOfRangeException - if the value is NOT in the given range from minimum to
maximum.Copyright © 2001–2015 mmm-Team. All rights reserved.