View Javadoc

1   /***************************************************************************************
2    * Copyright (c) Jonas Bonér, Alexandre Vasseur. All rights reserved.                 *
3    * http://aspectwerkz.codehaus.org                                                    *
4    * ---------------------------------------------------------------------------------- *
5    * The software in this package is published under the terms of the LGPL license      *
6    * a copy of which has been included with this distribution in the license.txt file.  *
7    **************************************************************************************/
8   package org.codehaus.aspectwerkz.annotation;
9   
10  /***
11   * A custom annotation-like to host AnnotationDefault attribute that host annotation defaulted values
12   *
13   * Note: Java 5 does not handles this as an annotation but as an attribute so this information
14   * will be visible in ASMClassInfo as an annotation but it is not a real one (fe won't extend Java 5 Annotation etc)
15   *
16   * @author <a href="mailto:alex AT gnilux DOT com">Alexandre Vasseur</a>
17   */
18  public interface AnnotationDefault {
19  
20      public final static String NAME = AnnotationDefault.class.getName().replace('/', '.');
21  
22      /***
23       * The default value of the annotation element marked with the AnnotationDefault attribute
24       * Note: for Class it will be an instance of asm.Type
25       *
26       * @return
27       */
28      public Object value();
29  
30      /***
31       * Annotation implementation, since we will not use our Java 5 dynamic proxy based architecture for it
32       *
33       * @author <a href="mailto:alex AT gnilux DOT com">Alexandre Vasseur</a>
34       */
35      static class AnnotationDefaultImpl implements AnnotationDefault, Annotation {
36          private final Object m_value;
37  
38          public AnnotationDefaultImpl(Object value) {
39              m_value = value;
40          }
41  
42          public Object value() {
43              return m_value;
44          }
45  
46          public Class annotationType() {
47              return AnnotationDefault.class;
48          }
49      }
50  }