Package javassist.util.proxy
Class FactoryHelper
- java.lang.Object
-
- javassist.util.proxy.FactoryHelper
-
public class FactoryHelper extends java.lang.ObjectA helper class for implementingProxyFactory. The users ofProxyFactorydo not have to see this class.- See Also:
ProxyFactory
-
-
Field Summary
Fields Modifier and Type Field Description static int[]dataSizeThe data size of primitive types.private static java.lang.reflect.MethoddefineClass1private static java.lang.reflect.MethoddefineClass2static java.lang.Class[]primitiveTypesClassobjects representing primitive types.static java.lang.String[]unwarpMethodsThe names of methods for obtaining a primitive value from a wrapper object.static java.lang.String[]unwrapDescThe descriptors of the unwrapping methods contained inunwrapMethods.static java.lang.String[]wrapperDescThe descriptors of the constructors of wrapper classes.static java.lang.String[]wrapperTypesThe fully-qualified names of wrapper classes for primitive types.
-
Constructor Summary
Constructors Constructor Description FactoryHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static byte[]toBytecode(ClassFile cf)static java.lang.ClasstoClass(ClassFile cf, java.lang.ClassLoader loader)Loads a class file by a given class loader.static java.lang.ClasstoClass(ClassFile cf, java.lang.ClassLoader loader, java.security.ProtectionDomain domain)Loads a class file by a given class loader.private static java.lang.ClasstoClass2(java.lang.reflect.Method method, java.lang.ClassLoader loader, java.lang.Object[] args)static inttypeIndex(java.lang.Class type)Returns an index for accessing arrays in this class.static voidwriteFile(ClassFile cf, java.lang.String directoryName)Writes a class file.private static voidwriteFile0(ClassFile cf, java.lang.String directoryName)
-
-
-
Field Detail
-
defineClass1
private static java.lang.reflect.Method defineClass1
-
defineClass2
private static java.lang.reflect.Method defineClass2
-
primitiveTypes
public static final java.lang.Class[] primitiveTypes
Classobjects representing primitive types.
-
wrapperTypes
public static final java.lang.String[] wrapperTypes
The fully-qualified names of wrapper classes for primitive types.
-
wrapperDesc
public static final java.lang.String[] wrapperDesc
The descriptors of the constructors of wrapper classes.
-
unwarpMethods
public static final java.lang.String[] unwarpMethods
The names of methods for obtaining a primitive value from a wrapper object. For example,intValue()is such a method for obtaining an integer value from ajava.lang.Integerobject.
-
unwrapDesc
public static final java.lang.String[] unwrapDesc
The descriptors of the unwrapping methods contained inunwrapMethods.
-
dataSize
public static final int[] dataSize
The data size of primitive types.longanddoubleare 2; the others are 1.
-
-
Method Detail
-
typeIndex
public static final int typeIndex(java.lang.Class type)
Returns an index for accessing arrays in this class.- Throws:
java.lang.RuntimeException- if a given type is not a primitive type.
-
toClass
public static java.lang.Class toClass(ClassFile cf, java.lang.ClassLoader loader) throws CannotCompileException
Loads a class file by a given class loader. This method uses a default protection domain for the class but it may not work with a security manager or a sigend jar file.- Throws:
CannotCompileException- See Also:
toClass(ClassFile,ClassLoader,ProtectionDomain)
-
toClass
public static java.lang.Class toClass(ClassFile cf, java.lang.ClassLoader loader, java.security.ProtectionDomain domain) throws CannotCompileException
Loads a class file by a given class loader.- Parameters:
domain- if it is null, a default domain is used.- Throws:
CannotCompileException- Since:
- 3.3
-
toClass2
private static java.lang.Class toClass2(java.lang.reflect.Method method, java.lang.ClassLoader loader, java.lang.Object[] args) throws java.lang.Exception- Throws:
java.lang.Exception
-
toBytecode
private static byte[] toBytecode(ClassFile cf) throws java.io.IOException
- Throws:
java.io.IOException
-
writeFile
public static void writeFile(ClassFile cf, java.lang.String directoryName) throws CannotCompileException
Writes a class file.- Throws:
CannotCompileException
-
writeFile0
private static void writeFile0(ClassFile cf, java.lang.String directoryName) throws CannotCompileException, java.io.IOException
- Throws:
CannotCompileExceptionjava.io.IOException
-
-