本文整理汇总了Java中japa.parser.ast.type.PrimitiveType类的典型用法代码示例。如果您正苦于以下问题:Java PrimitiveType类的具体用法?Java PrimitiveType怎么用?Java PrimitiveType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PrimitiveType类属于japa.parser.ast.type包,在下文中一共展示了PrimitiveType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: visit
import japa.parser.ast.type.PrimitiveType; //导入依赖的package包/类
@Override
public JType visit(PrimitiveType type, JCodeModel codeModel) {
switch (type.getType()) {
case Boolean:
return codeModel.BOOLEAN;
case Char:
return codeModel.CHAR;
case Byte:
return codeModel.BYTE;
case Short:
return codeModel.SHORT;
case Int:
return codeModel.INT;
case Long:
return codeModel.LONG;
case Float:
return codeModel.FLOAT;
case Double:
return codeModel.DOUBLE;
default:
throw new AssertionError("Unknown primitive type ["
+ type.getType() + "]");
}
}
开发者ID:highsource,项目名称:jaxb2-basics,代码行数:25,代码来源:TypeToJTypeConvertingVisitor.java
示例2: getRawTypeName
import japa.parser.ast.type.PrimitiveType; //导入依赖的package包/类
private static String getRawTypeName(Type type) {
if (type instanceof ClassOrInterfaceType) {
return getQualifiedName((ClassOrInterfaceType) type);
}
if (type instanceof ReferenceType) {
ReferenceType refType = (ReferenceType) type;
return getRawTypeName(refType.getType()) + StringUtils.multiply("[]", refType.getArrayCount());
}
if (type instanceof PrimitiveType) {
return ((PrimitiveType) type).getType().name().toLowerCase();
}
if (type instanceof VoidType) {
return "void";
}
if (type instanceof WildcardType) {
return "java.lang.Object";
}
return type.toString();
}
开发者ID:jedwards1211,项目名称:breakout,代码行数:20,代码来源:JavaParserUtils.java
示例3: getType
import japa.parser.ast.type.PrimitiveType; //导入依赖的package包/类
/**
* Given a primitive type, computes the corresponding Java Parser type.
* <p>
* Presenting a non-primitive type to this method will throw an exception.
* If you have a non-primitive type, use
* {@link #importTypeIfRequired(JavaType, List, JavaType)} and then present
* the {@link NameExpr} it returns to
* {@link #getClassOrInterfaceType(NameExpr)}.
*
* @param javaType a primitive type (required, and must be primitive)
* @return the equivalent Java Parser {@link Type}
*/
public static Type getType(final JavaType javaType) {
Validate.notNull(javaType, "Java type required");
Validate.isTrue(javaType.isPrimitive(),
"Java type must be primitive to be presented to this method");
if (javaType.equals(JavaType.VOID_PRIMITIVE)) {
return new VoidType();
}
else if (javaType.equals(JavaType.BOOLEAN_PRIMITIVE)) {
return new PrimitiveType(Primitive.Boolean);
}
else if (javaType.equals(JavaType.BYTE_PRIMITIVE)) {
return new PrimitiveType(Primitive.Byte);
}
else if (javaType.equals(JavaType.CHAR_PRIMITIVE)) {
return new PrimitiveType(Primitive.Char);
}
else if (javaType.equals(JavaType.DOUBLE_PRIMITIVE)) {
return new PrimitiveType(Primitive.Double);
}
else if (javaType.equals(JavaType.FLOAT_PRIMITIVE)) {
return new PrimitiveType(Primitive.Float);
}
else if (javaType.equals(JavaType.INT_PRIMITIVE)) {
return new PrimitiveType(Primitive.Int);
}
else if (javaType.equals(JavaType.LONG_PRIMITIVE)) {
return new PrimitiveType(Primitive.Long);
}
else if (javaType.equals(JavaType.SHORT_PRIMITIVE)) {
return new PrimitiveType(Primitive.Short);
}
throw new IllegalStateException("Unknown primitive " + javaType);
}
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:46,代码来源:JavaParserUtils.java
示例4: visit
import japa.parser.ast.type.PrimitiveType; //导入依赖的package包/类
public Boolean visit(PrimitiveType n1, Node arg) {
PrimitiveType n2 = (PrimitiveType) arg;
if (n1.getType() != n2.getType()) {
return Boolean.FALSE;
}
return Boolean.TRUE;
}
开发者ID:rfw,项目名称:genja,代码行数:10,代码来源:EqualsVisitor.java
示例5: visit
import japa.parser.ast.type.PrimitiveType; //导入依赖的package包/类
public void visit(PrimitiveType n, Object arg) {
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;
}
}
开发者ID:rfw,项目名称:genja,代码行数:29,代码来源:DumpVisitor.java
示例6: visit
import japa.parser.ast.type.PrimitiveType; //导入依赖的package包/类
@Override
public void visit(PrimitiveType n, Generator arg) {
throw new TransformException("don't know how to linearize");
}
开发者ID:rfw,项目名称:genja,代码行数:5,代码来源:LinearizeTransform.java
示例7: visit
import japa.parser.ast.type.PrimitiveType; //导入依赖的package包/类
@Override
public MethodDeclaration visit(MethodDeclaration n, Void arg) {
if (!n.isGenerator()) {
throw new UnsupportedOperationException("cannot transform non-generator");
}
// Desugar ALL the loops!
n.accept(new LoopDesugarTransform(), null);
if (CompilerSettings.dumpDesugar) {
System.err.println(n);
}
Generator g = new Generator();
Map<String, TypedVariableDeclarator> vars = new HashMap<String, TypedVariableDeclarator>();
// Mangle all our scope variables.
n.accept(new ScopeMangleTransform(), vars);
if (CompilerSettings.dumpMangle) {
System.err.println(n);
}
// Generate the body.
n.accept(new LinearizeTransform(), g);
List<BodyDeclaration> generatorBody = new ArrayList<BodyDeclaration>();
// Add the fields to the generator body.
for (Map.Entry<String, TypedVariableDeclarator> kv : vars.entrySet()) {
VariableDeclarator decl = new VariableDeclarator(new VariableDeclaratorId(kv.getKey()), null);
generatorBody.add(new FieldDeclaration(ModifierSet.PRIVATE, kv.getValue().type, decl));
}
// Add the moveNext method to the generator body.
generatorBody.add(new MethodDeclaration(0, 0, 0, 0, null, ModifierSet.PROTECTED,
null, null, new PrimitiveType(Primitive.Boolean),
"moveNext", null, 0, null, false,
new BlockStmt(g.generate())));
ObjectCreationExpr o = new ObjectCreationExpr(0, 0, 0, 0, null, makeRtGeneratorType(n.getType()), null, null, generatorBody);
List<Statement> methodBody = new ArrayList<Statement>();
methodBody.add(new ReturnStmt(o));
MethodDeclaration n2 = new MethodDeclaration(n.getBeginLine(),
n.getBeginColumn(),
n.getEndLine(),
n.getEndColumn(),
n.getJavaDoc(),
n.getModifiers(),
n.getAnnotations(),
n.getTypeParameters(),
makeRtGeneratorType(n.getType()),
n.getName(),
n.getParameters(),
n.getArrayCount(),
n.getThrows(),
false,
new BlockStmt(methodBody));
return n2;
}
开发者ID:rfw,项目名称:genja,代码行数:60,代码来源:GeneratorTransform.java
示例8: visit
import japa.parser.ast.type.PrimitiveType; //导入依赖的package包/类
@Override
public Boolean visit(PrimitiveType n, Void arg) {
return false;
}
开发者ID:rfw,项目名称:genja,代码行数:5,代码来源:NodeAnnotator.java
示例9: visit
import japa.parser.ast.type.PrimitiveType; //导入依赖的package包/类
@Override
public void visit(PrimitiveType n, Scope arg) {
super.visit(n, arg);
n.setData(arg);
}
开发者ID:rfw,项目名称:genja,代码行数:6,代码来源:ScopeCollector.java
示例10: visit
import japa.parser.ast.type.PrimitiveType; //导入依赖的package包/类
public R visit(PrimitiveType n, A arg) {
return null;
}
开发者ID:rfw,项目名称:genja,代码行数:4,代码来源:GenericVisitorAdapter.java
示例11: visit
import japa.parser.ast.type.PrimitiveType; //导入依赖的package包/类
public void visit(PrimitiveType n, A arg) {
}
开发者ID:rfw,项目名称:genja,代码行数:3,代码来源:VoidVisitorAdapter.java
示例12: visit
import japa.parser.ast.type.PrimitiveType; //导入依赖的package包/类
public Node visit(PrimitiveType n, A arg) {
return n;
}
开发者ID:rfw,项目名称:genja,代码行数:4,代码来源:ModifierVisitorAdapter.java
示例13: visit
import japa.parser.ast.type.PrimitiveType; //导入依赖的package包/类
@Override
public void visit(PrimitiveType n, Object arg) {
doTest(source, n);
super.visit(n, arg);
}
开发者ID:rfw,项目名称:genja,代码行数:6,代码来源:TestNodePositions.java
示例14: visitPre
import japa.parser.ast.type.PrimitiveType; //导入依赖的package包/类
@Override
public void visitPre(PrimitiveType n, A arg) {
}
开发者ID:kuali,项目名称:kc-rice,代码行数:5,代码来源:VoidVisitorHelperBase.java
示例15: visitPost
import japa.parser.ast.type.PrimitiveType; //导入依赖的package包/类
@Override
public void visitPost(PrimitiveType n, A arg) {
}
开发者ID:kuali,项目名称:kc-rice,代码行数:5,代码来源:VoidVisitorHelperBase.java
示例16: createReferenceType
import japa.parser.ast.type.PrimitiveType; //导入依赖的package包/类
/**
* Creates a new {@link ReferenceType} for the given primitive type.
*
* @param type
* primitive type
* @param arrayCount
* number os arrays or <code>0</code> if is not a array.
* @return instanceof {@link ReferenceType}
*/
public static ReferenceType createReferenceType(PrimitiveType type, int arrayCount) {
return new ReferenceType(type, arrayCount);
}
开发者ID:rfw,项目名称:genja,代码行数:13,代码来源:ASTHelper.java
示例17: visitPre
import japa.parser.ast.type.PrimitiveType; //导入依赖的package包/类
void visitPre(PrimitiveType n, A arg);
开发者ID:kuali,项目名称:kc-rice,代码行数:2,代码来源:VoidVisitorHelper.java
示例18: visitPost
import japa.parser.ast.type.PrimitiveType; //导入依赖的package包/类
void visitPost(PrimitiveType n, A arg);
开发者ID:kuali,项目名称:kc-rice,代码行数:2,代码来源:VoidVisitorHelper.java
示例19: visit
import japa.parser.ast.type.PrimitiveType; //导入依赖的package包/类
public R visit(PrimitiveType n, A arg);
开发者ID:rfw,项目名称:genja,代码行数:2,代码来源:GenericVisitor.java
示例20: visit
import japa.parser.ast.type.PrimitiveType; //导入依赖的package包/类
public void visit(PrimitiveType n, A arg);
开发者ID:rfw,项目名称:genja,代码行数:2,代码来源:VoidVisitor.java
注:本文中的japa.parser.ast.type.PrimitiveType类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论