    001    // Copyright 2011 The Apache Software Foundation
    002    //
    003    // Licensed under the Apache License, Version 2.0 (the "License");
    004    // you may not use this file except in compliance with the License.
    005    // You may obtain a copy of the License at
    006    //
    007    // http://www.apache.org/licenses/LICENSE-2.0
    008    //
    009    // Unless required by applicable law or agreed to in writing, software
    010    // distributed under the License is distributed on an "AS IS" BASIS,
    011    // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    012    // See the License for the specific language governing permissions and
    013    // limitations under the License.
    014
    015    package org.apache.tapestry5.services.transform;
    016
    017    import org.apache.tapestry5.plastic.PlasticClass;
    018    import org.apache.tapestry5.services.ComponentEventHandler;
    019
    020    /**
    021     * Additional utilities, beyond {@link PlasticClass}, needed when transforming.
    022     *
    023     * @since 5.3
    024     */
    025    public interface TransformationSupport
    026    {
    027        /**
    028         * @param typeName Java type name (which may be a primitive type or array, or fully qualified class name)
    029         * @return corresponding Java Class
    030         */
    031        Class toClass(String typeName);
    032
    033        /**
    034         * Returns true if the class being transformed is a root class: it does not inherit
    035         * from another transformed class, but instead inherits from Object.
    036         *
    037         * @return true if root
    038         */
    039        boolean isRootTransformation();
    040
    041        /**
    042         * Adds an event handler. Added event handlers execute <em>before</em> calls to super-class event handlers,
    043         * or calls to event handler methods.
    044         *
    045         * @param eventType            type of event
    046         * @param minContextValues     number of context values required to activate the handler
    047         * @param operationDescription Used with {@link org.apache.tapestry5.ioc.OperationTracker} when invoking the handler
    048         * @param handler              code to execute when the event matches
    049         */
    050        void addEventHandler(String eventType, int minContextValues, String operationDescription, ComponentEventHandler handler);
    051
    052    }