- Type Parameters:
T- the target Java type this converter handles
- All Superinterfaces:
ConverterFunction<T>
- All Known Subinterfaces:
SqlConverter<T>
- All Known Implementing Classes:
AbstractNumberConverter,AbstractStringParsingConverter,BigDecimalConverter,BigIntegerConverter,BooleanConverter,ByteArrayConverter,ByteConverter,CharacterConverter,DateConverter,DoubleConverter,FloatConverter,GenericConverter,GenericSqlConverter,IntegerConverter,LocalDateConverter,LocalDateTimeConverter,LongConverter,OffsetDateTimeConverter,ShortConverter,SqlDateConverter,SqlTimeConverter,SqlTimestampConverter,StringConverter,ZonedDateTimeConverter
Represents a converter for a specific Java type.
A Converter is responsible for translating an arbitrary object to the target type T.
It also provides information about the target type it handles.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intDefault converter priority (10). -
Method Summary
Methods inherited from interface org.litebridge.convert.converter.ConverterFunction
convert
-
Field Details
-
DEFAULT_PRIORITY
static final int DEFAULT_PRIORITYDefault converter priority (10).- See Also:
-
-
Method Details
-
type
Class<?> type()Returns the target Java class this converter handles.- Returns:
- the target Java class
-
primitiveType
Returns the primitive counterpart of the target class, if applicable.- Returns:
- the primitive type, or
nullif there is no primitive counterpart
-
priority
default int priority()Returns the priority of this converter.Converters with lower priority values converters are preferred if there are data type overlaps.
As an example, if there are two converters A and B for type
String, if A has a priority of 1 and B has a priority of 2, then A will be chosen to perform the conversion.- Returns:
- the priority of this converter
-