1   /*
2    * Copyright (C) The MetaClass Group. All rights reserved.
3    *
4    * This software is published under the terms of the Spice
5    * Software License version 1.1, a copy of which has been included
6    * with this distribution in the LICENSE.txt file.
7    */
8   package org.codehaus.metaclass.tools.qdox;
9   
10  import com.thoughtworks.qdox.model.JavaClass;
11  import com.thoughtworks.qdox.model.JavaField;
12  import com.thoughtworks.qdox.model.JavaMethod;
13  import org.codehaus.metaclass.model.Attribute;
14  
15  /***
16   * @author Peter Donald
17   * @version $Revision: 1.4 $ $Date: 2003/11/28 11:14:55 $
18   */
19  class RewritingAttributeInterceptor
20      extends DefaultQDoxAttributeInterceptor
21  {
22      public Attribute processClassAttribute( final JavaClass clazz,
23                                              final Attribute attribute )
24      {
25          return processAttribute( attribute );
26      }
27  
28      public Attribute processFieldAttribute( final JavaField field,
29                                              final Attribute attribute )
30      {
31          return processAttribute( attribute );
32      }
33  
34      public Attribute processMethodAttribute( JavaMethod method,
35                                               Attribute attribute )
36      {
37          return processAttribute( attribute );
38      }
39  
40      private Attribute processAttribute( final Attribute attribute )
41      {
42          if( attribute.getName().startsWith( "rewriteme" ) )
43          {
44              return new Attribute( "rewritten" );
45          }
46          else
47          {
48              return attribute;
49          }
50      }
51  }