Exemplo n.º 1
0
 public void appendGetterSetter(StringBuffer buf, String additional) throws CodeGenException {
   String cName = getClassDeclaration(jrfColumnClassName, usePrimitives);
   String objName = (String) super.transientKeys.get("objectName");
   String description = getDescription();
   String localAdditional;
   if (isPrimaryKey()) localAdditional = "     markNewPersistentState();\n";
   else localAdditional = "     markModifiedPersistentState();\n";
   if (additional != null) localAdditional = localAdditional + additional;
   CodeGenUtil.appendSetter(description, objName, fieldName, cName, null, localAdditional, buf);
   CodeGenUtil.appendGetter(description, objName, fieldName, cName, null, buf);
 }
Exemplo n.º 2
0
 public String getColumnSpecDeclare(String entity, boolean respectCompoundKey)
     throws CodeGenException {
   super.transientKeys.put("numeric", "");
   super.transientKeys.put("text", "");
   if (type == T_NUMERIC) {
     String scale = (String) super.transientKeys.get("scale");
     if (!scale.equals("0")) {
       super.transientKeys.put(
           "numeric",
           "       colVar.setPrecision("
               + super.transientKeys.get("precision")
               + ");\n"
               + "       colVar.setScale("
               + super.transientKeys.get("scale")
               + ");\n");
     }
   } else if (type == T_TEXT) {
     super.transientKeys.put(
         "text", "       colVar.setMaxLength(" + super.transientKeys.get("size") + ");\n");
   }
   super.transientKeys.put("colOption", getColumnOption(respectCompoundKey));
   super.transientKeys.put("getterSetter", getterSetter);
   super.transientKeys.put("entity", entity);
   return CodeGenUtil.generateFromTemplate(
       CodeGenUtil.TEMPLATE_TAG_BEGIN,
       CodeGenUtil.TEMPLATE_TAG_END,
       specCreateTemplateBase,
       super.transientKeys);
 }
Exemplo n.º 3
0
 private static String getClassDeclaration(String jrfColumnClassName, boolean usePrimitives) {
   String result = CodeGenUtil.getClassDeclarationValue(jrfColumnClassName);
   if (usePrimitives) { // Translate things like java.util.Long to long, if required.
     return JRFGeneratorUtil.translateWrapper(result);
   }
   return result;
 }