private MethodTree addBodyEvaluatorCheck(boolean evaluateBody, TreeMaker make) throws IOException { StringBuffer methodBody = new StringBuffer(); methodBody.append("{"); //NOI18N methodBody.append("\n // TODO: code that determines whether the body should be"); //NOI18N methodBody.append("\n // evaluated should be placed here."); //NOI18N methodBody.append("\n // Called from the doStartTag() method."); //NOI18N methodBody.append("\nreturn " + (evaluateBody ? "true;" : "false;")); //NOI18N methodBody.append("\n}"); //NOI18N MethodTree method = make.Method( make.Modifiers(Collections.<Modifier>singleton(Modifier.PRIVATE)), "theBodyShouldBeEvaluated", //NOI18N make.PrimitiveType(TypeKind.BOOLEAN), Collections.<TypeParameterTree>emptyList(), Collections.<VariableTree>emptyList(), Collections.<ExpressionTree>emptyList(), methodBody.toString(), null); //TODO: generate Javadoc return method; }
return make.PrimitiveType(primitiveTypeKind);
return getTreeMaker().PrimitiveType(primitiveTypeKind);
public static MethodTree createPropertySetterMethod(WorkingCopy wc, String name, Class type){ TreeMaker make = wc.getTreeMaker(); String argName = Naming.paramNames(new Class[] { type }, null)[0]; return make.Method( createModifiers(wc, Modifier.PUBLIC), Naming.setterName(name), make.PrimitiveType(TypeKind.VOID), Collections.<TypeParameterTree>emptyList(), Collections.singletonList(createVariable(wc, argName, type)), Collections.<ExpressionTree>emptyList(), "{ this." + name + " = " + argName + "; }", // NOI18N null); }
/** * Creates a new public property setter method. * * @param modifiersTree the method modifiers; cannot be null. * @param propertyType the property type; cannot be null. * @param propertyName the property name; cannot be null. * @return the new method; never null. */ public MethodTree createPropertySetterMethod(ModifiersTree modifiersTree, String propertyName, Tree propertyType) { Parameters.notNull("modifiersTree", modifiersTree); // NOI18N Parameters.javaIdentifier("propertyName", propertyName); // NOI18N Parameters.notNull("propertyType", propertyType); // NOI18N TreeMaker make = getTreeMaker(); return make.Method( modifiersTree, createPropertyAccessorName(propertyName, false), make.PrimitiveType(TypeKind.VOID), Collections.<TypeParameterTree>emptyList(), Collections.singletonList(createVariable(propertyName, propertyType)), Collections.<ExpressionTree>emptyList(), "{ this." + propertyName + " = " + propertyName + "; }", // NOI18N null); }
methodModifiers, action.getMethodName(), make.PrimitiveType(TypeKind.VOID), Collections.<TypeParameterTree>emptyList(), Collections.<VariableTree>emptyList(),
make.Modifiers(Collections.singleton(Modifier.PUBLIC), Collections.EMPTY_LIST), "set" + masterMethodSuffix, // NOI18N make.PrimitiveType(TypeKind.VOID), Collections.EMPTY_LIST, Collections.singletonList(par),
make.Modifiers(Collections.singleton(Modifier.PUBLIC), Collections.EMPTY_LIST), "set" + detailMethodSuffix, // NOI18N make.PrimitiveType(TypeKind.VOID), Collections.EMPTY_LIST, Collections.singletonList(par),
make.Modifiers(Modifier.PUBLIC, Collections.EMPTY_LIST), "addPropertyChangeListener", // NOI18N make.PrimitiveType(TypeKind.VOID), Collections.EMPTY_LIST, Collections.singletonList(par),
make.Modifiers(Modifier.PUBLIC, Collections.EMPTY_LIST), "removePropertyChangeListener", // NOI18N make.PrimitiveType(TypeKind.VOID), Collections.EMPTY_LIST, Collections.singletonList(par),
method.getModifiers(), method.getName(), make.PrimitiveType(TypeKind.VOID), method.getTypeParameters(), method.getParameters(),