You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by jm...@apache.org on 2001/10/04 03:12:34 UTC

cvs commit: jakarta-turbine-fulcrum/src/services/java/org/apache/fulcrum/intake/model Group.java

jmcnally    01/10/03 18:12:34

  Modified:    src/services/java/org/apache/fulcrum/intake/model Group.java
  Log:
  added method to allow partial setting of properties within a group.
  
  Revision  Changes    Path
  1.4       +31 -0     jakarta-turbine-fulcrum/src/services/java/org/apache/fulcrum/intake/model/Group.java
  
  Index: Group.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-fulcrum/src/services/java/org/apache/fulcrum/intake/model/Group.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Group.java	2001/08/30 05:23:57	1.3
  +++ Group.java	2001/10/04 01:12:34	1.4
  @@ -382,6 +382,37 @@
               cls = cls.getSuperclass();
           }
       }
  +    /**
  +     * Calls a setter methods on obj, for fields which pass validity tests.
  +     * In most cases one should call Intake.isAllValid() and then if that
  +     * test passes call setProperties.  Use this method when some data is 
  +     * known to be invalid, but you still want to set the object properties
  +     * that are valid.
  +     */
  +    public void setValidProperties(Object obj)
  +    {
  +        Class cls = obj.getClass();
  +        while ( cls != null )
  +        {
  +            Field[] flds = (Field[])mapToObjectFields.get(cls.getName());
  +            if ( flds != null )
  +            {
  +                for (int i=flds.length-1; i>=0; i--)
  +                {
  +                    try
  +                    {
  +                        flds[i].setProperty(obj);
  +                    }
  +                    catch(ServiceException e)
  +                    {
  +                        // just move on to next field
  +                    }
  +                }
  +            }
  +
  +            cls = cls.getSuperclass();
  +        }
  +    }
   
       /**
        * Calls getter methods on objects that are known to Intake
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org