本文整理汇总了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();
}
示例2: BaseDao
import io.dropwizard.util.Generics; //导入依赖的package包/类
public BaseDao(SessionFactory sessionFactory) {
super(sessionFactory);
clazz = Generics.getTypeParameter(this.getClass());
}
示例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));
}
示例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;
}
示例5: CommonJpaDao
import io.dropwizard.util.Generics; //导入依赖的package包/类
public CommonJpaDao(final SessionFactory sessionFactory) {
super(sessionFactory);
entityClass = Generics.getTypeParameter(getClass());
}
示例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));
}
示例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));
}
示例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);
}
示例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));
}