本文整理汇总了Java中edu.umd.cs.findbugs.ba.generic.GenericObjectType.getTypeCategory方法的典型用法代码示例。如果您正苦于以下问题:Java GenericObjectType.getTypeCategory方法的具体用法?Java GenericObjectType.getTypeCategory怎么用?Java GenericObjectType.getTypeCategory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类edu.umd.cs.findbugs.ba.generic.GenericObjectType
的用法示例。
在下文中一共展示了GenericObjectType.getTypeCategory方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: compareTypesOld
import edu.umd.cs.findbugs.ba.generic.GenericObjectType; //导入方法依赖的package包/类
private boolean compareTypesOld(Type parmType, Type argType) {
// XXX equality not implemented for GenericObjectType
// if (parmType.equals(argType)) return true;
// Compare type signatures instead
if (GenericUtilities.getString(parmType).equals(GenericUtilities.getString(argType)))
return true;
if (parmType instanceof GenericObjectType) {
GenericObjectType o = (GenericObjectType) parmType;
if (o.getTypeCategory() == GenericUtilities.TypeCategory.WILDCARD_EXTENDS) {
return compareTypesOld(o.getExtension(), argType);
}
}
// ignore type variables for now
if (parmType instanceof GenericObjectType && !((GenericObjectType) parmType).hasParameters())
return true;
if (argType instanceof GenericObjectType && !((GenericObjectType) argType).hasParameters())
return true;
// Case: Both are generic containers
if (parmType instanceof GenericObjectType && argType instanceof GenericObjectType) {
return true;
} else {
// Don't consider non reference types (should not be possible)
if (!(parmType instanceof ReferenceType && argType instanceof ReferenceType))
return true;
// Don't consider non object types (for now)
if (!(parmType instanceof ObjectType && argType instanceof ObjectType))
return true;
// Otherwise, compare base types ignoring generic information
try {
return Repository.instanceOf(((ObjectType) argType).getClassName(), ((ObjectType) parmType).getClassName());
} catch (ClassNotFoundException e) {
}
}
return true;
}
示例2: TypeAnnotation
import edu.umd.cs.findbugs.ba.generic.GenericObjectType; //导入方法依赖的package包/类
public TypeAnnotation(Type objectType, String roleDescription) {
this(objectType.getSignature(), roleDescription);
if (objectType instanceof GenericObjectType) {
GenericObjectType genericObjectType = (GenericObjectType) objectType;
if (genericObjectType.getTypeCategory() == GenericUtilities.TypeCategory.PARAMETERIZED)
typeParameters = genericObjectType.getGenericParametersAsString();
}
}