当前位置: 首页>>代码示例>>Java>>正文


Java Generics类代码示例

本文整理汇总了Java中io.dropwizard.util.Generics的典型用法代码示例。如果您正苦于以下问题:Java Generics类的具体用法?Java Generics怎么用?Java Generics使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Generics类属于io.dropwizard.util包,在下文中一共展示了Generics类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: run

import io.dropwizard.util.Generics; //导入依赖的package包/类
@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();
}
 
开发者ID:jclawson,项目名称:dropwizardry,代码行数:21,代码来源:GuiceApplication.java

示例2: BaseDao

import io.dropwizard.util.Generics; //导入依赖的package包/类
public BaseDao(SessionFactory sessionFactory) {
    super(sessionFactory);
    clazz = Generics.getTypeParameter(this.getClass());
}
 
开发者ID:zslucky,项目名称:dropwizard-myblog,代码行数:5,代码来源:BaseDao.java

示例3: findAll

import io.dropwizard.util.Generics; //导入依赖的package包/类
public List<T> findAll() {
    Class<?> clazz = Generics.getTypeParameter(this.getClass());
    return list(namedQuery(clazz.getName() + FIND_ALL));
}
 
开发者ID:zslucky,项目名称:dropwizard-myblog,代码行数:5,代码来源:BaseDao.java

示例4: findAllByCriteria

import io.dropwizard.util.Generics; //导入依赖的package包/类
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;
}
 
开发者ID:zslucky,项目名称:dropwizard-myblog,代码行数:7,代码来源:BaseDao.java

示例5: CommonJpaDao

import io.dropwizard.util.Generics; //导入依赖的package包/类
public CommonJpaDao(final SessionFactory sessionFactory) {
    super(sessionFactory);
    entityClass = Generics.getTypeParameter(getClass());
}
 
开发者ID:blstream,项目名称:AugumentedSzczecin_java,代码行数:5,代码来源:CommonJpaDao.java

示例6: initialize

import io.dropwizard.util.Generics; //导入依赖的package包/类
@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));
}
 
开发者ID:smartmachine,项目名称:dropwizard-couchbase,代码行数:7,代码来源:CouchbaseBundle.java

示例7: initialize

import io.dropwizard.util.Generics; //导入依赖的package包/类
@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));
}
 
开发者ID:dropwizard,项目名称:dropwizard-flyway,代码行数:6,代码来源:FlywayBundle.java

示例8: ExceptionLogger

import io.dropwizard.util.Generics; //导入依赖的package包/类
/**
 * Specify the class that this exception logger can handle
 */
protected ExceptionLogger() {
    this.clazz = Generics.getTypeParameter(this.getClass(), Exception.class);
}
 
开发者ID:yammer,项目名称:tenacity,代码行数:7,代码来源:ExceptionLogger.java

示例9: initialize

import io.dropwizard.util.Generics; //导入依赖的package包/类
@Override
public final void initialize(Bootstrap<?> bootstrap) {
    final Class<T> klass = Generics.getTypeParameter(getClass(), Configuration.class);
    bootstrap.addCommand(new RoutingDbCommand<>(this, klass));
}
 
开发者ID:Astonish-Results,项目名称:dropwizard-routing,代码行数:6,代码来源:RoutingMigrationsBundle.java


注:本文中的io.dropwizard.util.Generics类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。