Esempio n. 1
0
  public String generateSource_AddElements(ModelField modelField) {
    String fieldNameCapped = NameUtil.capName(modelField.getName());
    String fieldNameUncapped = NameUtil.uncapName(modelField.getName());
    String fieldClassName = TypeUtil.getClassName(modelField.getType());
    String fieldTypeLocalPart = TypeUtil.getLocalPart(modelField.getType());

    Buf buf = new Buf();
    buf.putLine2("putElements(" + fieldTypeLocalPart + "Map);");
    return buf.get();
  }
Esempio n. 2
0
  public String generateSource_SetElement(ModelField modelField) {
    String fieldNameCapped = NameUtil.capName(modelField.getName());
    String fieldNameUncapped = NameUtil.uncapName(modelField.getName());
    String fieldClassName = TypeUtil.getClassName(modelField.getType());
    String fieldTypeLocalPart = TypeUtil.getLocalPart(modelField.getType());

    Buf buf = new Buf();
    // buf.putLine2("synchronized (this."+fieldNameUncapped+") {");
    buf.putLine2("this." + fieldNameUncapped + " = " + fieldTypeLocalPart + ";");
    // buf.putLine2("}");
    return buf.get();
  }
Esempio n. 3
0
  public String generateSource_PutElements(ModelField modelField) {
    String fieldName = modelField.getName();
    String fieldType = modelField.getType();
    String fieldTypeLocalPart = TypeUtil.getLocalPart(fieldType);

    Buf buf = new Buf();
    buf.putLine2("putElements(" + fieldTypeLocalPart + "Map);");
    return buf.get();
  }
Esempio n. 4
0
  public String generateSource_RemoveElements(ModelField modelField) {
    String fieldNameCapped = NameUtil.capName(modelField.getName());
    String fieldNameUncapped = NameUtil.uncapName(modelField.getName());
    String fieldClassName = TypeUtil.getClassName(modelField.getType());
    String fieldTypeLocalPart = TypeUtil.getLocalPart(modelField.getType());
    String parameterName = fieldTypeLocalPart;

    String structure = modelField.getStructure();
    if (structure.equals("list")) {
      parameterName = fieldTypeLocalPart + "List";

    } else if (structure.equals("set")) {
      parameterName = fieldTypeLocalPart + "Set";

    } else if (structure.equals("map")) {
      parameterName = fieldTypeLocalPart + "Map";
    }

    Buf buf = new Buf();
    buf.putLine2("synchronized (" + fieldNameUncapped + ") {");
    buf.putLine2("	" + fieldNameUncapped + ".removeAll(" + parameterName + ");");
    buf.putLine2("}");
    return buf.get();
  }