本文整理汇总了Java中com.sun.mirror.util.Types类的典型用法代码示例。如果您正苦于以下问题:Java Types类的具体用法?Java Types怎么用?Java Types使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Types类属于com.sun.mirror.util包,在下文中一共展示了Types类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processDeclaredType
import com.sun.mirror.util.Types; //导入依赖的package包/类
private TypeMirror processDeclaredType(DeclaredType type, Types apTypes) {
if (TypeModeler.isSubtype(type.getDeclaration(), collectionDecl) ||
TypeModeler.isSubtype(type.getDeclaration(), mapDecl)) {
Collection<TypeMirror> args = type.getActualTypeArguments();
TypeMirror[] safeArgs = new TypeMirror[args.size()];
int i = 0;
for (TypeMirror arg : args) {
safeArgs[i++]= apply(arg, apTypes);
}
return apTypes.getDeclaredType(type.getDeclaration(), safeArgs);
}
return apTypes.getErasure(type);
}
示例2: erasure
import com.sun.mirror.util.Types; //导入依赖的package包/类
public <T> TypeMirror erasure(TypeMirror t) {
Types tu = env.getTypeUtils();
t = tu.getErasure(t);
if(t instanceof DeclaredType) {
DeclaredType dt = (DeclaredType)t;
if(!dt.getActualTypeArguments().isEmpty())
return tu.getDeclaredType(dt.getDeclaration());
}
return t;
}
示例3: onArrayType
import com.sun.mirror.util.Types; //导入依赖的package包/类
protected TypeMirror onArrayType(ArrayType type, Types apTypes) {
return apTypes.getErasure(type);
}
示例4: onPrimitiveType
import com.sun.mirror.util.Types; //导入依赖的package包/类
protected TypeMirror onPrimitiveType(PrimitiveType type, Types apTypes) {
return apTypes.getErasure(type);
}
示例5: onClassType
import com.sun.mirror.util.Types; //导入依赖的package包/类
protected TypeMirror onClassType(ClassType type, Types apTypes) {
return processDeclaredType(type, apTypes);
}
示例6: onInterfaceType
import com.sun.mirror.util.Types; //导入依赖的package包/类
protected TypeMirror onInterfaceType(InterfaceType type, Types apTypes) {
return processDeclaredType(type, apTypes);
}
示例7: onTypeVariable
import com.sun.mirror.util.Types; //导入依赖的package包/类
protected TypeMirror onTypeVariable(TypeVariable type, Types apTypes) {
return apTypes.getErasure(type);
}
示例8: onVoidType
import com.sun.mirror.util.Types; //导入依赖的package包/类
protected TypeMirror onVoidType(VoidType type, Types apTypes) {
return type;
}
示例9: onWildcard
import com.sun.mirror.util.Types; //导入依赖的package包/类
protected TypeMirror onWildcard(WildcardType type, Types apTypes) {
return apTypes.getErasure(type);
}
示例10: isSubtype
import com.sun.mirror.util.Types; //导入依赖的package包/类
public static boolean isSubtype(AnnotationProcessorEnvironment env, TypeDeclaration d1, TypeDeclaration d2) {
Types typeUtils = env.getTypeUtils();
return typeUtils.isSubtype(typeUtils.getDeclaredType(d1),typeUtils.getDeclaredType(d2));
}