1 15 package org.apache.tapestry.annotations; 16 17 import java.lang.reflect.Method ; 18 19 import org.apache.hivemind.Location; 20 import org.apache.tapestry.engine.state.ApplicationStateManager; 21 import org.apache.tapestry.enhance.EnhancementOperation; 22 import org.apache.tapestry.enhance.InjectStateWorker; 23 import org.apache.tapestry.spec.IComponentSpecification; 24 25 33 public class InjectStateAnnotationWorker implements MethodAnnotationEnhancementWorker 34 { 35 final InjectStateWorker _delegate; 36 37 InjectStateAnnotationWorker(InjectStateWorker delegate) 38 { 39 _delegate = delegate; 40 } 41 42 public InjectStateAnnotationWorker() 43 { 44 this(new InjectStateWorker()); 45 } 46 47 public void performEnhancement(EnhancementOperation op, IComponentSpecification spec, 48 Method method, Location location) 49 { 50 InjectState is = method.getAnnotation(InjectState.class); 51 52 String propertyName = AnnotationUtils.getPropertyName(method); 53 54 _delegate.injectState(op, is.value(), propertyName); 55 } 56 57 public void setApplicationStateManager(ApplicationStateManager applicationStateManager) 58 { 59 _delegate.setApplicationStateManager(applicationStateManager); 60 } 61 } 62 | Popular Tags |