public Mapper getMapper ( Field field ) { PropertyMapper propertyMapperAnnotation = field . getAnnotation ( PropertyMapper . class ) ; if ( propertyMapperAnnotation != null ) { return createCustomMapper ( field , propertyMapperAnnotation ) ; } Class < ? > fieldType = field . getType ( ) ; if ( fieldType . equals ( BigDecimal . class ) ) { Decimal decimalAnnotation = field . getAnnotation ( Decimal . class ) ; if ( decimalAnnotation != null ) { return new DecimalMapper ( decimalAnnotation . precision ( ) , decimalAnnotation . scale ( ) ) ; } } if ( List . class . isAssignableFrom ( fieldType ) || Set . class . isAssignableFrom ( fieldType ) ) { return CollectionMapperFactory . getInstance ( ) . getMapper ( field ) ; } return getMapper ( field . getGenericType ( ) ) ; }
Returns the mapper for the given field . If the field has a custom mapper a new instance of the specified mapper will be created and returned . Otherwise one of the built - in mappers will be returned based on the field type .