All pastes #586125 Raw Edit

Unnamed

public java v1 · immutable
#586125 ·published 2007-06-23 17:36 UTC
rendered paste body
// Time to see if we have any associated objects.METHOD: for ( Method m : obj.getClass().getMethods() ){    if ( m.isAnnotationPresent( AssociatedObject.class ) )    {        // Yes, it is an associated object. Go us.        for ( Association a : m.getAnnotation( AssociatedObject.class ).value() )        {            if ( a == Association.DELETE )            {                // My oh my, it is also associated to this object's delete!                // If method returns an Iterable type, loop through each element.                //if ( Iterable.class.isInstance( m.getReturnType() ) )                try                {                    Iterable objs	= (Iterable) m.invoke( obj );                    if ( objs == null )                        continue METHOD;                                        for ( Object assocObj : objs )                    {                        deleteObject( assocObj );                    }                }                                catch ( ClassCastException ce )                {                    // Otherwise save the returned object directly                    deleteObject( m.invoke( obj ) );                }            } // end if a == ...        } // end for Association ...    } // end if m.isAnnotation...} // end for Method ...