All Downloads are FREE. Search and download functionalities are using the official Maven repository.

JavaSpring.converter.mustache Maven / Gradle / Ivy

There is a newer version: 7.9.0
Show newest version
package {{configPackage}};

{{#models}}
    {{#model}}
        {{#isEnum}}
import {{modelPackage}}.{{classname}};
        {{/isEnum}}
    {{/model}}
{{/models}}

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.convert.converter.Converter;

@Configuration
public class EnumConverterConfiguration {

{{#models}}
{{#model}}
{{#isEnum}}
    @Bean(name = "{{configPackage}}.EnumConverterConfiguration.{{classVarName}}Converter")
    Converter<{{{dataType}}}, {{classname}}> {{classVarName}}Converter() {
        return new Converter<{{{dataType}}}, {{classname}}>() {
            @Override
            public {{classname}} convert({{{dataType}}} source) {
                return {{classname}}.fromValue(source);
            }
        };
    }
{{/isEnum}}
{{/model}}
{{/models}}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy