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


Java TypeLiteral.get方法代码示例

本文整理汇总了Java中com.google.inject.TypeLiteral.get方法的典型用法代码示例。如果您正苦于以下问题:Java TypeLiteral.get方法的具体用法?Java TypeLiteral.get怎么用?Java TypeLiteral.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.inject.TypeLiteral的用法示例。


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

示例1: bindNumber

import com.google.inject.TypeLiteral; //导入方法依赖的package包/类
private <T extends Number & Comparable<T>> void bindNumber(Class<T> rawType) {
    final TypeLiteral<T> type = TypeLiteral.get(rawType);
    final TypeArgument<T> typeArg = new TypeArgument<T>(type){};

    final TypeLiteral<NumberParser<T>> parserType = new ResolvableType<NumberParser<T>>(){}.with(typeArg);
    bind(parserType);
    bind(new ResolvableType<TransfiniteParser<T>>(){}.with(typeArg)).to(parserType);
    bind(new ResolvableType<PrimitiveParser<T>>(){}.with(typeArg)).to(parserType);
    bind(new ResolvableType<Parser<T>>(){}.with(typeArg)).to(parserType);

    final TypeLiteral<VectorParser<T>> vectorParserType = new ResolvableType<VectorParser<T>>(){}.with(typeArg);
    bind(vectorParserType);

    install(new PropertyManifest<>(type, new ResolvableType<NumberProperty<T>>(){}.with(typeArg)));

    if(Types.isAssignable(Comparable.class, type)) {
        install(new RangeParserManifest(type));
    }
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:20,代码来源:ParserManifest.java

示例2: driftClientTypeLiteral

import com.google.inject.TypeLiteral; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private static <T> TypeLiteral<DriftClient<T>> driftClientTypeLiteral(Class<T> clientInterface)
{
    Type javaType = new TypeToken<DriftClient<T>>() {}
            .where(new TypeParameter<T>() {}, TypeToken.of(clientInterface))
            .getType();
    return (TypeLiteral<DriftClient<T>>) TypeLiteral.get(javaType);
}
 
开发者ID:airlift,项目名称:drift,代码行数:9,代码来源:DriftClientBinder.java

示例3: forInnerClass

import com.google.inject.TypeLiteral; //导入方法依赖的package包/类
public static <I> InnerFactoryManifest<?, I> forInnerClass(Key<I> key) {
    final Class<?> outer = key.getTypeLiteral().getRawType().getEnclosingClass();
    if(outer == null) {
        throw new IllegalArgumentException(key + " is not an inner class");
    }
    return new InnerFactoryManifest(key, TypeLiteral.get(outer));
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:8,代码来源:InnerFactoryManifest.java

示例4: bindTracker

import com.google.inject.TypeLiteral; //导入方法依赖的package包/类
protected <T> TrackerProvider<T> bindTracker(java.lang.reflect.Type typeParam, Annotation annotatedWith,
	String extensionPoint, String beanParameter)
{
	ParameterizedType type = Types.newParameterizedType(PluginTracker.class, typeParam);
	TrackerProvider<T> trackerProvider = new TrackerProvider<T>(getPluginId(), extensionPoint, beanParameter);
	@SuppressWarnings("unchecked")
	TypeLiteral<PluginTracker<T>> typeLiteral = (TypeLiteral<PluginTracker<T>>) TypeLiteral.get(type);
	LinkedBindingBuilder<PluginTracker<T>> bindingBuilder = bind(typeLiteral);
	if( annotatedWith != null )
	{
		bindingBuilder = ((AnnotatedBindingBuilder<PluginTracker<T>>) bindingBuilder).annotatedWith(annotatedWith);
	}
	bindingBuilder.toProvider(trackerProvider).in(Scopes.SINGLETON);
	return trackerProvider;
}
 
开发者ID:equella,项目名称:Equella,代码行数:16,代码来源:PluginTrackerModule.java

示例5: RootFeatureManifest

import com.google.inject.TypeLiteral; //导入方法依赖的package包/类
public RootFeatureManifest(@Nullable Class<T> type, @Nullable NodeFinder nodeFinder) {
    this(type == null ? null : TypeLiteral.get(type), nodeFinder);
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:4,代码来源:RootFeatureManifest.java

示例6: FeatureBinder

import com.google.inject.TypeLiteral; //导入方法依赖的package包/类
public FeatureBinder(Binder binder, Class<T> type) {
    this(binder, TypeLiteral.get(type));
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:4,代码来源:FeatureBinder.java

示例7: FeatureManifest

import com.google.inject.TypeLiteral; //导入方法依赖的package包/类
public FeatureManifest(@Nullable Class<T> T) {
    this(TypeLiteral.get(T));
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:4,代码来源:FeatureManifest.java

示例8: NumberParser

import com.google.inject.TypeLiteral; //导入方法依赖的package包/类
private NumberParser(Class<T> type) {
    this(TypeLiteral.get(type), NumberFactory.get(type));
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:4,代码来源:NumberParser.java

示例9: EnumParserManifest

import com.google.inject.TypeLiteral; //导入方法依赖的package包/类
public EnumParserManifest(Class<T> type) {
    this(TypeLiteral.get(type));
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:4,代码来源:EnumParserManifest.java

示例10: PropertyManifest

import com.google.inject.TypeLiteral; //导入方法依赖的package包/类
public PropertyManifest(Class<T> type) {
    this(TypeLiteral.get(type));
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:4,代码来源:PropertyManifest.java

示例11: where

import com.google.inject.TypeLiteral; //导入方法依赖的package包/类
public TypeLiteral<T> where(TypeVariable<?> typeVariable, TypeLiteral<?> type) {
    final TypeResolver resolver = new TypeResolver().where(typeVariable, type.getType());
    return (TypeLiteral<T>) TypeLiteral.get(resolver.resolveType(getType()));
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:5,代码来源:ResolvableType.java

示例12: EnumParserManifest

import com.google.inject.TypeLiteral; //导入方法依赖的package包/类
public EnumParserManifest(Class<T> T) {
    this(TypeLiteral.get(T));
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:4,代码来源:EnumParserManifest.java

示例13: parameterizedTypeLiteral

import com.google.inject.TypeLiteral; //导入方法依赖的package包/类
public static TypeLiteral parameterizedTypeLiteral(Type owner, Type... args) {
    return TypeLiteral.get(com.google.inject.util.Types.newParameterizedType(owner, (Type[]) args));
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:4,代码来源:Types.java

示例14: MethodScanner

import com.google.inject.TypeLiteral; //导入方法依赖的package包/类
public MethodScanner(Class<D> decl, Predicate<? super Method> filter) {
    this(TypeLiteral.get(decl), filter);
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:4,代码来源:MethodScanner.java

示例15: providedType

import com.google.inject.TypeLiteral; //导入方法依赖的package包/类
/**
 * Return the type provided by the given {@link Provider}
 */
public static <T> TypeLiteral<T> providedType(TypeLiteral<? extends Provider<T>> providerType) {
    return (TypeLiteral<T>) TypeLiteral.get(((ParameterizedType) providerType.getType()).getActualTypeArguments()[0]);
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:7,代码来源:Injection.java


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