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


Java WildcardType.getExtendsBound方法代碼示例

本文整理匯總了Java中javax.lang.model.type.WildcardType.getExtendsBound方法的典型用法代碼示例。如果您正苦於以下問題:Java WildcardType.getExtendsBound方法的具體用法?Java WildcardType.getExtendsBound怎麽用?Java WildcardType.getExtendsBound使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.lang.model.type.WildcardType的用法示例。


在下文中一共展示了WildcardType.getExtendsBound方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: visitWildcard

import javax.lang.model.type.WildcardType; //導入方法依賴的package包/類
@Override
public StringBuilder visitWildcard(WildcardType t, Boolean p) {
    int len = DEFAULT_VALUE.length();
    DEFAULT_VALUE.append("?"); //NOI18N
    TypeMirror bound = t.getSuperBound();
    if (bound == null) {
        bound = t.getExtendsBound();
        if (bound != null) {
            DEFAULT_VALUE.append(" extends "); //NOI18N
            if (bound.getKind() == TypeKind.WILDCARD)
                bound = ((WildcardType)bound).getSuperBound();
            visit(bound, p);
        } else if (len == 0) {
            bound = getBound(t);
            if (bound != null && (bound.getKind() != TypeKind.DECLARED || !((TypeElement)((DeclaredType)bound).asElement()).getQualifiedName().contentEquals("java.lang.Object"))) { //NOI18N
                DEFAULT_VALUE.append(" extends "); //NOI18N
                visit(bound, p);
            }
        }
    } else {
        DEFAULT_VALUE.append(" super "); //NOI18N
        visit(bound, p);
    }
    return DEFAULT_VALUE;
}
 
開發者ID:jtulach,項目名稱:dew,代碼行數:26,代碼來源:TypeUtilities.java

示例2: visitWildcard

import javax.lang.model.type.WildcardType; //導入方法依賴的package包/類
@Override
public StringBuilder visitWildcard(WildcardType t, Boolean p) {
    int len = DEFAULT_VALUE.length();
    DEFAULT_VALUE.append("?"); //NOI18N
    TypeMirror bound = t.getSuperBound();
    if (bound == null) {
        bound = t.getExtendsBound();
        if (bound != null) {
            DEFAULT_VALUE.append(" extends "); //NOI18N
            if (bound.getKind() == TypeKind.WILDCARD) {
                bound = ((WildcardType)bound).getSuperBound();
            }
            visit(bound, p);
        } else if (len == 0) {
            bound = SourceUtils.getBound(t);
            if (bound != null && (bound.getKind() != TypeKind.DECLARED || !((TypeElement)((DeclaredType)bound).asElement()).getQualifiedName().contentEquals("java.lang.Object"))) { //NOI18N
                DEFAULT_VALUE.append(" extends "); //NOI18N
                visit(bound, p);
            }
        }
    } else {
        DEFAULT_VALUE.append(" super "); //NOI18N
        visit(bound, p);
    }
    return DEFAULT_VALUE;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:27,代碼來源:JavaSymbolProvider.java

示例3: visitWildcard

import javax.lang.model.type.WildcardType; //導入方法依賴的package包/類
@Override
public StringBuilder visitWildcard(WildcardType t, Boolean p) {
    int len = DEFAULT_VALUE.length();
    DEFAULT_VALUE.append("?"); //NOI18N
    TypeMirror bound = t.getSuperBound();
    if (bound == null) {
        bound = t.getExtendsBound();
        if (bound != null) {
            DEFAULT_VALUE.append(" extends "); //NOI18N
            if (bound.getKind() == TypeKind.WILDCARD)
                bound = ((WildcardType)bound).getSuperBound();
            visit(bound, p);
        } else if (len == 0) {
            bound = SourceUtils.getBound(t);
            if (bound != null && (bound.getKind() != TypeKind.DECLARED || !((TypeElement)((DeclaredType)bound).asElement()).getQualifiedName().contentEquals("java.lang.Object"))) { //NOI18N
                DEFAULT_VALUE.append(" extends "); //NOI18N
                visit(bound, p);
            }
        }
    } else {
        DEFAULT_VALUE.append(" super "); //NOI18N
        visit(bound, p);
    }
    return DEFAULT_VALUE;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:26,代碼來源:TypeUtilities.java

示例4: visitWildcard

import javax.lang.model.type.WildcardType; //導入方法依賴的package包/類
@Override
public StringBuilder visitWildcard(WildcardType t, Boolean p) {
    DEFAULT_VALUE.append("?"); //NOI18N
    TypeMirror bound = t.getSuperBound();
    if (bound == null) {
        bound = t.getExtendsBound();
        if (bound != null) {
            DEFAULT_VALUE.append(" extends "); //NOI18N
            if (bound.getKind() == TypeKind.WILDCARD)
                bound = ((WildcardType)bound).getSuperBound();
            visit(bound, p);
        } else {
            bound = SourceUtils.getBound(t);
            if (bound != null && (bound.getKind() != TypeKind.DECLARED || !((TypeElement)((DeclaredType)bound).asElement()).getQualifiedName().contentEquals("java.lang.Object"))) { //NOI18N
                DEFAULT_VALUE.append(" extends "); //NOI18N
                visit(bound, p);
            }
        }
    } else {
        DEFAULT_VALUE.append(" super "); //NOI18N
        visit(bound, p);
    }
    return DEFAULT_VALUE;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:25,代碼來源:SpringXMLConfigCompletionItem.java

示例5: addDependency

import javax.lang.model.type.WildcardType; //導入方法依賴的package包/類
private void addDependency(TypeMirror tm) {
    if (tm.getKind() == TypeKind.ARRAY) {
        addDependency(((ArrayType)tm).getComponentType());
    } else if (tm.getKind() == TypeKind.WILDCARD) {
        WildcardType wt = (WildcardType)tm;
        TypeMirror bound = wt.getSuperBound();
        if (bound == null) {
            bound = wt.getExtendsBound();
        }
        addDependency(bound);
    } else if (tm.getKind() == TypeKind.DECLARED) {
        addDependency(
            ((TypeElement)compilationInfo.getTypes().asElement(tm)).getQualifiedName().toString()
        );
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:17,代碼來源:BeanModelBuilder.java

示例6: decapture

import javax.lang.model.type.WildcardType; //導入方法依賴的package包/類
private TypeMirror decapture(TypeMirror argm) {
    if (argm instanceof CapturedType) {
        argm = ((CapturedType)argm).wildcard;
    }
    if (argm.getKind() == TypeKind.WILDCARD) {
        WildcardType wctype = (WildcardType)argm;
        TypeMirror bound = wctype.getExtendsBound();
        if (bound != null) {
            return bound;
        } 
        bound = wctype.getSuperBound();
        if (bound != null) {
            return bound;
        }
        return null;
    } 
    return argm;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:19,代碼來源:ExpectedTypeResolver.java

示例7: visitWildcard

import javax.lang.model.type.WildcardType; //導入方法依賴的package包/類
@Override
public Void visitWildcard(WildcardType type, Void p) {
    builder.append("?"); //NOI18N
    TypeMirror bound = type.getSuperBound();
    if (bound == null) {
        bound = type.getExtendsBound();
        if (bound != null) {
            builder.append(" extends "); //NOI18N
            if (bound.getKind() == TypeKind.WILDCARD)
                bound = ((WildcardType)bound).getSuperBound();
            visit(bound);
        }
    } else {
        builder.append(" super "); //NOI18N
        visit(bound);
    }
    return null;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:19,代碼來源:AutoImport.java

示例8: visitWildcard

import javax.lang.model.type.WildcardType; //導入方法依賴的package包/類
@Override
public StringBuilder visitWildcard( WildcardType type, StringBuilder sb )
{
	sb.append( "?" );
	TypeMirror extendsBound = type.getExtendsBound();
	TypeMirror superBound = type.getSuperBound();
	if( superBound != null )
	{
		sb.append( " super " );
		visit( superBound, sb );
	}
	else if( extendsBound != null )
	{
		sb.append( " extends " );
		visit( extendsBound, sb );
	}
	return sb;
}
 
開發者ID:ltearno,項目名稱:hexa.tools,代碼行數:19,代碼來源:TypeSimplifier.java

示例9: upperBound

import javax.lang.model.type.WildcardType; //導入方法依賴的package包/類
/**
 * If the argument is a bounded TypeVariable or WildcardType,
 * return its non-variable, non-wildcard upper bound.  Otherwise,
 * return the type itself.
 *
 * @param type  a type
 * @return  the non-variable, non-wildcard upper bound of a type,
 *    if it has one, or itself if it has no bounds
 */
public static TypeMirror upperBound(TypeMirror type) {
    do {
        if (type instanceof TypeVariable) {
            TypeVariable tvar = (TypeVariable) type;
            if (tvar.getUpperBound() != null) {
                type = tvar.getUpperBound();
            } else {
                break;
            }
        } else if (type instanceof WildcardType) {
            WildcardType wc = (WildcardType) type;
            if (wc.getExtendsBound() != null) {
                type = wc.getExtendsBound();
            } else {
                break;
            }
        } else {
            break;
        }
    } while (true);
    return type;
}
 
開發者ID:reprogrammer,項目名稱:checker-framework,代碼行數:32,代碼來源:TypesUtils.java

示例10: CodeTranslator

import javax.lang.model.type.WildcardType; //導入方法依賴的package包/類
public CodeTranslator(ProcessingEnvironment processingEnv) {
  this.trees = Trees.instance(processingEnv);
  this.SystemType = (DeclaredType) processingEnv.getElementUtils().getTypeElement(System.class.getName()).asType();
  this.ThrowableType = (DeclaredType) processingEnv.getElementUtils().getTypeElement(Throwable.class.getName()).asType();
  Context context = ((JavacProcessingEnvironment)processingEnv).getContext();
  this.attr = Attr.instance(context);
  this.typeUtils = processingEnv.getTypeUtils();
  this.factory = new TypeMirrorFactory(processingEnv.getElementUtils(), processingEnv.getTypeUtils()) {
    @Override
    public TypeInfo create(TypeUse use, TypeMirror type) {
      if (type.getKind() == TypeKind.WILDCARD) {
        WildcardType wildcardType = (WildcardType) type;
        if (wildcardType.getExtendsBound() != null) {
          return super.create(wildcardType.getExtendsBound());
        } else if (wildcardType.getSuperBound() != null) {
          return super.create(use, wildcardType.getSuperBound());
        }
      }
      return super.create(use, type);
    }
  };
}
 
開發者ID:vert-x3,項目名稱:vertx-codetrans,代碼行數:23,代碼來源:CodeTranslator.java

示例11: upperBound

import javax.lang.model.type.WildcardType; //導入方法依賴的package包/類
/**
 * If the argument is a bounded TypeVariable or WildcardType, return its non-variable,
 * non-wildcard upper bound. Otherwise, return the type itself.
 *
 * @param type a type
 * @return the non-variable, non-wildcard upper bound of a type, if it has one, or itself if it
 *     has no bounds
 */
public static TypeMirror upperBound(TypeMirror type) {
    do {
        if (type instanceof TypeVariable) {
            TypeVariable tvar = (TypeVariable) type;
            if (tvar.getUpperBound() != null) {
                type = tvar.getUpperBound();
            } else {
                break;
            }
        } else if (type instanceof WildcardType) {
            WildcardType wc = (WildcardType) type;
            if (wc.getExtendsBound() != null) {
                type = wc.getExtendsBound();
            } else {
                break;
            }
        } else {
            break;
        }
    } while (true);
    return type;
}
 
開發者ID:bazelbuild,項目名稱:bazel,代碼行數:31,代碼來源:TypesUtils.java

示例12: addTypes

import javax.lang.model.type.WildcardType; //導入方法依賴的package包/類
private void addTypes(Set<String> imports, TypeMirror type) {

		if (type instanceof DeclaredType) {
			DeclaredType declaredType = (DeclaredType) type;
			Element declaredElement = declaredType.asElement();
			imports.add(declaredElement.toString());

			for (TypeMirror typeArgument : declaredType.getTypeArguments()) {
				addTypes(imports, typeArgument);
			}
		} else if (type instanceof WildcardType) {
			WildcardType wildcardType = (WildcardType) type;
			if (wildcardType.getExtendsBound() != null) {
				addTypes(imports, wildcardType.getExtendsBound());
			}
			if (wildcardType.getSuperBound() != null) {
				addTypes(imports, wildcardType.getSuperBound());
			}
		} else if (type instanceof ArrayType) {
			ArrayType arrayType = (ArrayType) type;
			addTypes(imports, arrayType.getComponentType());
		}
	}
 
開發者ID:halfreal,項目名稱:spezi-mvc,代碼行數:24,代碼來源:ModelProcessor.java

示例13: visitWildcard

import javax.lang.model.type.WildcardType; //導入方法依賴的package包/類
@Override
@Nullable
public R visitWildcard(WildcardType t, P p) {
  R result = defaultValue;
  TypeMirror extendsBound = t.getExtendsBound();
  if (extendsBound != null) {
    result = scan(extendsBound, p);
  }

  TypeMirror superBound = t.getSuperBound();
  if (superBound != null) {
    result = scan(superBound, p);
  }

  return result;
}
 
開發者ID:facebook,項目名稱:buck,代碼行數:17,代碼來源:TypeScanner8.java

示例14: visitWildcard

import javax.lang.model.type.WildcardType; //導入方法依賴的package包/類
@Override
public Void visitWildcard(WildcardType t, SignatureVisitor visitor) {
  TypeMirror bound = t.getExtendsBound();
  if (bound != null) {
    bound.accept(this, visitor.visitTypeArgument(SignatureVisitor.EXTENDS));
    return null;
  }

  bound = t.getSuperBound();
  if (bound != null) {
    bound.accept(this, visitor.visitTypeArgument(SignatureVisitor.SUPER));
    return null;
  }

  visitor.visitTypeArgument();
  return null;
}
 
開發者ID:facebook,項目名稱:buck,代碼行數:18,代碼來源:SignatureFactory.java

示例15: visitWildcard

import javax.lang.model.type.WildcardType; //導入方法依賴的package包/類
@Override
public Void visitWildcard(WildcardType t, Collection<DeclaredType> p) {
    if (t.getExtendsBound() != null) {
        visit(t.getExtendsBound(), p);
    }
    if (t.getSuperBound() != null) {
        visit(t.getSuperBound(), p);
    }
    return DEFAULT_VALUE;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:11,代碼來源:DeclaredTypeCollector.java


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