Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

java.lang.reflect
Class Proxy.ClassFactory  view Proxy.ClassFactory download Proxy.ClassFactory.java

java.lang.Object
  extended byjava.lang.reflect.Proxy.ClassFactory
Enclosing class:
Proxy

private static final class Proxy.ClassFactory
extends java.lang.Object

Does all the work of building a class. By making this a nested class, this code is not loaded in memory if the VM has a native implementation instead.


Field Summary
private static char AALOAD
           
private static char AASTORE
           
private static char ACONST_NULL
          Bytecodes for insertion in the class definition byte[]
private static char ALOAD_0
           
private static char ALOAD_1
           
private static char ANEWARRAY
           
private static char ARETURN
           
private static char ATHROW
           
private static char BIPUSH
           
private static char CHECKCAST
           
private static java.lang.String CTOR_SIG
           
private static char DRETURN
           
private static char DUP
           
private static char DUP_X1
           
private static byte FIELD
          Constants for assisting the compilation
private static char FRETURN
           
private static char GETFIELD
           
private static char GETSTATIC
           
private static char ICONST_0
           
private static char ILOAD
           
private static char ILOAD_0
           
private static byte INTERFACE
           
private static java.lang.String INVOKE_SIG
           
private static char INVOKEINTERFACE
           
private static char INVOKESPECIAL
           
private static char INVOKEVIRTUAL
           
private static char IRETURN
           
private static char LRETURN
           
private static byte METHOD
           
private  Method[] methods
          The Method objects the proxy class refers to when calling the invocation handler.
private static char NEW
           
private  java.lang.StringBuffer pool
          The constant pool.
private  java.util.Map poolEntries
          Map of strings to byte sequences, to minimize size of pool.
private  java.lang.String qualName
          The VM name of this proxy class.
private static char RETURN
           
private static char SIPUSH
           
private  java.lang.StringBuffer stream
          The rest of the class data.
private static char SWAP
           
 
Constructor Summary
(package private) Proxy.ClassFactory(Proxy.ProxyData data)
          Initializes the buffers with the bytecode contents for a proxy class.
 
Method Summary
private  char classInfo(java.lang.Class clazz)
          Returns the entry of the appropriate class info structure in the Constant pool, adding it if necessary.
private  char classInfo(java.lang.String name)
          Returns the entry of the appropriate class info structure in the Constant pool, adding it if necessary.
private  void emitMethod(int i, java.lang.Class[] e)
          Produce the bytecode for a single method.
(package private)  java.lang.Class generate(java.lang.ClassLoader loader)
          Creates the Class object that corresponds to the bytecode buffers built when this object was constructed.
private  char nameAndTypeInfo(java.lang.String name, java.lang.String type)
          Returns the entry of the appropriate nameAndTyperef info structure in the Constant pool, adding it if necessary.
private  char poolIndex(java.lang.String sequence)
          Returns the location of a byte sequence (conveniently wrapped in a String with all characters between  and ÿ inclusive) in the constant pool, adding it if necessary.
private  void putConst(int i)
          Put bytecode to load a constant integer on the stream.
private  void putLoad(int i, java.lang.Class type)
          Put bytecode to load a given local variable on the stream.
private  void putU1(int i)
          Put a single byte on the stream.
private  void putU2(int i)
          Put two bytes on the stream.
private  void putU4(int i)
          Put four bytes on the stream.
private  char refInfo(byte structure, java.lang.String clazz, java.lang.String name, java.lang.String type)
          Returns the entry of the appropriate fieldref, methodref, or interfacemethodref info structure in the Constant pool, adding it if necessary.
private  java.lang.String toUtf8(java.lang.String str)
          Converts a regular string to a UTF8 string, where the upper byte of every char is 0, and '\\u0000' is not in the string.
private  char utf8Info(java.lang.String str)
          Returns the entry of this String in the Constant pool, adding it if necessary.
private  java.lang.String wrapper(java.lang.Class clazz)
          Given a primitive type, return its wrapper class name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FIELD

private static final byte FIELD
Constants for assisting the compilation

See Also:
Constant Field Values

METHOD

private static final byte METHOD
See Also:
Constant Field Values

INTERFACE

private static final byte INTERFACE
See Also:
Constant Field Values

CTOR_SIG

private static final java.lang.String CTOR_SIG
See Also:
Constant Field Values

INVOKE_SIG

private static final java.lang.String INVOKE_SIG
See Also:
Constant Field Values

ACONST_NULL

private static final char ACONST_NULL
Bytecodes for insertion in the class definition byte[]

See Also:
Constant Field Values

ICONST_0

private static final char ICONST_0
See Also:
Constant Field Values

BIPUSH

private static final char BIPUSH
See Also:
Constant Field Values

SIPUSH

private static final char SIPUSH
See Also:
Constant Field Values

ILOAD

private static final char ILOAD
See Also:
Constant Field Values

ILOAD_0

private static final char ILOAD_0
See Also:
Constant Field Values

ALOAD_0

private static final char ALOAD_0
See Also:
Constant Field Values

ALOAD_1

private static final char ALOAD_1
See Also:
Constant Field Values

AALOAD

private static final char AALOAD
See Also:
Constant Field Values

AASTORE

private static final char AASTORE
See Also:
Constant Field Values

DUP

private static final char DUP
See Also:
Constant Field Values

DUP_X1

private static final char DUP_X1
See Also:
Constant Field Values

SWAP

private static final char SWAP
See Also:
Constant Field Values

IRETURN

private static final char IRETURN
See Also:
Constant Field Values

LRETURN

private static final char LRETURN
See Also:
Constant Field Values

FRETURN

private static final char FRETURN
See Also:
Constant Field Values

DRETURN

private static final char DRETURN
See Also:
Constant Field Values

ARETURN

private static final char ARETURN
See Also:
Constant Field Values

RETURN

private static final char RETURN
See Also:
Constant Field Values

GETSTATIC

private static final char GETSTATIC
See Also:
Constant Field Values

GETFIELD

private static final char GETFIELD
See Also:
Constant Field Values

INVOKEVIRTUAL

private static final char INVOKEVIRTUAL
See Also:
Constant Field Values

INVOKESPECIAL

private static final char INVOKESPECIAL
See Also:
Constant Field Values

INVOKEINTERFACE

private static final char INVOKEINTERFACE
See Also:
Constant Field Values

NEW

private static final char NEW
See Also:
Constant Field Values

ANEWARRAY

private static final char ANEWARRAY
See Also:
Constant Field Values

ATHROW

private static final char ATHROW
See Also:
Constant Field Values

CHECKCAST

private static final char CHECKCAST
See Also:
Constant Field Values

pool

private final java.lang.StringBuffer pool
The constant pool.


stream

private final java.lang.StringBuffer stream
The rest of the class data.


poolEntries

private final java.util.Map poolEntries
Map of strings to byte sequences, to minimize size of pool.


qualName

private final java.lang.String qualName
The VM name of this proxy class.


methods

private final Method[] methods
The Method objects the proxy class refers to when calling the invocation handler.

Constructor Detail

Proxy.ClassFactory

Proxy.ClassFactory(Proxy.ProxyData data)
Initializes the buffers with the bytecode contents for a proxy class.

Method Detail

emitMethod

private void emitMethod(int i,
                        java.lang.Class[] e)
Produce the bytecode for a single method.


generate

java.lang.Class generate(java.lang.ClassLoader loader)
Creates the Class object that corresponds to the bytecode buffers built when this object was constructed.


putU1

private void putU1(int i)
Put a single byte on the stream.


putU2

private void putU2(int i)
Put two bytes on the stream.


putU4

private void putU4(int i)
Put four bytes on the stream.


putConst

private void putConst(int i)
Put bytecode to load a constant integer on the stream. This only needs to work for values less than Short.MAX_VALUE.


putLoad

private void putLoad(int i,
                     java.lang.Class type)
Put bytecode to load a given local variable on the stream.


wrapper

private java.lang.String wrapper(java.lang.Class clazz)
Given a primitive type, return its wrapper class name.


utf8Info

private char utf8Info(java.lang.String str)
Returns the entry of this String in the Constant pool, adding it if necessary.


classInfo

private char classInfo(java.lang.String name)
Returns the entry of the appropriate class info structure in the Constant pool, adding it if necessary.


classInfo

private char classInfo(java.lang.Class clazz)
Returns the entry of the appropriate class info structure in the Constant pool, adding it if necessary.


refInfo

private char refInfo(byte structure,
                     java.lang.String clazz,
                     java.lang.String name,
                     java.lang.String type)
Returns the entry of the appropriate fieldref, methodref, or interfacemethodref info structure in the Constant pool, adding it if necessary.


nameAndTypeInfo

private char nameAndTypeInfo(java.lang.String name,
                             java.lang.String type)
Returns the entry of the appropriate nameAndTyperef info structure in the Constant pool, adding it if necessary.


toUtf8

private java.lang.String toUtf8(java.lang.String str)
Converts a regular string to a UTF8 string, where the upper byte of every char is 0, and '\\u0000' is not in the string. This is basically to use a String as a fancy byte[], and while it is less efficient in memory use, it is easier for hashing.


poolIndex

private char poolIndex(java.lang.String sequence)
Returns the location of a byte sequence (conveniently wrapped in a String with all characters between  and ÿ inclusive) in the constant pool, adding it if necessary.