Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MapperFacadeImpl - unenhancer when usage #12

Closed
GoogleCodeExporter opened this issue Apr 14, 2015 · 2 comments
Closed

MapperFacadeImpl - unenhancer when usage #12

GoogleCodeExporter opened this issue Apr 14, 2015 · 2 comments

Comments

@GoogleCodeExporter
Copy link

In the MapperFacadeImpl#convert method unenhancer is always called, but the 
unenhanced class is only used when no converterId was specified. This could be 
easily fixed by moving the call into the 'if' body.

    public <S, D> D convert(S source, Type<S> sourceType, Type<D> destinationType, String converterId) {
        Converter<S, D> converter;
        ConverterFactory converterFactory = mapperFactory.getConverterFactory();
        if (converterId == null) {
        final Type<? extends Object> sourceClass = unenhanceStrategy.unenhanceType(source, sourceType);
            converter = (Converter<S, D>) converterFactory.getConverter(sourceClass, destinationType);
        } else {
            converter = (Converter<S, D>) converterFactory.getConverter(converterId);
        }

        return converter.convert(source, destinationType);
    }

This gives a small performance improvement when using named converters.

Original issue reported on code.google.com by lighteater on 17 Apr 2012 at 12:15

@GoogleCodeExporter
Copy link
Author

Great! 
We're thinking also about moving converter resolution to "generate time" so in 
runtime (mapping) we can have a simple O(1) complexity

Thank you if you have any suggestions please do not hesitate :)

Original comment by elaat...@gmail.com on 20 Apr 2012 at 2:58

  • Changed state: Accepted

@GoogleCodeExporter
Copy link
Author

Converter has been moved to "generate time" in the 1.2.0 branch; 
this suggested change is applied in that branch as well.

Original comment by matt.deb...@gmail.com on 4 Aug 2012 at 4:53

  • Changed state: Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant