當前位置: 首頁>>代碼示例>>Java>>正文


Java GenericObjectType.getTypeCategory方法代碼示例

本文整理匯總了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;
}
 
開發者ID:ytus,項目名稱:findbugs-all-the-bugs,代碼行數:41,代碼來源:FindUnrelatedTypesInGenericContainer.java

示例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();
    }
}
 
開發者ID:ytus,項目名稱:findbugs-all-the-bugs,代碼行數:9,代碼來源:TypeAnnotation.java


注:本文中的edu.umd.cs.findbugs.ba.generic.GenericObjectType.getTypeCategory方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。