本文整理匯總了Java中javax.lang.model.type.WildcardType.getSuperBound方法的典型用法代碼示例。如果您正苦於以下問題:Java WildcardType.getSuperBound方法的具體用法?Java WildcardType.getSuperBound怎麽用?Java WildcardType.getSuperBound使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.lang.model.type.WildcardType
的用法示例。
在下文中一共展示了WildcardType.getSuperBound方法的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;
}
示例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;
}
示例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;
}
示例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;
}
示例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()
);
}
}
示例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;
}
示例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;
}
示例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;
}
示例9: 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);
}
};
}
示例10: 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());
}
}
示例11: 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;
}
示例12: 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;
}
示例13: 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;
}
示例14: visitWildcard
import javax.lang.model.type.WildcardType; //導入方法依賴的package包/類
@Override
public Integer visitWildcard(WildcardType t, Set<Element> visiting) {
int result = hashKind(HASH_SEED, t);
result *= HASH_MULTIPLIER;
result +=
(t.getExtendsBound() == null) ? 0 : t.getExtendsBound().accept(this, visiting);
result *= HASH_MULTIPLIER;
result += (t.getSuperBound() == null) ? 0 : t.getSuperBound().accept(this, visiting);
return result;
}
示例15: 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;
}