Created
December 7, 2011 14:56
-
-
Save joserodolfofreitas/1443104 to your computer and use it in GitHub Desktop.
Producer that produces a Class with T.class as parameter.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SqlQueryProducer { | |
@Inject | |
BeanManager beanManager; | |
@Produces | |
public <T> SqlQuery<T> producesSqlQuery(@New SqlQueryExecutor sqlQueryExecutor, InjectionPoint ip) { | |
@SuppressWarnings("unchecked") | |
Class<T> clazz = (Class<T>) ClassUtils.getParameterizedTypeFromAnnotated(ip.getAnnotated()); | |
SqlQuery<T> sqlQuery = new SqlQuery<T>(clazz); | |
sqlQuery.setQueryExecutor(sqlQueryExecutor); | |
return sqlQuery; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment