Ejemplo n.º 1
0
  public static void DecreasePlaceHolder(Field field) {
    List<Attr> attrs = field.getAttrs();
    boolean isExists = false;
    for (int i = 0; i < attrs.size(); i++) {
      Attr attr = (Attr) attrs.get(i);
      if (!ConfigManager.PROPERTIES_PLACEHOLDER.equalsIgnoreCase(attr.getName())) {
        continue;
      }
      isExists = true;
      int len = Integer.parseInt(attr.getValue());
      if (1 == len) {
        break;
      }
      attr.setValue(String.valueOf(len - 1));
      field.setAttr(i, attr);
      return;
    }

    if (!isExists) {
      Attr attr = new Attr();
      attr.setName(ConfigManager.PROPERTIES_PLACEHOLDER);
      attr.setValue(String.valueOf(1));
      field.addAttr(attr);
    }
  }
Ejemplo n.º 2
0
 public static int getPlaceHolderAttrIndex(Field field) {
   List<Attr> list = field.getAttrs();
   if (list != null) {
     for (int i = 0; i < list.size(); i++) {
       Attr attr = (Attr) list.get(i);
       if (ConfigManager.PROPERTIES_PLACEHOLDER.equalsIgnoreCase(attr.getName())) {
         return i;
       }
     }
   }
   return -1;
 }