use of japa.parser.ast.body.Parameter in project japid42 by branaway.
the class JavaSyntaxTool method paramsMatch.
protected static boolean paramsMatch(List<Parameter> params, List<Parameter> ps) {
if (params == ps)
return true;
if ((params == null && ps != null) || (params != null && ps == null))
return false;
if (params.size() != ps.size()) {
return false;
}
for (int i = 0; i < params.size(); i++) {
Parameter p1 = params.get(i);
Parameter p2 = ps.get(i);
if (!matchParams(p1, p2)) {
return false;
}
}
return true;
}
use of japa.parser.ast.body.Parameter in project japid42 by branaway.
the class JavaSyntaxTool method boxPrimitiveTypesInParams.
/**
* box all primitive type declarations in a parameter list
*
* @param paramline
* @return
*/
public static String boxPrimitiveTypesInParams(String paramline) {
if (paramline == null)
return null;
paramline = paramline.trim();
if (paramline.length() == 0)
return "";
List<Parameter> params = parseParams(paramline);
String s = "";
for (Parameter p : params) {
String decl = p.getType() + " " + p.getId().getName();
decl = cleanDeclPrimitive(decl);
s += decl + ", ";
}
return s.substring(0, s.lastIndexOf(", "));
}
use of japa.parser.ast.body.Parameter in project Japid by branaway.
the class JavaSyntaxTool method addFinalToAllParams.
/**
*
* @param params
* Type1 p1, Type2 p2...
* @return Final Type1 p1, final Type2 p2...
*/
public static String addFinalToAllParams(String paramline) {
if (paramline == null)
return null;
paramline = paramline.trim();
if (paramline.length() == 0)
return "";
List<Parameter> params = parseParams(paramline);
String s = "";
for (Parameter p : params) {
s += "final " + p.getType() + " " + p.getId().getName() + ", ";
}
return s.substring(0, s.lastIndexOf(", "));
}
use of japa.parser.ast.body.Parameter in project Japid by branaway.
the class JavaSyntaxTool method boxPrimitiveTypesInParams.
/**
* box all primitive type declarations in a parameter list
*
* @param paramline
* @return
*/
public static String boxPrimitiveTypesInParams(String paramline) {
if (paramline == null)
return null;
paramline = paramline.trim();
if (paramline.length() == 0)
return "";
List<Parameter> params = parseParams(paramline);
String s = "";
for (Parameter p : params) {
String decl = p.getType() + " " + p.getId().getName();
decl = cleanDeclPrimitive(decl);
s += decl + ", ";
}
return s.substring(0, s.lastIndexOf(", "));
}
use of japa.parser.ast.body.Parameter in project Japid by branaway.
the class LayoutClassMetaData method layoutMethod.
/**
*
*/
protected void layoutMethod() {
if (renderArgs != null) {
// create fields for the render args and create a render method to
List<Parameter> params = JavaSyntaxTool.parseParams(this.renderArgs);
String renderArgsWithoutAnnos = "";
for (Parameter p : params) {
renderArgsWithoutAnnos += p.getType() + " " + p.getId() + ",";
}
if (renderArgsWithoutAnnos.endsWith(",")) {
renderArgsWithoutAnnos = renderArgsWithoutAnnos.substring(0, renderArgsWithoutAnnos.length() - 1);
}
for (Parameter p : params) {
// pln(TAB + "private " + p.getType() + " " + p.getId() + ";");
addField(p);
}
pln("\t public void layout(" + renderArgsWithoutAnnos + ") {");
// assign the params to fields
for (Parameter p : params) {
pln("\t\tthis." + p.getId() + " = " + p.getId() + ";");
}
} else {
pln("\t@Override public void layout() {");
}
restOfBody();
}
Aggregations