Beispiel #1
0
  protected List<String> getFieldBinding(FieldConstraint f) {
    List<String> result = new ArrayList<String>();
    if (f instanceof SingleFieldConstraint) {
      SingleFieldConstraint con = (SingleFieldConstraint) f;
      if (con.isBound()) {
        result.add(con.getFieldBinding());
      }
      if (con.getExpressionValue() != null && con.getExpressionValue().isBound()) {
        result.add(con.getExpressionValue().getBinding());
      }
      if (con instanceof SingleFieldConstraintEBLeftSide) {
        SingleFieldConstraintEBLeftSide exp = (SingleFieldConstraintEBLeftSide) con;
        if (exp.getExpressionLeftSide() != null && exp.getExpressionLeftSide().isBound()) {
          result.add(exp.getExpressionLeftSide().getBinding());
        }
      }

    } else if (f instanceof CompositeFieldConstraint) {
      CompositeFieldConstraint cfc = (CompositeFieldConstraint) f;
      if (cfc.getConstraints() != null) {
        for (FieldConstraint ss : cfc.getConstraints()) {
          List<String> t = getFieldBinding(ss);
          result.addAll(t);
        }
      }
    }
    return result;
  }
Beispiel #2
0
 protected String getFieldBinding(FieldConstraint fc, String var) {
   String fieldType = null;
   if (fc instanceof SingleFieldConstraint) {
     SingleFieldConstraint s = (SingleFieldConstraint) fc;
     if (s.isBound() && var.equals(s.getFieldBinding())) {
       fieldType = s.getFieldType();
     }
   }
   if (fc instanceof SingleFieldConstraintEBLeftSide) {
     SingleFieldConstraintEBLeftSide s = (SingleFieldConstraintEBLeftSide) fc;
     if (s.isBound() && var.equals(s.getFieldBinding())) {
       fieldType = s.getExpressionLeftSide().getGenericType();
     }
   }
   if (fc instanceof CompositeFieldConstraint) {
     CompositeFieldConstraint s = (CompositeFieldConstraint) fc;
     if (s.getConstraints() != null) {
       for (FieldConstraint ss : s.getConstraints()) {
         fieldType = getFieldBinding(ss, var);
       }
     }
   }
   return fieldType;
 }