本文整理汇总了Java中com.google.inject.internal.MoreTypes.getRawType方法的典型用法代码示例。如果您正苦于以下问题:Java MoreTypes.getRawType方法的具体用法?Java MoreTypes.getRawType怎么用?Java MoreTypes.getRawType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.inject.internal.MoreTypes
的用法示例。
在下文中一共展示了MoreTypes.getRawType方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: justInTimeResolution
import com.google.inject.internal.MoreTypes; //导入方法依赖的package包/类
@Override
public boolean justInTimeResolution(Injectee injectee) {
Type type = injectee.getRequiredType();
Class<?> clazz = MoreTypes.getRawType(type);
if (clazz != null) {
Binding<?> binding = findBinding(injectee);
if (binding != null) {
Key<?> key = binding.getKey();
Set<Annotation> qualifiers = BindingUtils.getQualifiers(key);
GuiceBindingDescriptor<?> descriptor = new GuiceBindingDescriptor<>(
type, clazz, qualifiers, binding);
ServiceLocatorUtilities.addOneDescriptor(locator, descriptor);
return true;
}
}
return false;
}
示例2: TypeLiteral
import com.google.inject.internal.MoreTypes; //导入方法依赖的package包/类
/**
* Constructs a new type literal. Derives represented class from type parameter.
*
* <p>Clients create an empty anonymous subclass. Doing so embeds the type parameter in the
* anonymous class's type hierarchy so we can reconstitute it at runtime despite erasure.
*/
@SuppressWarnings("unchecked")
protected TypeLiteral() {
this.type = getSuperclassTypeParameter(getClass());
this.rawType = (Class<? super T>) MoreTypes.getRawType(type);
this.hashCode = type.hashCode();
}
示例3: TypeLiteral
import com.google.inject.internal.MoreTypes; //导入方法依赖的package包/类
/**
* Unsafe. Constructs a type literal manually.
*/
@SuppressWarnings("unchecked")
TypeLiteral(Type type) {
this.type = canonicalize(checkNotNull(type, "type"));
this.rawType = (Class<? super T>) MoreTypes.getRawType(this.type);
this.hashCode = this.type.hashCode();
}
示例4: componentType
import com.google.inject.internal.MoreTypes; //导入方法依赖的package包/类
private Type componentType(final Type type) {
Class<?> rawType = MoreTypes.getRawType(type);
if (rawType.isArray()) {
return rawType.getComponentType();
}
if (Collection.class.isAssignableFrom(rawType) && type instanceof ParameterizedType) {
return ((ParameterizedType) type).getActualTypeArguments()[0];
}
return type;
}
示例5: simplifyType
import com.google.inject.internal.MoreTypes; //导入方法依赖的package包/类
static java.lang.reflect.Type simplifyType(final java.lang.reflect.Type type) {
Class<?> rawType = MoreTypes.getRawType(type);
if (Primitives.isWrapperType(rawType)) {
return Primitives.unwrap(rawType);
}
return type;
}
示例6: optional
import com.google.inject.internal.MoreTypes; //导入方法依赖的package包/类
/**
* True if parameter is optional. A parameter is optional when there is a default value or
* {@link #type()} is {@link Optional}.
*
* @return True if parameter is optional. A parameter is optional when there is a default value or
* {@link #type()} is {@link Optional}.
*/
public boolean optional() {
return value != null || MoreTypes.getRawType(type) == Optional.class;
}