Java 类io.dropwizard.util.Generics 实例源码

项目:dropwizardry    文件:GuiceApplication.java   
@Override
public final void run(T configuration, Environment environment) throws Exception {
    GuiceSupport.Builder<T> guiceBuilder = GuiceSupport.newBuilder();
    configure(configuration, guiceBuilder);
    @SuppressWarnings("unchecked")
    Class<T> configurationClass = (Class<T>) Generics.getTypeParameter(this.getClass());


    //this will initialize any registered bundles
    guiceBuilder.addModule(new GuiceBootstrapModule());

    GuiceSupport<T> guiceBundle = guiceBuilder
            .setConfigClass(configurationClass)
            .build();

    guiceBundle.run(configuration, environment);

    //intialize the injector
    guiceBundle.getInjector();
}
项目:dropwizard-myblog    文件:BaseDao.java   
public BaseDao(SessionFactory sessionFactory) {
    super(sessionFactory);
    clazz = Generics.getTypeParameter(this.getClass());
}
项目:dropwizard-myblog    文件:BaseDao.java   
public List<T> findAll() {
    Class<?> clazz = Generics.getTypeParameter(this.getClass());
    return list(namedQuery(clazz.getName() + FIND_ALL));
}
项目:dropwizard-myblog    文件:BaseDao.java   
public List<T>  findAllByCriteria(Criteria criteria) {
    Class<?> clazz = Generics.getTypeParameter(this.getClass());
    Field[] fields = clazz.getDeclaredFields();
    Arrays.asList(fields).forEach((it) -> System.err.println(it.getName()));
    return null;
}
项目:AugumentedSzczecin_java    文件:CommonJpaDao.java   
public CommonJpaDao(final SessionFactory sessionFactory) {
    super(sessionFactory);
    entityClass = Generics.getTypeParameter(getClass());
}
项目:dropwizard-couchbase    文件:CouchbaseBundle.java   
@Override
public final void initialize(Bootstrap<?> bootstrap) {
    final Class<T> klass = Generics.getTypeParameter(getClass(), Configuration.class);
    bootstrap.addCommand(new CouchbaseTestCommand("cbtest", "Tests the connection to Couchbase.", this, klass));
    bootstrap.addCommand(new CouchbaseInitCommand("cbinit", "Syncs all design documents with Couchbase.", this, klass));
}
项目:dropwizard-flyway    文件:FlywayBundle.java   
@Override
public final void initialize(final Bootstrap<?> bootstrap) {
    final Class<T> klass = Generics.getTypeParameter(getClass(), Configuration.class);
    bootstrap.addCommand(new DbCommand<T>(name(), this, this, klass));
}
项目:tenacity    文件:ExceptionLogger.java   
/**
 * Specify the class that this exception logger can handle
 */
protected ExceptionLogger() {
    this.clazz = Generics.getTypeParameter(this.getClass(), Exception.class);
}
项目:dropwizard-routing    文件:RoutingMigrationsBundle.java   
@Override
public final void initialize(Bootstrap<?> bootstrap) {
    final Class<T> klass = Generics.getTypeParameter(getClass(), Configuration.class);
    bootstrap.addCommand(new RoutingDbCommand<>(this, klass));
}