/** Create a variable definition from a variable symbol and an initializer * expression. */ public JCVariableDecl VarDef(VarSymbol v, JCExpression init) { return (JCVariableDecl) new JCVariableDecl( Modifiers(v.flags(), Annotations(v.getRawAttributes())), v.name, Type(v.type), init, v).setPos(pos).setType(v.type); }
/** Create a variable definition from a variable symbol and an initializer * expression. */ public JCVariableDecl VarDef(VarSymbol v, JCExpression init) { return (JCVariableDecl) new JCVariableDecl( Modifiers(v.flags(), Annotations(v.getAnnotationMirrors())), v.name, Type(v.type), init, v).setPos(pos).setType(v.type); }
/** Create a variable definition from a variable symbol and an initializer * expression. */ public JCVariableDecl VarDef(VarSymbol v, JCExpression init) { return (JCVariableDecl) new JCVariableDecl( Modifiers(v.flags(), Annotations(v.getRawAttributes())), v.name, Type(v.type), init, v).setPos(pos).setType(v.type); }
/** Create a variable definition from a variable symbol and an initializer * expression. */ public JCVariableDecl VarDef(VarSymbol v, JCExpression init) { return (JCVariableDecl) new JCVariableDecl( Modifiers(v.flags(), Annotations(v.getAnnotationMirrors())), v.name, Type(v.type), init, v).setPos(pos).setType(v.type); }
@Override public void visitClassDef(JCTree.JCClassDecl classDef) { super.visitClassDef(classDef); Name name = (Name) processingEnv.getElementUtils().getName(CURRENT_SCOPE_FIELD_NAME); if (!containsField(classDef, name)) { Type webElementType = getType(WebElement.class); Type currentScopeType = getType(CurrentScope.class); Type googleInjectType = getType(Inject.class); Compound currentScopeCompund = new Compound(currentScopeType, List.nil()); Compound injectCompound = new Compound(googleInjectType, List.nil()); List<JCAnnotation> annotations = treeMaker. Annotations(List.of(currentScopeCompund, injectCompound)); JCModifiers jcModifiers = treeMaker.Modifiers(Flags.PRIVATE, annotations); addFieldToClass(jcModifiers, name, webElementType, classDef); } }
/** Create a method definition from a method symbol, method type * and a method body. */ public JCMethodDecl MethodDef(MethodSymbol m, Type mtype, JCBlock body) { return (JCMethodDecl) new JCMethodDecl( Modifiers(m.flags(), Annotations(m.getAnnotationMirrors())), m.name, Type(mtype.getReturnType()), TypeParams(mtype.getTypeArguments()), Params(mtype.getParameterTypes(), m), Types(mtype.getThrownTypes()), body, null, m).setPos(pos).setType(mtype); }
/** Create a method definition from a method symbol, method type * and a method body. */ public JCMethodDecl MethodDef(MethodSymbol m, Type mtype, JCBlock body) { return (JCMethodDecl) new JCMethodDecl( Modifiers(m.flags(), Annotations(m.getAnnotationMirrors())), m.name, Type(mtype.getReturnType()), TypeParams(mtype.getTypeArguments()), Params(mtype.getParameterTypes(), m), Types(mtype.getThrownTypes()), body, null, m).setPos(pos).setType(mtype); }
/** Create a method definition from a method symbol, method type * and a method body. */ public JCMethodDecl MethodDef(MethodSymbol m, Type mtype, JCBlock body) { return (JCMethodDecl) new JCMethodDecl( Modifiers(m.flags(), Annotations(m.getRawAttributes())), m.name, Type(mtype.getReturnType()), TypeParams(mtype.getTypeArguments()), null, // receiver type Params(mtype.getParameterTypes(), m), Types(mtype.getThrownTypes()), body, null, m).setPos(pos).setType(mtype); }
/** Create a method definition from a method symbol, method type * and a method body. */ public JCMethodDecl MethodDef(MethodSymbol m, Type mtype, JCBlock body) { return (JCMethodDecl) new JCMethodDecl( Modifiers(m.flags(), Annotations(m.getRawAttributes())), m.name, Type(mtype.getReturnType()), TypeParams(mtype.getTypeArguments()), null, // receiver type Params(mtype.getParameterTypes(), m), Types(mtype.getThrownTypes()), body, null, m).setPos(pos).setType(mtype); }