001// Copyright 2005 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 015package org.apache.tapestry.annotations; 016 017import java.lang.reflect.Method; 018 019import org.apache.hivemind.Resource; 020import org.apache.tapestry.enhance.EnhancementOperation; 021import org.apache.tapestry.spec.IComponentSpecification; 022 023/** 024 * A chain-of-command interface for secondary annotation workers; workers that must execute 025 * <em>after</em> other workers. 026 * 027 * @author Howard M. Lewis Ship 028 */ 029public interface SecondaryAnnotationWorker 030{ 031 /** 032 * Sees if the particular worker can process the method (because it handles an annotation 033 * associated with the method). 034 * 035 * @param method 036 * to check 037 * @return true if the worker should be invoked, false otherwise 038 */ 039 public boolean canEnhance(Method method); 040 041 /** 042 * Invoked an <em>all</em> workers in the command chain, if <em>any</em> worker returns true 043 * from {@link #canEnhance(Method)}. 044 * 045 * @param op 046 * enhancement operation 047 * @param spec 048 * specification for the component being enhanced 049 * @param method 050 * the method 051 * @param classResource 052 * a resource representing the class; combined with the method a 053 * {@link org.apache.hivemind.Location} can be created 054 */ 055 public void peformEnhancement(EnhancementOperation op, IComponentSpecification spec, 056 Method method, Resource classResource); 057}