ma.glasnost.orika
Interface Converter<S,D>

Type Parameters:
S -
D -
All Superinterfaces:
MappedTypePair<S,D>
All Known Implementing Classes:
BidirectionalConverter, CloneableConverter, ConstructorConverter, Converter.LegacyConverter, CopyByReferenceConverter, CustomConverter, DateAndTimeConverters.CalendarToSqlDateConverter, DateAndTimeConverters.CalendarToTimeConverter, DateAndTimeConverters.CalendarToXmlGregorianCalendarConverter, DateAndTimeConverters.DateToCalendarConverter, DateAndTimeConverters.DateToSqlDateConverter, DateAndTimeConverters.DateToTimeConverter, DateAndTimeConverters.DateToTimestampConverter, DateAndTimeConverters.DateToXmlGregorianCalendarConverter, DateAndTimeConverters.LongToCalendarConverter, DateAndTimeConverters.LongToDateConverter, DateAndTimeConverters.LongToSqlDateConverter, DateAndTimeConverters.LongToTimeConverter, DateAndTimeConverters.LongToXmlGregorianCalendarConverter, DateAndTimeConverters.SqlDateToDateConverter, DateAndTimeConverters.TimeToDateConverter, DateAndTimeConverters.XmlGregorianCalendarToSqlDateConverter, DateAndTimeConverters.XmlGregorianCalendarToTimeConverter, DateAndTimeConverters.XmlGregorianCalendarToTimestampConverter, DateToStringConverter, EnumConverter, FromStringConverter, NumericConverters.BigDecimalToDoubleConverter, NumericConverters.BigDecimalToFloatConverter, NumericConverters.BigIntegerToIntegerConverter, NumericConverters.BigIntegerToLongConverter, NumericConverters.DoubleToIntegerConverter, NumericConverters.DoubleToLongConverter, NumericConverters.DoubleToShortConverter, NumericConverters.FloatToIntegerConverter, NumericConverters.FloatToLongConverter, NumericConverters.FloatToShortConverter, NumericConverters.IntegerToShortConverter, NumericConverters.LongToIntegerConverter, NumericConverters.LongToShortConverter, PassThroughConverter, StringToCharacterConverter, ToStringConverter, WrapperToPrimitiveConverter

public interface Converter<S,D>
extends MappedTypePair<S,D>

Converter is used to provide direct conversion from one type to another, useful for those scenarios where complete control over the mapping is desired.

Note that an instance of the current MapperFacade is provided in the convert method for cases where you only want to control a specific portion of the mapping, but wish to delegate some or all of the mapping of the nested types.

See also CustomConverter for a base class which can be extended to create your own custom converter instance.


Method Summary
 boolean canConvert(Type<?> sourceType, Type<?> destinationType)
          Answers whether this converter can be used to handle the conversion of sourceType to destinationType.
 D convert(S source, Type<? extends D> destinationType)
          Perform the conversion of source into a new instance of destinationType.
 void setMapperFacade(MapperFacade mapper)
          Store an instance of the current MapperFacade which may be used in mapping of nested types.
 
Methods inherited from interface ma.glasnost.orika.MappedTypePair
getAType, getBType
 

Method Detail

canConvert

boolean canConvert(Type<?> sourceType,
                   Type<?> destinationType)
Answers whether this converter can be used to handle the conversion of sourceType to destinationType.

Parameters:
sourceType -
destinationType -
Returns:

convert

D convert(S source,
          Type<? extends D> destinationType)
Perform the conversion of source into a new instance of destinationType.

Parameters:
source - the source object to be converted
destinationType - the destination type to produce
Returns:
a new instance of destinationType

setMapperFacade

void setMapperFacade(MapperFacade mapper)
Store an instance of the current MapperFacade which may be used in mapping of nested types.

Parameters:
mapper - the current MapperFacade


Copyright © 2013 Glasnost. All Rights Reserved.