public static JClass resolveType(JClassContainer _package, String typeDefinition) { try { FieldDeclaration fieldDeclaration = (FieldDeclaration) JavaParser.parseBodyDeclaration(typeDefinition + " foo;"); ClassOrInterfaceType c = (ClassOrInterfaceType) ((ReferenceType) fieldDeclaration.getType()).getType(); return buildClass(_package, c, 0); } catch (ParseException e) { throw new GenerationException("Couldn't parse type: " + typeDefinition, e); } }
public static boolean canFieldBeAnnotated(FieldDeclaration node) { final TypeDeclaration dclr = (TypeDeclaration) node.getParentNode(); if (!ModifierSet.isStatic(node.getModifiers()) && dclr.getParentNode() instanceof CompilationUnit) { //handling nested classes return true; } return false; }
public String getJavadoc() { JavadocComment javadoc = methodDeclaration.getJavaDoc(); if (javadoc != null) { return javadoc.getContent(); } return null; }
/** * Creates a new {@link Parameter}. * * @param type * type of the parameter * @param name * name of the parameter * @return instance of {@link Parameter} */ public static Parameter createParameter(Type type, String name) { return new Parameter(type, new VariableDeclaratorId(name)); }
public ClassOrInterfaceDeclaration(final int beginLine, final int beginColumn, final int endLine, final int endColumn, final int modifiers, final List<AnnotationExpr> annotations, final boolean isInterface, final String name, final List<TypeParameter> typeParameters, final List<ClassOrInterfaceType> extendsList, final List<ClassOrInterfaceType> implementsList, final List<BodyDeclaration> members) { super(beginLine, beginColumn, endLine, endColumn, annotations, modifiers, name, members); setInterface(isInterface); setTypeParameters(typeParameters); setExtends(extendsList); setImplements(implementsList); }
public boolean isPublic() { return ModifierSet.isPublic(methodDeclaration.getModifiers()); } }
public ConstructorDeclaration(int beginLine, int beginColumn, int endLine, int endColumn, int modifiers, List<AnnotationExpr> annotations, List<TypeParameter> typeParameters, String name, List<Parameter> parameters, List<NameExpr> throws_, BlockStmt block) { super(beginLine, beginColumn, endLine, endColumn, annotations); setModifiers(modifiers); setTypeParameters(typeParameters); setName(name); setParameters(parameters); setThrows(throws_); setBlock(block); }
public AnnotationMemberDeclaration(int modifiers, Type type, String name, Expression defaultValue) { setModifiers(modifiers); setType(type); setName(name); setDefaultValue(defaultValue); }
public TypeDeclaration(List<AnnotationExpr> annotations, int modifiers, String name, List<BodyDeclaration> members) { super(annotations); setName(name); setModifiers(modifiers); setMembers(members); }
public BaseParameter(int modifiers, List<AnnotationExpr> annotations, VariableDeclaratorId id) { setModifiers(modifiers); setAnnotations(annotations); setId(id); }
public EnumConstantDeclaration(int beginLine, int beginColumn, int endLine, int endColumn, List<AnnotationExpr> annotations, String name, List<Expression> args, List<BodyDeclaration> classBody) { super(beginLine, beginColumn, endLine, endColumn, annotations); setName(name); setArgs(args); setClassBody(classBody); }
public MethodDeclaration(final int modifiers, final Type type, final String name) { setModifiers(modifiers); setType(type); setName(name); }
public FieldDeclaration(int modifiers, List<AnnotationExpr> annotations, Type type, List<VariableDeclarator> variables) { super(annotations); setModifiers(modifiers); setType(type); setVariables(variables); }
public EnumDeclaration(int beginLine, int beginColumn, int endLine, int endColumn, int modifiers, List<AnnotationExpr> annotations, String name, List<ClassOrInterfaceType> implementsList, List<EnumConstantDeclaration> entries, List<BodyDeclaration> members) { super(beginLine, beginColumn, endLine, endColumn, annotations, modifiers, name, members); setImplements(implementsList); setEntries(entries); }
public Parameter(int beginLine, int beginColumn, int endLine, int endColumn, int modifiers, List<AnnotationExpr> annotations, Type type, boolean isVarArgs, VariableDeclaratorId id) { super(beginLine, beginColumn, endLine, endColumn, modifiers, annotations, id); setType(type); setVarArgs(isVarArgs); }
public final void setAnnotations(List<AnnotationExpr> annotations) { this.annotations = annotations; setAsParentNodeOf(this.annotations); } }
public AnnotationMemberDeclaration(int modifiers, List<AnnotationExpr> annotations, Type type, String name, Expression defaultValue) { super(annotations); setModifiers(modifiers); setType(type); setName(name); setDefaultValue(defaultValue); }
public TypeDeclaration(int beginLine, int beginColumn, int endLine, int endColumn, List<AnnotationExpr> annotations, int modifiers, String name, List<BodyDeclaration> members) { super(beginLine, beginColumn, endLine, endColumn, annotations); setName(name); setModifiers(modifiers); setMembers(members); }
public EnumDeclaration(int modifiers, List<AnnotationExpr> annotations, String name, List<ClassOrInterfaceType> implementsList, List<EnumConstantDeclaration> entries, List<BodyDeclaration> members) { super(annotations, modifiers, name, members); setImplements(implementsList); setEntries(entries); }