Exemplo n.º 1
0
 public String changePropertiesByCMPAttributes(String source) throws XavaException {
   StringBuffer r = new StringBuffer(source);
   int i = r.toString().indexOf("${");
   int f = 0;
   while (i >= 0) {
     f = r.toString().indexOf("}", i + 2);
     if (f < 0) break;
     String property = r.substring(i + 2, f);
     String cmpAttribute = null;
     if (property.indexOf('.') >= 0) {
       cmpAttribute = "o._" + Strings.firstUpper(Strings.change(property, ".", "_"));
     } else {
       MetaProperty metaProperty = getMetaModel().getMetaProperty(property);
       if (metaProperty.getMapping().hasConverter()) {
         cmpAttribute = "o._" + Strings.firstUpper(property);
       } else {
         cmpAttribute = "o." + property;
       }
     }
     r.replace(i, f + 1, cmpAttribute);
     i = r.toString().indexOf("${");
   }
   return r.toString();
 }