本文整理汇总了Java中com.github.javaparser.ast.type.WildcardType类的典型用法代码示例。如果您正苦于以下问题:Java WildcardType类的具体用法?Java WildcardType怎么用?Java WildcardType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WildcardType类属于com.github.javaparser.ast.type包,在下文中一共展示了WildcardType类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: visit
import com.github.javaparser.ast.type.WildcardType; //导入依赖的package包/类
@Override
public void visit(final WildcardType n, final Object arg) {
printer.printLn("WildcardType");
printJavaComment(n.getComment(), arg);
if (n.getAnnotations() != null) {
for (AnnotationExpr ae : n.getAnnotations()) {
printer.print(" ");
ae.accept(this, arg);
}
}
printer.print("?");
if (n.getExtends() != null) {
printer.print(" extends ");
n.getExtends().accept(this, arg);
}
if (n.getSuper() != null) {
printer.print(" super ");
n.getSuper().accept(this, arg);
}
}
开发者ID:pcgomes,项目名称:javaparser2jctree,代码行数:21,代码来源:ASTDumpVisitor.java
示例2: visit
import com.github.javaparser.ast.type.WildcardType; //导入依赖的package包/类
@Override
public JCTree visit(final WildcardType n, final Object arg) {
//ARG0: TypeBoundKind kind
// For < ? extends> or < ? super > or < ? >
TypeBoundKind arg0;
//ARG1: JCTree inner
// A class associated to this type, if any
JCTree arg1;
if (n.getExtends() != null) {
arg0 = new ATypeBoundKind(make.TypeBoundKind(EXTENDS), null);
arg1 = n.getExtends().accept(this, arg);
} else if (n.getSuper() != null) {
arg0 = new ATypeBoundKind(make.TypeBoundKind(SUPER), null);
arg1 = n.getSuper().accept(this, arg);
} else {
arg0 = new ATypeBoundKind(make.TypeBoundKind(UNBOUND), null);
arg1 = null;
}
return new AJCWildcard(make.Wildcard(arg0, arg1), ((n.getComment() != null) ? n.getComment().getContent() : null));
}
开发者ID:pcgomes,项目名称:javaparser2jctree,代码行数:24,代码来源:JavaParser2JCTree.java
示例3: apply
import com.github.javaparser.ast.type.WildcardType; //导入依赖的package包/类
public TypeRef apply(Type type) {
if (type instanceof VoidType) {
return new VoidRef();
} else if (type instanceof WildcardType) {
return new WildcardRef();
} else if (type instanceof ReferenceType) {
ReferenceType referenceType = (ReferenceType) type;
int dimensions = referenceType.getArrayCount();
TypeRef typeRef = TYPEREF.apply(referenceType.getType());
if (dimensions == 0) {
return typeRef;
} else if (typeRef instanceof ClassRef) {
return new ClassRefBuilder((ClassRef)typeRef).withDimensions(dimensions).build();
} else if (typeRef instanceof PrimitiveRef) {
return new PrimitiveRefBuilder((PrimitiveRef)typeRef).withDimensions(dimensions).build();
} else if (typeRef instanceof TypeParamRef) {
return new TypeParamRefBuilder((TypeParamRef)typeRef).withDimensions(dimensions).build();
}
} else if (type instanceof PrimitiveType) {
PrimitiveType primitiveType = (PrimitiveType) type;
return new PrimitiveRefBuilder().withName(primitiveType.getType().name()).build();
} else if (type instanceof ClassOrInterfaceType) {
return CLASS_OR_TYPEPARAM_REF.apply((ClassOrInterfaceType) type);
}
throw new IllegalArgumentException("Can't handle type:[" + type + "].");
}
开发者ID:sundrio,项目名称:sundrio,代码行数:27,代码来源:Sources.java
示例4: doMerge
import com.github.javaparser.ast.type.WildcardType; //导入依赖的package包/类
@Override
public WildcardType doMerge(WildcardType first, WildcardType second) {
WildcardType wt = new WildcardType();
wt.setAnnotations(mergeCollections(first.getAnnotations(),second.getAnnotations()));
wt.setExtends(mergeSingle(first.getExtends(),second.getExtends()));
wt.setSuper(mergeSingle(first.getSuper(),second.getSuper()));
return first;
}
开发者ID:beihaifeiwu,项目名称:dolphin,代码行数:9,代码来源:WildcardTypeMerger.java
示例5: asKind
import com.github.javaparser.ast.type.WildcardType; //导入依赖的package包/类
public static TypeKind asKind(Type type) {
if(type instanceof ClassOrInterfaceType) {
return TypeKind.DECLARED;
} else if(type instanceof PrimitiveType) {
switch (((PrimitiveType) type).getType()) {
case Boolean:
return TypeKind.BOOLEAN;
case Byte:
return TypeKind.BYTE;
case Char:
return TypeKind.CHAR;
case Double:
return TypeKind.DOUBLE;
case Float:
return TypeKind.FLOAT;
case Int:
return TypeKind.INT;
case Long:
return TypeKind.LONG;
case Short:
return TypeKind.SHORT;
}
} else if(type instanceof ReferenceType) {
return asKind(((ReferenceType) type).getType());
} else if(type instanceof UnknownType) {
return TypeKind.OTHER;
} else if(type instanceof VoidType) {
return TypeKind.VOID;
} else if(type instanceof WildcardType) {
return TypeKind.WILDCARD;
}
return TypeKind.ERROR;
}
开发者ID:BenDol,项目名称:Databind,代码行数:35,代码来源:TypeUtil.java
示例6: visit
import com.github.javaparser.ast.type.WildcardType; //导入依赖的package包/类
@Override
public Node visit(
WildcardType n, Map<Node, Node> arg
) {
if (arg.containsKey(n)) {
return arg.get(n);
}
return super.visit(n, arg);
}
开发者ID:WeTheInternet,项目名称:xapi,代码行数:10,代码来源:ConcreteModifierVisitor.java
示例7: visit
import com.github.javaparser.ast.type.WildcardType; //导入依赖的package包/类
@Override
public void visit(WildcardType n, Script arg) {
}
开发者ID:Nosorog,项目名称:nosorog-core,代码行数:4,代码来源:NoOpVisitor.java
示例8: getSocketReturnParam
import com.github.javaparser.ast.type.WildcardType; //导入依赖的package包/类
public static Type getSocketReturnParam(String socketNameType) {
ClassOrInterfaceType socketType = new ClassOrInterfaceType(null, socketNameType);
socketType.setTypeArgs(Arrays.asList(new WildcardType()));
return new ReferenceType(socketType, 1);
}
开发者ID:WPIRoboticsProjects,项目名称:GRIP,代码行数:6,代码来源:SocketHintDeclarationCollection.java
示例9: convertToUsage
import com.github.javaparser.ast.type.WildcardType; //导入依赖的package包/类
protected Type convertToUsage(com.github.javaparser.ast.type.Type type, Context context) {
if (type instanceof ClassOrInterfaceType) {
ClassOrInterfaceType classOrInterfaceType = (ClassOrInterfaceType) type;
String name = qName(classOrInterfaceType);
SymbolReference<TypeDeclaration> ref = context.solveType(name, typeSolver);
if (!ref.isSolved()) {
throw new UnsolvedSymbolException(name);
}
TypeDeclaration typeDeclaration = ref.getCorrespondingDeclaration();
List<Type> typeParameters = Collections.emptyList();
if (classOrInterfaceType.getTypeArguments().isPresent()) {
typeParameters = classOrInterfaceType.getTypeArguments().get().stream().map((pt) -> convertToUsage(pt, context)).collect(Collectors.toList());
}
if (typeDeclaration.isTypeParameter()) {
if (typeDeclaration instanceof TypeParameterDeclaration) {
return new TypeVariable((TypeParameterDeclaration) typeDeclaration);
} else {
JavaParserTypeVariableDeclaration javaParserTypeVariableDeclaration = (JavaParserTypeVariableDeclaration) typeDeclaration;
return new TypeVariable(javaParserTypeVariableDeclaration.asTypeParameter());
}
} else {
return new ReferenceTypeImpl((ReferenceTypeDeclaration) typeDeclaration, typeParameters, typeSolver);
}
} else if (type instanceof com.github.javaparser.ast.type.PrimitiveType) {
return PrimitiveType.byName(((com.github.javaparser.ast.type.PrimitiveType) type).getType().name());
} else if (type instanceof WildcardType) {
WildcardType wildcardType = (WildcardType) type;
if (wildcardType.getExtendedTypes().isPresent() && !wildcardType.getSuperTypes().isPresent()) {
return Wildcard.extendsBound(convertToUsage(wildcardType.getExtendedTypes().get(), context)); // removed (ReferenceTypeImpl)
} else if (!wildcardType.getExtendedTypes().isPresent() && wildcardType.getSuperTypes().isPresent()) {
return Wildcard.superBound(convertToUsage(wildcardType.getSuperTypes().get(), context)); // removed (ReferenceTypeImpl)
} else if (!wildcardType.getExtendedTypes().isPresent() && !wildcardType.getSuperTypes().isPresent()) {
return Wildcard.UNBOUNDED;
} else {
throw new UnsupportedOperationException(wildcardType.toString());
}
} else if (type instanceof com.github.javaparser.ast.type.VoidType) {
return VoidType.INSTANCE;
} else if (type instanceof com.github.javaparser.ast.type.ArrayType) {
com.github.javaparser.ast.type.ArrayType jpArrayType = (com.github.javaparser.ast.type.ArrayType) type;
return new ArrayType(convertToUsage(jpArrayType.getComponentType(), context));
} else {
throw new UnsupportedOperationException(type.getClass().getCanonicalName());
}
}
开发者ID:javaparser,项目名称:javasymbolsolver,代码行数:46,代码来源:JavaParserFacade.java
示例10: visit
import com.github.javaparser.ast.type.WildcardType; //导入依赖的package包/类
@Override
public void visit(final WildcardType n, final Context ctx) {
visitNode(n, ctx);
super.visit(n, ctx);
}
开发者ID:jooby-project,项目名称:jooby,代码行数:6,代码来源:LocalVariableCollector.java
示例11: visit
import com.github.javaparser.ast.type.WildcardType; //导入依赖的package包/类
@Override
public Type visit(final WildcardType n, final Context ctx) {
return null;
}
开发者ID:jooby-project,项目名称:jooby,代码行数:5,代码来源:TypeCollector.java
示例12: visit
import com.github.javaparser.ast.type.WildcardType; //导入依赖的package包/类
@Override
public void visit(WildcardType n, Void arg) {
out.println("WildcardType: " + (extended ? n : ""));
super.visit(n, arg);
}
开发者ID:JCTools,项目名称:JCTools,代码行数:6,代码来源:TraceVisitor.java
示例13: doIsEquals
import com.github.javaparser.ast.type.WildcardType; //导入依赖的package包/类
@Override
public boolean doIsEquals(WildcardType first, WildcardType second) {
if (!isEqualsUseMerger(first.getExtends(), second.getExtends())) return false;
if (!isEqualsUseMerger(first.getSuper(), second.getSuper())) return false;
return true;
}
开发者ID:beihaifeiwu,项目名称:dolphin,代码行数:10,代码来源:WildcardTypeMerger.java
注:本文中的com.github.javaparser.ast.type.WildcardType类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论