use of com.cubrid.cubridmanager.core.cubrid.table.model.POJOAttribute in project cubrid-manager by CUBRID.
the class JavaType method getPhpPOJOString.
/**
* Get the PHP POJO content string
*
* @param template
* @return String - The POJO String
*/
private static String getPhpPOJOString(POJOTemplate template) {
StringBuffer sb = new StringBuffer();
sb.append("<?php").append(NEW_LINE).append(NEW_LINE);
sb.append("/*").append(NEW_LINE);
sb.append(getCRUDQuery(template));
sb.append("*/").append(NEW_LINE);
/* Type declare */
if (StringUtil.isNotEmpty(template.getAnnotation())) {
sb.append(template.getAnnotation() + NEW_LINE);
}
sb.append(template.getTypeDeclare() + " {" + NEW_LINE);
/* Attribute */
for (POJOAttribute attribute : template.getAttributes()) {
if (StringUtil.isNotEmpty(attribute.getAnnotation())) {
sb.append(ONE_INDENTATION + attribute.getAnnotation() + NEW_LINE);
}
sb.append(ONE_INDENTATION + "private $" + attribute.getJavaName());
sb.append(SEMICOLON + NEW_LINE);
}
sb.append(NEW_LINE);
/* Get and Set method */
for (POJOAttribute attribute : template.getAttributes()) {
/* Get method */
if (StringUtil.isNotEmpty(attribute.getGetAnnotation())) {
sb.append(attribute.getGetAnnotation() + NEW_LINE);
}
sb.append(attribute.getGetMethod() + NEW_LINE);
/* Set method */
if (StringUtil.isNotEmpty(attribute.getSetAnnotation())) {
sb.append(attribute.getSetAnnotation() + NEW_LINE);
}
sb.append(attribute.getSetMethod() + NEW_LINE);
}
sb.append("}" + NEW_LINE);
sb.append("?>");
return sb.toString();
}
Aggregations