类com.google.inject.spi.TypeConverter源码实例Demo

下面列出了怎么用com.google.inject.spi.TypeConverter的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: dropwizard-guicey   文件: ConstantModule.java
@Override
protected void configure() {
    convertToTypes(new AbstractMatcher<TypeLiteral<?>>() {
        @Override
        public boolean matches(TypeLiteral<?> typeLiteral) {
            return typeLiteral.getType().equals(Sample.class);
        }
    }, new TypeConverter() {
        @Override
        public Object convert(String value, TypeLiteral<?> toType) {
            return new Sample();
        }
    });
    bindConstant().annotatedWith(Names.named("smth")).to(12);
    bindConstant().annotatedWith(Names.named("string")).to("12");
}
 
 类所在包
 类方法
 同包方法