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

com.digitolio.jdbi.TranslationAwareBeanMapperFactory Maven / Gradle / Ivy

There is a newer version: 0.6.8.2
Show newest version
package com.digitolio.jdbi;

import com.digitolio.jdbi.strategy.TranslatingStrategyAware;
import org.skife.jdbi.v2.ResultSetMapperFactory;
import org.skife.jdbi.v2.StatementContext;
import org.skife.jdbi.v2.tweak.ResultSetMapper;

public class TranslationAwareBeanMapperFactory implements ResultSetMapperFactory {

    private TranslatingStrategyAware translater;

    public TranslationAwareBeanMapperFactory() {}

    @Override
    public boolean accepts(Class type, StatementContext ctx) {
        return true;
    }

    @SuppressWarnings("unchecked")
    @Override
    public ResultSetMapper mapperFor(Class type, StatementContext ctx) {
        translater = (TranslatingStrategyAware) ctx.getAttribute(StrategyAwareDBI.TRANSLATING_STRATEGY);
        return new TranslationAwareMapper(type, translater);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy