[jboss-cvs] javassist/src/main/javassist/util/proxy ...

Shigeru Chiba chiba at is.titech.ac.jp
Thu Aug 31 14:46:24 EDT 2006


  User: chiba   
  Date: 06/08/31 14:46:24

  Modified:    src/main/javassist/util/proxy  ProxyFactory.java
  Log:
  made ProxyFactory.getClassLoader() customizable.
  
  Revision  Changes    Path
  1.14      +49 -1     javassist/src/main/javassist/util/proxy/ProxyFactory.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: ProxyFactory.java
  ===================================================================
  RCS file: /cvsroot/jboss/javassist/src/main/javassist/util/proxy/ProxyFactory.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -b -r1.13 -r1.14
  --- ProxyFactory.java	7 Aug 2006 15:48:31 -0000	1.13
  +++ ProxyFactory.java	31 Aug 2006 18:46:24 -0000	1.14
  @@ -143,6 +143,13 @@
       }
   
       /**
  +     * Obtains the super class set by <code>setSuperclass()</code>.
  +     *
  +     * @since 3.4
  +     */
  +    public Class getSuperclass() { return superClass; }
  +
  +    /**
        * Sets the interfaces of a proxy class.
        */
       public void setInterfaces(Class[] ifs) {
  @@ -150,6 +157,13 @@
       }
   
       /**
  +     * Obtains the interfaces set by <code>setInterfaces</code>.
  +     *
  +     * @since 3.4
  +     */
  +    public Class[] getInterfaces() { return interfaces; }
  +
  +    /**
        * Sets a filter that selects the methods that will be controlled by a handler.
        */
       public void setFilter(MethodFilter mf) {
  @@ -177,7 +191,41 @@
           return thisClass;
       }
   
  +    /**
  +     * A provider of class loaders.  
  +     */
  +    public static interface ClassLoaderProvider {
  +        /**
  +         * Returns a class loader.
  +         *
  +         * @param pf    a proxy factory that is going to obtain a class loader.
  +         */
  +        public ClassLoader get(ProxyFactory pf);
  +    }
  +
  +    /**
  +     * A provider used by <code>createClass()</code> for obtaining
  +     * a class loader.
  +     * <code>get()</code> on this <code>ClassLoaderGetter</code> object
  +     * is called to obtain a class loader.
  +     *
  +     * <p>The value of this field can be updated for changing the default
  +     * implementation.
  +     *
  +     * @since 3.4
  +     */
  +    public static ClassLoaderProvider classLoaderProvider
  +        = new ClassLoaderProvider() {
  +              public ClassLoader get(ProxyFactory pf) {
  +                  return pf.getClassLoader0();
  +              }
  +          };
  +
       protected ClassLoader getClassLoader() {
  +        return classLoaderProvider.get(this);
  +    }
  +
  +    protected ClassLoader getClassLoader0() {
           // return Thread.currentThread().getContextClassLoader();
           ClassLoader loader = null;
           if (superClass != null && !superClass.getName().equals("java.lang.Object"))
  
  
  



More information about the jboss-cvs-commits mailing list