@SuppressWarnings("unchecked")
    public static <M extends Enum<M>> void attach(Service service, String milestore, ServiceMilestone.Evaluation evaluation) throws Exception {
        for (Field field: Beans.getKnownInstanceFields(service.getClass())) {
            if (ServiceMilestone.class.isAssignableFrom(field.getType())) {
                try {
        ((ServiceMilestone<M>)field.get(service)).attach(Enum.valueOf((Class<M>)getMilestoneEnum(field.getDeclaringClass()), milestore), evaluation);
                    return;
                } catch (ClassNotFoundException x) { // No Milestone enum class found
                    // keep looking
                } catch (IllegalArgumentException x) { // No enum constant as named
                    // keep looking
                }
            }
        }
        throw new IllegalArgumentException("NoSuchMilestone");
    }
@ SuppressWarnings ( "unchecked" ) public static < M extends Enum < M > > void attach ( Service service , String milestore , ServiceMilestone . Evaluation evaluation ) throws Exception { for ( Field field : Beans . getKnownInstanceFields ( service . getClass ( ) ) ) { if ( ServiceMilestone . class . isAssignableFrom ( field . getType ( ) ) ) { try { ( ( ServiceMilestone < M > ) field . get ( service ) ) . attach ( Enum . valueOf ( ( Class < M > ) getMilestoneEnum ( field . getDeclaringClass ( ) ) , milestore ) , evaluation ) ; return ; } catch ( ClassNotFoundException x ) { } catch ( IllegalArgumentException x ) { } } } throw new IllegalArgumentException ( "NoSuchMilestone" ) ; }
Attaches a ServiceMilestone.Evaluation onto a service.