示例#1
0
 public String generateSource_GetElements(ModelField modelField) {
   Buf buf = new Buf();
   String structure = modelField.getStructure();
   if (structure.equals("map")) {
     String fieldType = modelField.getType();
     String fieldTypeLocalPart = TypeUtil.getLocalPart(fieldType);
     buf.putLine2("return getElements(" + fieldTypeLocalPart + "Keys);");
   }
   return buf.get();
 }
示例#2
0
  public String generateSource_GetAllElements(ModelField modelField) {
    Buf buf = new Buf();
    String structure = modelField.getStructure();
    if (structure.equals("list")) {

    } else if (structure.equals("set")) {

    } else if (structure.equals("map")) {
      buf.putLine2("return getElements();");
    }
    return buf.get();
  }
示例#3
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();
  }