本文整理汇总了Java中com.github.javaparser.ast.type.UnknownType类的典型用法代码示例。如果您正苦于以下问题:Java UnknownType类的具体用法?Java UnknownType怎么用?Java UnknownType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UnknownType类属于com.github.javaparser.ast.type包,在下文中一共展示了UnknownType类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: visit
import com.github.javaparser.ast.type.UnknownType; //导入依赖的package包/类
@Override
public JCTree visit(final UnknownType n, final Object arg) {
//ARG0 TypeTag
// An unknown type is a primitive type idetified
// by label defined in code/TypeTags
TypeTag arg0 = TypeTag.UNKNOWN;
return new AJCPrimitiveTypeTree(make.TypeIdent(arg0), ((n.getComment() != null) ? n.getComment().getContent() : null));
}
开发者ID:pcgomes,项目名称:javaparser2jctree,代码行数:10,代码来源:JavaParser2JCTree.java
示例2: asKind
import com.github.javaparser.ast.type.UnknownType; //导入依赖的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
示例3: visit
import com.github.javaparser.ast.type.UnknownType; //导入依赖的package包/类
@Override
public Type visit(Parameter node, Boolean solveLambdas) {
if (node.getType() instanceof UnknownType) {
throw new IllegalStateException("Parameter has unknown type: " + node);
}
return facade.convertToUsage(node.getType(), node);
}
开发者ID:javaparser,项目名称:javasymbolsolver,代码行数:8,代码来源:TypeExtractor.java
示例4: visit
import com.github.javaparser.ast.type.UnknownType; //导入依赖的package包/类
@Override
public ResolvedType visit(Parameter node, Boolean solveLambdas) {
if (node.getType() instanceof UnknownType) {
throw new IllegalStateException("Parameter has unknown type: " + node);
}
return facade.convertToUsage(node.getType(), node);
}
开发者ID:javaparser,项目名称:javasymbolsolver,代码行数:8,代码来源:TypeExtractor.java
示例5: getType
import com.github.javaparser.ast.type.UnknownType; //导入依赖的package包/类
@Override
public ResolvedType getType() {
if (wrappedNode.getType() instanceof UnknownType && JavaParserFactory.getContext(wrappedNode, typeSolver) instanceof LambdaExprContext) {
Optional<Value> value = JavaParserFactory.getContext(wrappedNode, typeSolver).solveSymbolAsValue(wrappedNode.getNameAsString(), typeSolver);
if (value.isPresent()) {
return value.get().getType();
}
}
ResolvedType res = JavaParserFacade.get(typeSolver).convert(wrappedNode.getType(), wrappedNode);
if (isVariadic()) {
res = new ResolvedArrayType(res);
}
return res;
}
开发者ID:javaparser,项目名称:javasymbolsolver,代码行数:15,代码来源:JavaParserParameterDeclaration.java
示例6: visit
import com.github.javaparser.ast.type.UnknownType; //导入依赖的package包/类
@Override
public Node visit(
UnknownType 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.UnknownType; //导入依赖的package包/类
@Override
public void visit(UnknownType n, Script arg) {
}
开发者ID:Nosorog,项目名称:nosorog-core,代码行数:4,代码来源:NoOpVisitor.java
示例8: visit
import com.github.javaparser.ast.type.UnknownType; //导入依赖的package包/类
@Override
public void visit(final UnknownType n, final Object arg) {
printer.printLn("UnknownType");
// Nothing to dump
}
开发者ID:pcgomes,项目名称:javaparser2jctree,代码行数:6,代码来源:ASTDumpVisitor.java
示例9: convertToUsage
import com.github.javaparser.ast.type.UnknownType; //导入依赖的package包/类
public Type convertToUsage(com.github.javaparser.ast.type.Type type, Node context) {
if (type instanceof UnknownType) {
throw new IllegalArgumentException("Unknown type");
}
return convertToUsage(type, JavaParserFactory.getContext(context, typeSolver));
}
开发者ID:javaparser,项目名称:javasymbolsolver,代码行数:7,代码来源:JavaParserFacade.java
示例10: isExplicitlyTyped
import com.github.javaparser.ast.type.UnknownType; //导入依赖的package包/类
public static boolean isExplicitlyTyped(LambdaExpr lambdaExpr) {
return lambdaExpr.getParameters().stream().allMatch(p -> !(p.getType() instanceof UnknownType));
}
开发者ID:javaparser,项目名称:javasymbolsolver,代码行数:4,代码来源:ExpressionHelper.java
示例11: isImplicitlyTyped
import com.github.javaparser.ast.type.UnknownType; //导入依赖的package包/类
private boolean isImplicitlyTyped(LambdaExpr lambdaExpr) {
return lambdaExpr.getParameters().stream().anyMatch(p -> p.getType() instanceof UnknownType);
}
开发者ID:javaparser,项目名称:javasymbolsolver,代码行数:4,代码来源:TypeInference.java
示例12: visit
import com.github.javaparser.ast.type.UnknownType; //导入依赖的package包/类
@Override
public void visit(final UnknownType n, final Context ctx) {
visitNode(n, ctx);
super.visit(n, ctx);
}
开发者ID:jooby-project,项目名称:jooby,代码行数:6,代码来源:LocalVariableCollector.java
示例13: transformUnary
import com.github.javaparser.ast.type.UnknownType; //导入依赖的package包/类
public Node transformUnary(Expression source, UnaryExpr expr) {
final Expression data = expr.getExpr();
switch (expr.getOperator()) {
// x++
case posIncrement:
// x--
case posDecrement:
// For post increment / decrement,
// we want to store the de/incremented value,
// but use the current value.
// So, we will generate setX(getX() + 1),
// as the setX function returns the previous value
final String setter = generateSetterMethod(data);
final String getter = generateGetterMethod(data);
MethodCallExpr methodCall = new MethodCallExpr();
methodCall.setName(setter);
MethodCallExpr get = new MethodCallExpr();
get.setName(getter);
final BinaryExpr.Operator operator = expr.getOperator() == Operator.posIncrement ? BinaryExpr.Operator.plus : BinaryExpr.Operator.minus;
BinaryExpr op = new BinaryExpr(get, new IntegerLiteralExpr("1"), operator);
methodCall.setArgs(Arrays.asList(op));
initExtras(methodCall, data);
return methodCall;
// ++x
// --x
case preIncrement:
case preDecrement:
// For pre increment / decrement,
// we want to de/increment the value,
// and use the updated value immediately
// So, we will use computeX_1(i -> i++)
// TODO: Have a global INCREMENT function we can just reference instead
String compute = generateComputeMethod(data) + "_1";
List<Parameter> params = new ArrayList<>();
Type type = new UnknownType();
VariableDeclaratorId id = new VariableDeclaratorId("i");
params.add(new Parameter(type, id));
UnaryExpr copy = new UnaryExpr(new NameExpr("i"), expr.getOperator());
Statement body = new ExpressionStmt(copy);
LambdaExpr lambda = new LambdaExpr(params, body, false);
methodCall = new MethodCallExpr();
methodCall.setName(compute);
methodCall.setArgs(Arrays.asList(lambda));
initExtras(methodCall, data);
return methodCall;
case inverse:
case negative:
case not:
case positive:
throw new NotImplemented("Need to implement unary operator " + expr.getOperator() + " in " + getClass());
}
return expr;
// return new StringLiteralExpr(expr.toSource());
}
开发者ID:WeTheInternet,项目名称:xapi,代码行数:55,代码来源:NodeTransformer.java
示例14: visit
import com.github.javaparser.ast.type.UnknownType; //导入依赖的package包/类
@Override
public void visit(UnknownType n, Void arg) {
out.println("UnknownType: " + (extended ? n : ""));
super.visit(n, arg);
}
开发者ID:JCTools,项目名称:JCTools,代码行数:6,代码来源:TraceVisitor.java
注:本文中的com.github.javaparser.ast.type.UnknownType类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论