本文整理汇总了Java中org.walkmod.javalang.ast.type.PrimitiveType.getType方法的典型用法代码示例。如果您正苦于以下问题:Java PrimitiveType.getType方法的具体用法?Java PrimitiveType.getType怎么用?Java PrimitiveType.getType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.walkmod.javalang.ast.type.PrimitiveType
的用法示例。
在下文中一共展示了PrimitiveType.getType方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visit
import org.walkmod.javalang.ast.type.PrimitiveType; //导入方法依赖的package包/类
@Override
public SymbolType visit(PrimitiveType n, List<TypeParameter> arg) {
final SymbolType result;
Primitive pt = n.getType();
if (pt.equals(Primitive.Boolean)) {
result = new SymbolType(boolean.class.getName());
} else if (pt.equals(Primitive.Char)) {
result = new SymbolType(char.class.getName());
} else if (pt.equals(Primitive.Double)) {
result = new SymbolType(double.class.getName());
} else if (pt.equals(Primitive.Float)) {
result = new SymbolType(float.class.getName());
} else if (pt.equals(Primitive.Int)) {
result = new SymbolType(int.class.getName());
} else if (pt.equals(Primitive.Long)) {
result = new SymbolType(long.class.getName());
} else if (pt.equals(Primitive.Short)) {
result = new SymbolType(short.class.getName());
} else if (pt.equals(Primitive.Byte)) {
result = new SymbolType(byte.class.getName());
} else {
throw new IllegalArgumentException("unexpected primitive type: " + pt);
}
return result;
}
示例2: visit
import org.walkmod.javalang.ast.type.PrimitiveType; //导入方法依赖的package包/类
@Override
public void visit(PrimitiveType n, A arg) {
super.visit(n, arg);
Primitive type = n.getType();
if (type.equals(Primitive.Boolean)) {
n.setSymbolData(new SymbolType("boolean"));
} else if (type.equals(Primitive.Byte)) {
n.setSymbolData(new SymbolType("byte"));
} else if (type.equals(Primitive.Char)) {
n.setSymbolData(new SymbolType("char"));
} else if (type.equals(Primitive.Double)) {
n.setSymbolData(new SymbolType("double"));
} else if (type.equals(Primitive.Float)) {
n.setSymbolData(new SymbolType("float"));
} else if (type.equals(Primitive.Int)) {
n.setSymbolData(new SymbolType("int"));
} else if (type.equals(Primitive.Long)) {
n.setSymbolData(new SymbolType("long"));
} else if (type.equals(Primitive.Short)) {
n.setSymbolData(new SymbolType("short"));
}
}
示例3: visit
import org.walkmod.javalang.ast.type.PrimitiveType; //导入方法依赖的package包/类
public Boolean visit(PrimitiveType n1, Node arg) {
PrimitiveType n2 = (PrimitiveType) arg;
if (n1.getType() != n2.getType()) {
return Boolean.FALSE;
}
if (!nodesEquals(n1.getAnnotations(), n2.getAnnotations())) {
return Boolean.FALSE;
}
return Boolean.TRUE;
}
示例4: visit
import org.walkmod.javalang.ast.type.PrimitiveType; //导入方法依赖的package包/类
@Override
public Node visit(PrimitiveType _n, Object _arg) {
List<AnnotationExpr> ann = visit(_n.getAnnotations(), _arg);
PrimitiveType r = new PrimitiveType(_n.getBeginLine(), _n.getBeginColumn(), _n.getEndLine(), _n.getEndColumn(),
_n.getType(), ann);
return r;
}
示例5: visit
import org.walkmod.javalang.ast.type.PrimitiveType; //导入方法依赖的package包/类
public void visit(PrimitiveType n, Object arg) {
prepareComments(n);
printPreviousComments(n, arg);
if (n.getAnnotations() != null) {
for (AnnotationExpr ae : n.getAnnotations()) {
ae.accept(this, arg);
printer.print(" ");
}
}
switch (n.getType()) {
case Boolean:
printer.print("boolean");
break;
case Byte:
printer.print("byte");
break;
case Char:
printer.print("char");
break;
case Double:
printer.print("double");
break;
case Float:
printer.print("float");
break;
case Int:
printer.print("int");
break;
case Long:
printer.print("long");
break;
case Short:
printer.print("short");
break;
}
}