View Javadoc

1   // ========================================================================
2   // Copyright (c) 2009-2010 Mort Bay Consulting Pty. Ltd.
3   // ------------------------------------------------------------------------
4   // All rights reserved. This program and the accompanying materials
5   // are made available under the terms of the Eclipse Public License v1.0
6   // and Apache License v2.0 which accompanies this distribution.
7   // The Eclipse Public License is available at 
8   // http://www.eclipse.org/legal/epl-v10.html
9   // The Apache License v2.0 is available at
10  // http://www.opensource.org/licenses/apache2.0.php
11  // You may elect to redistribute this code under either of these licenses. 
12  // ========================================================================
13  package org.eclipse.jetty.annotations;
14  
15  import java.util.List;
16  
17  import org.eclipse.jetty.annotations.AnnotationParser.Value;
18  import org.eclipse.jetty.util.log.Log;
19  import org.eclipse.jetty.util.log.Logger;
20  import org.eclipse.jetty.webapp.WebAppContext;
21  
22  public class WebListenerAnnotationHandler extends AbstractDiscoverableAnnotationHandler
23  {
24      private static final Logger LOG = Log.getLogger(WebListenerAnnotationHandler.class);
25  
26      public WebListenerAnnotationHandler (WebAppContext context)
27      {
28         super(context);
29      }
30      
31      /** 
32       * @see org.eclipse.jetty.annotations.AnnotationParser.DiscoverableAnnotationHandler#handleClass(java.lang.String, int, int, java.lang.String, java.lang.String, java.lang.String[], java.lang.String, java.util.List)
33       */
34      public void handleClass(String className, int version, int access, String signature, String superName, String[] interfaces, String annotation,
35                              List<Value> values)
36      {
37          WebListenerAnnotation wlAnnotation = new WebListenerAnnotation(_context, className);
38          addAnnotation(wlAnnotation);
39      }
40  
41      public void handleField(String className, String fieldName, int access, String fieldType, String signature, Object value, String annotation,
42                              List<Value> values)
43      {
44          LOG.warn ("@WebListener is not applicable to fields: "+className+"."+fieldName);
45      }
46  
47      public void handleMethod(String className, String methodName, int access, String params, String signature, String[] exceptions, String annotation,
48                               List<Value> values)
49      {
50          LOG.warn ("@WebListener is not applicable to methods: "+className+"."+methodName+" "+signature);
51      }
52  
53  }