Package org.apache.ofbiz.base.conversion
Interface Converter<S,T>
-
- Type Parameters:
S
- The source object typeT
- The target object type
- All Known Subinterfaces:
LocalizedConverter<S,T>
- All Known Implementing Classes:
AbstractConverter
,AbstractLocalizedConverter
,BooleanConverters.BooleanToInteger
,BooleanConverters.BooleanToList
,BooleanConverters.BooleanToSet
,BooleanConverters.BooleanToString
,BooleanConverters.IntegerToBoolean
,BooleanConverters.StringToBoolean
,CollectionConverters.ArrayToList
,CollectionConverters.ListToString
,CollectionConverters.MapToList
,CollectionConverters.MapToSet
,CollectionConverters.MapToString
,CollectionConverters.StringToList
,CollectionConverters.StringToMap
,CollectionConverters.StringToSet
,Converters.GenericValueToJSON
,Converters.GenericValueToList
,Converters.GenericValueToSet
,Converters.GenericValueToString
,Converters.JSONToGenericValue
,Converters.NullFieldToObject
,Converters.ObjectToNullField
,Converters.PassThruConverter
,DateTimeConverters.CalendarToDate
,DateTimeConverters.CalendarToLong
,DateTimeConverters.CalendarToString
,DateTimeConverters.CalendarToTimestamp
,DateTimeConverters.DateToCalendar
,DateTimeConverters.DateToLong
,DateTimeConverters.DateToSqlDate
,DateTimeConverters.DateToSqlTime
,DateTimeConverters.DateToString
,DateTimeConverters.DateToTimestamp
,DateTimeConverters.DurationToBigDecimal
,DateTimeConverters.DurationToDouble
,DateTimeConverters.DurationToFloat
,DateTimeConverters.DurationToList
,DateTimeConverters.DurationToLong
,DateTimeConverters.DurationToSet
,DateTimeConverters.DurationToString
,DateTimeConverters.GenericLocalizedConverter
,DateTimeConverters.LongToCalendar
,DateTimeConverters.NumberToDate
,DateTimeConverters.NumberToDuration
,DateTimeConverters.NumberToSqlDate
,DateTimeConverters.NumberToSqlTime
,DateTimeConverters.NumberToTimestamp
,DateTimeConverters.SqlDateToDate
,DateTimeConverters.SqlDateToList
,DateTimeConverters.SqlDateToSet
,DateTimeConverters.SqlDateToString
,DateTimeConverters.SqlDateToTime
,DateTimeConverters.SqlDateToTimestamp
,DateTimeConverters.SqlTimeToList
,DateTimeConverters.SqlTimeToSet
,DateTimeConverters.SqlTimeToSqlDate
,DateTimeConverters.SqlTimeToString
,DateTimeConverters.StringToCalendar
,DateTimeConverters.StringToDate
,DateTimeConverters.StringToDuration
,DateTimeConverters.StringToSqlDate
,DateTimeConverters.StringToSqlTime
,DateTimeConverters.StringToTimestamp
,DateTimeConverters.StringToTimeZone
,DateTimeConverters.TimestampToDate
,DateTimeConverters.TimestampToList
,DateTimeConverters.TimestampToSet
,DateTimeConverters.TimestampToSqlDate
,DateTimeConverters.TimestampToSqlTime
,DateTimeConverters.TimestampToString
,DateTimeConverters.TimeZoneToString
,FlexibleStringExpanderTests.SpecialNumberToString
,GenericSingletonToList
,GenericSingletonToSet
,JSONConverters.JSONToList
,JSONConverters.JSONToMap
,JSONConverters.ListToJSON
,JSONConverters.MapToJSON
,MiscConverters.BlobToBlob
,MiscConverters.BlobToByteArray
,MiscConverters.ByteArrayToBlob
,MiscConverters.ByteArrayToByteBuffer
,MiscConverters.ByteBufferToByteArray
,MiscConverters.CharsetToString
,MiscConverters.ClobToString
,MiscConverters.DecimalFormatToString
,MiscConverters.EnumToString
,MiscConverters.LocaleToString
,MiscConverters.RegexPatternToString
,MiscConverters.SimpleDateFormatToString
,MiscConverters.StringToCharset
,MiscConverters.StringToClob
,MiscConverters.StringToDecimalFormat
,MiscConverters.StringToLocale
,MiscConverters.StringToRegexPattern
,MiscConverters.StringToSimpleDateFormat
,MiscConverters.StringToUUID
,MiscConverters.UUIDToString
,NetConverters.InetAddressToString
,NetConverters.StringToInetAddress
,NetConverters.StringToURI
,NetConverters.StringToURL
,NetConverters.URIToString
,NetConverters.URIToURL
,NetConverters.URLToString
,NetConverters.URLToURI
,NumberConverters.AbstractNumberConverter
,NumberConverters.AbstractNumberToStringConverter
,NumberConverters.AbstractStringToNumberConverter
,NumberConverters.BigDecimalToString
,NumberConverters.BigIntegerToString
,NumberConverters.ByteToString
,NumberConverters.DoubleToBigDecimal
,NumberConverters.DoubleToString
,NumberConverters.FloatToBigDecimal
,NumberConverters.FloatToString
,NumberConverters.GenericNumberToDouble
,NumberConverters.GenericNumberToFloat
,NumberConverters.GenericNumberToInteger
,NumberConverters.GenericNumberToLong
,NumberConverters.GenericNumberToShort
,NumberConverters.IntegerToBigDecimal
,NumberConverters.IntegerToByte
,NumberConverters.IntegerToString
,NumberConverters.LongToBigDecimal
,NumberConverters.LongToByte
,NumberConverters.LongToString
,NumberConverters.ShortToString
,NumberConverters.StringToBigDecimal
,NumberConverters.StringToBigInteger
,NumberConverters.StringToByte
,NumberConverters.StringToDouble
,NumberConverters.StringToFloat
,NumberConverters.StringToInteger
,NumberConverters.StringToLong
,NumberConverters.StringToShort
public interface Converter<S,T>
Converter interface. Classes implement this interface to convert one Java object type to another.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
canConvert(java.lang.Class<?> sourceClass, java.lang.Class<?> targetClass)
Returnstrue
if this object can convertsourceClass
totargetClass
.T
convert(java.lang.Class<? extends T> targetClass, S obj)
Convertsobj
toT
.T
convert(S obj)
Convertsobj
toT
.java.lang.Class<?>
getSourceClass()
Returns the sourceClass
for this converter.java.lang.Class<?>
getTargetClass()
Returns the targetClass
for this converter.
-
-
-
Method Detail
-
canConvert
boolean canConvert(java.lang.Class<?> sourceClass, java.lang.Class<?> targetClass)
Returnstrue
if this object can convertsourceClass
totargetClass
.Implementations can accomodate class hierarchy ranges by converting super classes or interfaces.
- Parameters:
sourceClass
- The sourceClass
targetClass
- The targetClass
- Returns:
true
if this object can convertsourceClass
totargetClass
.
-
convert
T convert(S obj) throws ConversionException
Convertsobj
toT
.- Parameters:
obj
- The sourceObject
to convert- Returns:
- The converted
Object
- Throws:
ConversionException
-
convert
T convert(java.lang.Class<? extends T> targetClass, S obj) throws ConversionException
Convertsobj
toT
.- Parameters:
targetClass
- TheClass
to convert toobj
- The sourceObject
to convert- Returns:
- The converted
Object
- Throws:
ConversionException
-
getSourceClass
java.lang.Class<?> getSourceClass()
Returns the sourceClass
for this converter.- Returns:
- The source
Class
for this converter
-
getTargetClass
java.lang.Class<?> getTargetClass()
Returns the targetClass
for this converter.- Returns:
- The target
Class
for this converter
-
-