@@ -0,0 +1,1627 @@
+/*%0A * Copyright (c) 2012 Mateusz Parzonka, Eric Bodden%0A * All rights reserved. This program and the accompanying materials%0A * are made available under the terms of the Eclipse Public License v1.0%0A * which accompanies this distribution, and is available at%0A * http://www.eclipse.org/legal/epl-v10.html%0A *%0A * Contributors:%0A * Mateusz Parzonka - initial API and implementation%0A */%0Apackage prm4j.api;%0A%0Apublic abstract class MatchHandler %7B%0A%0A    /**%0A     * Retrieve bound objects with getBoundObject(...) TODO doc method.%0A     *%0A     * @param bindings%0A     */%0A    public abstract void handleMatch(IBinding%5B%5D bindings);%0A%0A    /**%0A     * Retrieves the object which was stored in the monitor bindings. The object may be %3Ccode%3Enull%3C/code%3E if selected%0A     * object was already garbage collected in the monitored application.%0A     *%0A     * @param param%0A     *            selects the object from the bindings%0A     * @param bindings%0A     *            current bindings when the match was completed%0A     * @return the object which was bound to the given parameter. %3Ccode%3Enull%3C/code%3E, if the object was already garbage%0A     *         collected.%0A     */%0A    protected %3CP%3E P getBoundObject(Parameter%3CP%3E param, IBinding%5B%5D bindings) %7B%0A%09// matches are rare, so we simply search the bindings linearly%0A%09for (IBinding binding : bindings) %7B%0A%09    if (binding != null && binding.getParameterId() == param.getParameterId()) %7B%0A%09%09@SuppressWarnings(%22unchecked%22)%0A%09%09P boundObject = (P) binding.get();%0A%09%09return boundObject;%0A%09    %7D%0A%09%7D%0A%09throw new IllegalArgumentException(%22Bound object for parameter %5B%22%0A%09%09+ %22%5D coult not be retrieved from the bindings!%22);%0A    %7D%0A%0A%7D%0A

Add base class for handling matches