Пример #1
0
 public OJField findAttributeValue(String fieldName) {
   for (OJField f : this.attributeValues) {
     if (f.getName().equals(fieldName)) {
       return f;
     }
   }
   OJField value = new OJField();
   value.setName(fieldName);
   this.attributeValues.add(value);
   return value;
 }
Пример #2
0
 @Override
 public String toJavaString() {
   if (this.attributeValues.isEmpty()) {
     return getName();
   } else {
     StringBuilder sb = new StringBuilder(getName());
     sb.append('(');
     Iterator<OJField> iter = this.attributeValues.iterator();
     while (iter.hasNext()) {
       OJField a = iter.next();
       sb.append("/* " + a.getName() + " */ ");
       sb.append(a.getInitExp());
       if (iter.hasNext()) {
         sb.append(',');
       }
     }
     sb.append(')');
     return sb.toString();
   }
 }