本文整理匯總了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();
}
}