View Javadoc

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.introspector;
9   
10  import org.codehaus.metaclass.model.ClassDescriptor;
11  
12  /***
13   * This Accessor implementation will wrap another MetaClassAccessor.
14   * The purpose of the wrapping is to make it impossible for users to
15   * get to the underlying accessor implementation.
16   *
17   * @author Peter Donald
18   * @version $Revision: 1.4 $ $Date: 2003/11/27 08:09:53 $
19   */
20  public class WrapperMetaClassAccessor
21      implements MetaClassAccessor
22  {
23      /***
24       * The underlying MetaClassAccessor.
25       */
26      private final MetaClassAccessor m_accessor;
27  
28      /***
29       * Create an accessor for specified accessor.
30       *
31       * @param accessor the accessor
32       */
33      public WrapperMetaClassAccessor( final MetaClassAccessor accessor )
34      {
35          if( null == accessor )
36          {
37              throw new NullPointerException( "accessor" );
38          }
39          m_accessor = accessor;
40      }
41  
42      /***
43       * @see MetaClassAccessor#getClassDescriptor
44       */
45      public synchronized ClassDescriptor getClassDescriptor( final String classname,
46                                                              final ClassLoader classLoader,
47                                                              final MetaClassAccessor accessor )
48          throws MetaClassException
49      {
50          return m_accessor.getClassDescriptor( classname, classLoader, accessor );
51      }
52  }