Save This Page
Home » openjdk-7 » java » lang » reflect » [javadoc | source]
    1   /* VMProxy.java -- VM interface for proxy class
    2      Copyright (C) 2005  Free Software Foundation, Inc.
    3   
    4   This file is part of GNU Classpath.
    5   
    6   GNU Classpath is free software; you can redistribute it and/or modify
    7   it under the terms of the GNU General Public License as published by
    8   the Free Software Foundation; either version 2, or (at your option)
    9   any later version.
   10   
   11   GNU Classpath is distributed in the hope that it will be useful, but
   12   WITHOUT ANY WARRANTY; without even the implied warranty of
   13   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   14   General Public License for more details.
   15   
   16   You should have received a copy of the GNU General Public License
   17   along with GNU Classpath; see the file COPYING.  If not, write to the
   18   Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
   19   02110-1301 USA.
   20   
   21   Linking this library statically or dynamically with other modules is
   22   making a combined work based on this library.  Thus, the terms and
   23   conditions of the GNU General Public License cover the whole
   24   combination.
   25   
   26   As a special exception, the copyright holders of this library give you
   27   permission to link this library with independent modules to produce an
   28   executable, regardless of the license terms of these independent
   29   modules, and to copy and distribute the resulting executable under
   30   terms of your choice, provided that you also meet, for each linked
   31   independent module, the terms and conditions of the license of that
   32   module.  An independent module is a module which is not derived from
   33   or based on this library.  If you modify this library, you may extend
   34   this exception to your version of the library, but you are not
   35   obligated to do so.  If you do not wish to do so, delete this
   36   exception statement from your version. */
   37   
   38   
   39   package java.lang.reflect;
   40   
   41   final class VMProxy
   42   {
   43     /**
   44      * Set to true if the VM provides a native method to implement
   45      * Proxy.getProxyClass completely, including argument verification.
   46      * If this is true, HAVE_NATIVE_GET_PROXY_DATA and
   47      * HAVE_NATIVE_GENERATE_PROXY_CLASS should be false.
   48      * @see java.lang.reflect.Proxy
   49      */
   50     static boolean HAVE_NATIVE_GET_PROXY_CLASS = false;
   51   
   52     /**
   53      * Set to true if the VM provides a native method to implement
   54      * the first part of Proxy.getProxyClass: generation of the array
   55      * of methods to convert, and verification of the arguments.
   56      * If this is true, HAVE_NATIVE_GET_PROXY_CLASS should be false.
   57      * @see java.lang.reflect.Proxy
   58      */
   59     static boolean HAVE_NATIVE_GET_PROXY_DATA = false;
   60   
   61     /**
   62      * Set to true if the VM provides a native method to implement
   63      * the second part of Proxy.getProxyClass: conversion of an array of
   64      * methods into an actual proxy class.
   65      * If this is true, HAVE_NATIVE_GET_PROXY_CLASS should be false.
   66      * @see java.lang.reflect.Proxy
   67      */
   68     static boolean HAVE_NATIVE_GENERATE_PROXY_CLASS = false;
   69   
   70     /**
   71      * Optional native method to replace (and speed up) the pure Java
   72      * implementation of getProxyClass.  Only needed if
   73      * VMProxy.HAVE_NATIVE_GET_PROXY_CLASS is true, this does the
   74      * work of both getProxyData and generateProxyClass with no
   75      * intermediate form in Java. The native code may safely assume that
   76      * this class must be created, and does not already exist.
   77      *
   78      * @param loader the class loader to define the proxy class in; null
   79      *        implies the bootstrap class loader
   80      * @param interfaces the interfaces the class will extend
   81      * @return the generated proxy class
   82      * @throws IllegalArgumentException if the constraints for getProxyClass
   83      *         were violated, except for problems with null
   84      * @throws NullPointerException if `interfaces' is null or contains
   85      *         a null entry, or if handler is null
   86      * @see #HAVE_NATIVE_GET_PROXY_CLASS
   87      * @see #getProxyClass(ClassLoader, Class[])
   88      * @see #getProxyData(ClassLoader, Class[])
   89      * @see #generateProxyClass(ClassLoader, Proxy.ProxyData)
   90      */
   91     static native Class getProxyClass(ClassLoader loader, Class[] interfaces);
   92   
   93     /**
   94      * Optional native method to replace (and speed up) the pure Java
   95      * implementation of getProxyData.  Only needed if
   96      * Configuration.HAVE_NATIVE_GET_PROXY_DATA is true. The native code
   97      * may safely assume that a new ProxyData object must be created which
   98      * does not duplicate any existing ones.
   99      *
  100      * @param loader the class loader to define the proxy class in; null
  101      *        implies the bootstrap class loader
  102      * @param interfaces the interfaces the class will extend
  103      * @return all data that is required to make this proxy class
  104      * @throws IllegalArgumentException if the constraints for getProxyClass
  105      *         were violated, except for problems with null
  106      * @throws NullPointerException if `interfaces' is null or contains
  107      *         a null entry, or if handler is null
  108      * @see #HAVE_NATIVE_GET_PROXY_DATA
  109      * @see #getProxyClass(ClassLoader, Class[])
  110      * @see #getProxyClass(ClassLoader, Class[])
  111      * @see Proxy.ProxyData#getProxyData(Proxy.ProxyType)
  112      */
  113     static native Proxy.ProxyData getProxyData(ClassLoader loader,
  114                                                Class[] interfaces);
  115   
  116     /**
  117      * Optional native method to replace (and speed up) the pure Java
  118      * implementation of generateProxyClass.  Only needed if
  119      * Configuration.HAVE_NATIVE_GENERATE_PROXY_CLASS is true. The native
  120      * code may safely assume that a new Class must be created, and that
  121      * the ProxyData object does not describe any existing class.
  122      *
  123      * @param loader the class loader to define the proxy class in; null
  124      *        implies the bootstrap class loader
  125      * @param data the struct of information to convert to a Class. This
  126      *        has already been verified for all problems except exceeding
  127      *        VM limitations
  128      * @return the newly generated class
  129      * @throws IllegalArgumentException if VM limitations are exceeded
  130      * @see #getProxyClass(ClassLoader, Class[])
  131      * @see #getProxyClass(ClassLoader, Class[])
  132      */
  133     static native Class generateProxyClass(ClassLoader loader,
  134                                            Proxy.ProxyData data);
  135   }

Save This Page
Home » openjdk-7 » java » lang » reflect » [javadoc | source]