setLimit.setName("setLimit"); setLimit.addParameter(new Parameter(integerWrapper, "limit")); setLimit.addBodyLine("this.limit = limit;"); getLimit.setVisibility(JavaVisibility.PUBLIC); getLimit.setReturnType(integerWrapper); getLimit.setName("getLimit"); getLimit.addBodyLine("return limit;"); topLevelClass.addMethod(getLimit); setOffset.setName("setOffset"); setOffset.addParameter(new Parameter(integerWrapper, "offset")); setOffset.addBodyLine("this.offset = offset;"); getOffset.setVisibility(JavaVisibility.PUBLIC); getOffset.setReturnType(integerWrapper); getOffset.setName("getOffset"); getOffset.addBodyLine("return offset;"); topLevelClass.addMethod(getOffset);
setLimit.setName("setLimit"); setLimit.addParameter(new Parameter(integerWrapper, "limit")); setLimit.addBodyLine("this.limit = limit;"); getLimit.setVisibility(JavaVisibility.PUBLIC); getLimit.setReturnType(integerWrapper); getLimit.setName("getLimit"); getLimit.addBodyLine("return limit;"); topLevelClass.addMethod(getLimit); setOffset.setName("setOffset"); setOffset.addParameter(new Parameter(integerWrapper, "offset")); setOffset.addBodyLine("this.offset = offset;"); getOffset.setVisibility(JavaVisibility.PUBLIC); getOffset.setReturnType(integerWrapper); getOffset.setName("getOffset"); getOffset.addBodyLine("return offset;"); topLevelClass.addMethod(getOffset);
setLimit.setName("setLimit"); setLimit.addParameter(new Parameter(integerWrapper, "limit")); setLimit.addBodyLine("this.limit = limit;"); getLimit.setVisibility(JavaVisibility.PUBLIC); getLimit.setReturnType(integerWrapper); getLimit.setName("getLimit"); getLimit.addBodyLine("return limit;"); topLevelClass.addMethod(getLimit); setOffset.setName("setOffset"); setOffset.addParameter(new Parameter(integerWrapper, "offset")); setOffset.addBodyLine("this.offset = offset;"); getOffset.setVisibility(JavaVisibility.PUBLIC); getOffset.setReturnType(integerWrapper); getOffset.setName("getOffset"); getOffset.addBodyLine("return offset;"); topLevelClass.addMethod(getOffset);
Method defaultMethod = new Method(); defaultMethod.setStatic(true); defaultMethod.setName("defaultInstance"); defaultMethod.setVisibility(JavaVisibility.PUBLIC); defaultMethod.setReturnType(topLevelClass.getType());
Method defaultMethod = new Method(); defaultMethod.setStatic(true); defaultMethod.setName("defaultInstance"); defaultMethod.setVisibility(JavaVisibility.PUBLIC); defaultMethod.setReturnType(topLevelClass.getType());
m.setVisibility(JavaVisibility.PUBLIC); if (it.getName().endsWith("WithRowbounds")) { m.setName(it.getName().replace("WithRowbounds", "WithPage")); FullyQualifiedJavaType pageHandler = new FullyQualifiedJavaType("com.publiccms.common.handler.PageHandler"); m.setReturnType(pageHandler); m.addBodyLine("return page;"); } else { m.setName(it.getName()); m.setReturnType(it.getReturnType()); topLevelClazz.addImportedType(it.getReturnType());
public static Method makeGetterStringMethod(Context context, String fieldName, FullyQualifiedJavaType fieldType, String tableName) { String methodName = "get" + fieldName.substring(0, 1).toUpperCase() + fieldName.substring(1, fieldName.length()); Method method = new Method(); method.setName(methodName); method.setVisibility(JavaVisibility.PUBLIC); method.setReturnType(fieldType); method.addBodyLine("return this." + fieldName + ";"); addDoc(context, method, tableName); return method; }
public static Method makeSetterStringMethod(Context context, String fieldName, FullyQualifiedJavaType fieldType, String tableName) { String methodName = "set" + fieldName.substring(0, 1).toUpperCase() + fieldName.substring(1, fieldName.length()); Method method = new Method(); method.setName(methodName); method.setVisibility(JavaVisibility.PUBLIC); method.addParameter(new Parameter(fieldType, fieldName)); method.addBodyLine("this." + fieldName + " = " + fieldName + ";"); addDoc(context, method, tableName); return method; }
private Method makePartitionMethod(FullyQualifiedJavaType paramType, FullyQualifiedJavaType returnType, String fieldName, String tableName, String[] exp) { String methodName = PARTITION_FACTOR + fieldName.substring(0, 1).toUpperCase() + fieldName.substring(1, fieldName.length()); Method method = new Method(); method.setName(methodName); method.setVisibility(JavaVisibility.PUBLIC); method.setReturnType(returnType); method.addBodyLines(Arrays.asList(exp)); method.addParameter(new Parameter(paramType, fieldName)); PluginUtils.addDoc(this.getContext(), method, tableName); return method; }
public static Method getGetter(Field field) { Method method = new Method(); method.setName(getGetterMethodName(field.getName(), field.getType())); method.setReturnType(field.getType()); method.setVisibility(JavaVisibility.PUBLIC); StringBuilder sb = new StringBuilder(); sb.append("return "); //$NON-NLS-1$ sb.append(field.getName()); sb.append(';'); method.addBodyLine(sb.toString()); return method; }
public static Method getGetter(Field field) { Method method = new Method(); method.setName(getGetterMethodName(field.getName(), field .getType())); method.setReturnType(field.getType()); method.setVisibility(JavaVisibility.PUBLIC); StringBuilder sb = new StringBuilder(); sb.append("return "); //$NON-NLS-1$ sb.append(field.getName()); sb.append(';'); method.addBodyLine(sb.toString()); return method; }
protected void generateFluentGetterFor(String field, FullyQualifiedJavaType type, InnerClass innerClass) { Method method = new Method(); method.setVisibility(JavaVisibility.PUBLIC); method.setName(field); method.addBodyLine("return this." + field + ";"); method.setReturnType(type); innerClass.addMethod(method); }
protected void generateGetterFor(String field, FullyQualifiedJavaType type, InnerClass innerClass) { Method method = new Method(); method.setVisibility(JavaVisibility.PUBLIC); method.setName("get" + capitalize(field)); method.setReturnType(type); method.addBodyLine("return this." + field + ";"); innerClass.addMethod(method); }
protected void generateSetterFor(String field, FullyQualifiedJavaType type, InnerClass innerClass) { Method method = new Method(); method.setVisibility(JavaVisibility.PUBLIC); method.setName("set" + capitalize(field)); method.addParameter(new Parameter(type, field)); method.addBodyLine("this." + field + " = " + field + ";"); innerClass.addMethod(method); }
@Override public boolean clientGenerated(Interface interfaze, TopLevelClass topLevelClass, IntrospectedTable introspectedTable) { FullyQualifiedJavaType paramType = new FullyQualifiedJavaType(introspectedTable.getExampleType()); Method method = new Method(); method.setName("sumByExample"); method.setVisibility(JavaVisibility.PUBLIC); method.addParameter(new Parameter(paramType, "example")); method.setReturnType(LONG_TYPE); interfaze.addMethod(method); System.out.println("-----------------" + interfaze.getType().getShortName() + " add method sumByExample."); return true; }
protected Method getDefaultConstructor(TopLevelClass topLevelClass) { Method method = new Method(); method.setVisibility(JavaVisibility.PUBLIC); method.setConstructor(true); method.setName(topLevelClass.getType().getShortName()); method.addBodyLine("super();"); //$NON-NLS-1$ context.getCommentGenerator().addGeneralMethodComment(method, introspectedTable); return method; } }
protected void addDefaultConstructor(TopLevelClass topLevelClass) { Method method = new Method(); method.setVisibility(JavaVisibility.PUBLIC); method.setConstructor(true); method.setName(topLevelClass.getType().getShortName()); method.addBodyLine("super();"); //$NON-NLS-1$ context.getCommentGenerator().addGeneralMethodComment(method, introspectedTable); topLevelClass.addMethod(method); } }
protected void generateFluentSetterFor(String field, FullyQualifiedJavaType type, InnerClass innerClass) { Method method = new Method(); method.setVisibility(JavaVisibility.PUBLIC); method.setName(field); method.addParameter(new Parameter(type, field)); method.addBodyLine("this." + field + " = " + field + ";"); method.addBodyLine("return this;"); method.setReturnType(innerClass.getType()); innerClass.addMethod(method); }
protected void addDefaultConstructor(TopLevelClass topLevelClass) { Method method = new Method(); method.setVisibility(JavaVisibility.PUBLIC); method.setConstructor(true); method.setName(topLevelClass.getType().getShortName()); method.addBodyLine("super();"); //$NON-NLS-1$ context.getCommentGenerator().addGeneralMethodComment(method, introspectedTable); topLevelClass.addMethod(method); } }
protected void addDefaultConstructor(TopLevelClass topLevelClass) { Method method = new Method(); method.setVisibility(JavaVisibility.PUBLIC); method.setConstructor(true); method.setName(topLevelClass.getType().getShortName()); method.addBodyLine("super();"); //$NON-NLS-1$ context.getCommentGenerator().addGeneralMethodComment(method, introspectedTable); topLevelClass.addMethod(method); } }