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


Java ParameterizedTypeImpl类代码示例

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


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

示例1: bindListThriftCodec

import com.google.inject.internal.MoreTypes.ParameterizedTypeImpl; //导入依赖的package包/类
public void bindListThriftCodec(Class<?> type)
{
    requireNonNull(type, "type is null");

    ParameterizedTypeImpl listType = new ParameterizedTypeImpl(null, List.class, type);
    binder.bind(getThriftCodecKey(listType)).toProvider(new ThriftCodecProvider(listType)).in(Scopes.SINGLETON);
}
 
开发者ID:airlift,项目名称:drift,代码行数:8,代码来源:ThriftCodecBinder.java

示例2: bindMapThriftCodec

import com.google.inject.internal.MoreTypes.ParameterizedTypeImpl; //导入依赖的package包/类
public void bindMapThriftCodec(Class<?> keyType, Class<?> valueType)
{
    requireNonNull(keyType, "keyType is null");
    requireNonNull(valueType, "valueType is null");

    ParameterizedTypeImpl mapType = new ParameterizedTypeImpl(null, Map.class, keyType, valueType);
    binder.bind(getThriftCodecKey(mapType)).toProvider(new ThriftCodecProvider(mapType)).in(Scopes.SINGLETON);
}
 
开发者ID:airlift,项目名称:drift,代码行数:9,代码来源:ThriftCodecBinder.java

示例3: getThriftCodecKey

import com.google.inject.internal.MoreTypes.ParameterizedTypeImpl; //导入依赖的package包/类
private Key<ThriftCodec<?>> getThriftCodecKey(Type type)
{
    return (Key<ThriftCodec<?>>) Key.get(new ParameterizedTypeImpl(null, ThriftCodec.class, type));
}
 
开发者ID:airlift,项目名称:drift,代码行数:5,代码来源:ThriftCodecBinder.java

示例4: getValue

import com.google.inject.internal.MoreTypes.ParameterizedTypeImpl; //导入依赖的package包/类
@Override
public Object getValue(HttpContext ctx) {
    HttpRequestContext request = ctx.getRequest();

    Object deserialized = null;

    if (HttpMethod.POST.equals(request.getMethod()) || HttpMethod.PUT.equals(request.getMethod())) {
        if (type instanceof Class && Model.class.isAssignableFrom((Class<?>) type)) {
            App app = App.get();

            // We cannot actually use this instance with jersey, but at
            // least we know
            // which implementation is to be used for the given interface.
            deserialized = (Model) app.inject((Class<?>) type);

            if (deserialized != null) {
                // Let jersey instantiate and populate the model object
                // using
                // the implementation object we located via guice.
                deserialized = request.getEntity(deserialized.getClass());

                // Because jersey creates a new instance, instead of using
                // the one
                // created by guice, we inject the members manually
                // afterwards.
                if (deserialized != null)
                    app.injectMembers(deserialized);
            }
        } else if (type instanceof ParameterizedType) {
            List<Class<?>> genTypes = Reflect.getGenericType(type);

            Class<?> genType = genTypes != null && genTypes.size() > 0 ? genTypes.get(0) : null;

            if (genType != null && Model.class.isAssignableFrom(genType)) {
                Model m = (Model) App.get().inject((Class<?>) genType);

                // We need to create the generic type manually.
                ParameterizedTypeImpl genericType = new ParameterizedTypeImpl(null, List.class,
                    new Type[] { m.getClass() });

                deserialized = request.getEntity(List.class, genericType, List.class.getAnnotations());
            }
        }
    }

    return deserialized;
}
 
开发者ID:geetools,项目名称:geeCommerce-Java-Shop-Software-and-PIM,代码行数:48,代码来源:ModelInjectableProvider.java

示例5: newParameterizedTypeWithOwner

import com.google.inject.internal.MoreTypes.ParameterizedTypeImpl; //导入依赖的package包/类
/**
 * Returns a new parameterized type, applying {@code typeArguments} to
 * {@code rawType} and enclosed by {@code ownerType}.
 *
 * @return a {@link java.io.Serializable serializable} parameterized type.
 */
public static ParameterizedType newParameterizedTypeWithOwner(
        Type ownerType, Type rawType, Type... typeArguments) {
    return new ParameterizedTypeImpl(ownerType, rawType, typeArguments);
}
 
开发者ID:ruediste,项目名称:salta,代码行数:11,代码来源:Types.java

示例6: newParameterizedTypeWithOwner

import com.google.inject.internal.MoreTypes.ParameterizedTypeImpl; //导入依赖的package包/类
/**
 * Returns a new parameterized type, applying {@code typeArguments} to {@code rawType} and
 * enclosed by {@code ownerType}.
 *
 * @return a {@link java.io.Serializable serializable} parameterized type.
 */
public static ParameterizedType newParameterizedTypeWithOwner(
    Type ownerType, Type rawType, Type... typeArguments) {
  return new ParameterizedTypeImpl(ownerType, rawType, typeArguments);
}
 
开发者ID:google,项目名称:guice,代码行数:11,代码来源:Types.java

示例7: newParameterizedTypeWithOwner

import com.google.inject.internal.MoreTypes.ParameterizedTypeImpl; //导入依赖的package包/类
/**
 * Returns a new parameterized type, applying {@code typeArguments} to
 * {@code rawType} and enclosed by {@code ownerType}.
 *
 * @return a {@link java.io.Serializable serializable} parameterized type.
 */
public static ParameterizedType newParameterizedTypeWithOwner(
    Type ownerType, Type rawType, Type... typeArguments) {
  return new ParameterizedTypeImpl(ownerType, rawType, typeArguments);
}
 
开发者ID:cgruber,项目名称:guice-old,代码行数:11,代码来源:Types.java


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