本文整理汇总了Java中japa.parser.ast.type.VoidType类的典型用法代码示例。如果您正苦于以下问题:Java VoidType类的具体用法?Java VoidType怎么用?Java VoidType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VoidType类属于japa.parser.ast.type包,在下文中一共展示了VoidType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getRawTypeName
import japa.parser.ast.type.VoidType; //导入依赖的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();
}
示例2: isSetterMethod
import japa.parser.ast.type.VoidType; //导入依赖的package包/类
private boolean isSetterMethod(MethodDeclaration method)
{
if ((method.getBody() != null) && (method.getBody().getStmts() != null))
{
LinkedList<String> attNames = getAttributesNames();
if (attNames.size() == 0)
return false;
List<Statement> stmts = method.getBody().getStmts();
for (Statement stmt : stmts)
for (String name : attNames)
if ((method.getModifiers() == ModifierSet.PUBLIC) && (method.getParameters() != null) && (method.getParameters().size() == 1) && (method.getType().equals(new VoidType())) && (stmt.toString().matches("(.*)"+name+"(\\s*)=(.*)"+method.getParameters().get(0).getId().getName()+"(.*);")))
return true;
}
return false;
}
示例3: addAttachSkeleton
import japa.parser.ast.type.VoidType; //导入依赖的package包/类
private void addAttachSkeleton() {
List<Parameter> params = Collections.emptyList();
MethodDeclaration method = new MethodDeclaration(
ModifierSet.PUBLIC, new VoidType(), "attach", params);
AnnotationExpr override = new MarkerAnnotationExpr(new NameExpr("Override"));
method.setAnnotations(Collections.singletonList(override));
BlockStmt block = new BlockStmt();
Expression e = new MethodCallExpr(new SuperExpr(), "attach");
List<Statement> sts = Collections.singletonList((Statement)new ExpressionStmt(e));
block.setStmts(sts);
method.setBody(block);
if (getType().getMembers()==null) {
getType().setMembers(new LinkedList<BodyDeclaration>());
}
getType().getMembers().add(method);
}
示例4: addOnBecomingVisibleMethod
import japa.parser.ast.type.VoidType; //导入依赖的package包/类
@SuppressWarnings("unused")
private void addOnBecomingVisibleMethod() {
List<Parameter> params = Collections.emptyList();
MethodDeclaration method = new MethodDeclaration(
ModifierSet.PUBLIC, new VoidType(), "onBecomingVisible", params);
AnnotationExpr override = new MarkerAnnotationExpr(new NameExpr("Override"));
method.setAnnotations(Collections.singletonList(override));
BlockStmt block = new BlockStmt();
Expression e = new MethodCallExpr(new SuperExpr(), "onBecomingVisible");
List<Statement> sts = Collections.singletonList((Statement)new ExpressionStmt(e));
block.setStmts(sts);
method.setBody(block);
if (getType().getMembers()==null) {
getType().setMembers(new LinkedList<BodyDeclaration>());
}
getType().getMembers().add(method);
}
示例5: addClaraHandler
import japa.parser.ast.type.VoidType; //导入依赖的package包/类
private MethodDeclaration addClaraHandler(String id, String className) {
ensureImport(className);
String shortName = className.substring(className.lastIndexOf(".")+1);
String handlerName = generateHandlerNameFor(id, shortName);
Parameter p = new Parameter(new ClassOrInterfaceType(shortName), new VariableDeclaratorId("event"));
MethodDeclaration handler = new MethodDeclaration(
ModifierSet.PUBLIC, new VoidType(), handlerName, Collections.singletonList(p));
handler.setBody(new BlockStmt());
handler.setAnnotations(createClaraHandlerAnnotations(id));
addNotification(handler, shortName+" on "+id);
addMember(handler);
return handler;
}
示例6: getType
import japa.parser.ast.type.VoidType; //导入依赖的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);
}
示例7: visit
import japa.parser.ast.type.VoidType; //导入依赖的package包/类
@Override
public JType visit(VoidType type, JCodeModel codeModel) {
return codeModel.VOID;
}
示例8: visit
import japa.parser.ast.type.VoidType; //导入依赖的package包/类
@Override
public void visit(VoidType n, Generator arg) {
throw new TransformException("don't know how to linearize");
}
示例9: visit
import japa.parser.ast.type.VoidType; //导入依赖的package包/类
@Override
public Boolean visit(VoidType n, Void arg) {
return false;
}
示例10: visit
import japa.parser.ast.type.VoidType; //导入依赖的package包/类
@Override
public void visit(VoidType n, Scope arg) {
super.visit(n, arg);
n.setData(arg);
}
示例11: visit
import japa.parser.ast.type.VoidType; //导入依赖的package包/类
public R visit(VoidType n, A arg) {
return null;
}
示例12: visit
import japa.parser.ast.type.VoidType; //导入依赖的package包/类
public Boolean visit(VoidType n1, Node arg) {
return Boolean.TRUE;
}
示例13: visit
import japa.parser.ast.type.VoidType; //导入依赖的package包/类
public void visit(VoidType n, Object arg) {
printer.print("void");
}
示例14: visit
import japa.parser.ast.type.VoidType; //导入依赖的package包/类
public void visit(VoidType n, A arg) {
}
示例15: visit
import japa.parser.ast.type.VoidType; //导入依赖的package包/类
public Node visit(VoidType n, A arg) {
return n;
}