Package javassist.util.proxy
Class FactoryHelper
- java.lang.Object
-
- javassist.util.proxy.FactoryHelper
-
public class FactoryHelper extends java.lang.Object
A helper class for implementingProxyFactory
. The users ofProxyFactory
do not have to see this class.- See Also:
ProxyFactory
-
-
Field Summary
Fields Modifier and Type Field Description static int[]
dataSize
The data size of primitive types.static java.lang.Class<?>[]
primitiveTypes
Class
objects representing primitive types.static java.lang.String[]
unwarpMethods
The names of methods for obtaining a primitive value from a wrapper object.static java.lang.String[]
unwrapDesc
The descriptors of the unwrapping methods contained inunwrapMethods
.static java.lang.String[]
wrapperDesc
The descriptors of the constructors of wrapper classes.static java.lang.String[]
wrapperTypes
The fully-qualified names of wrapper classes for primitive types.
-
Constructor Summary
Constructors Constructor Description FactoryHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static java.lang.Class<?>
toClass(ClassFile cf, java.lang.Class<?> neighbor, java.lang.ClassLoader loader, java.security.ProtectionDomain domain)
Loads a class file by a given class loader.static java.lang.Class<?>
toClass(ClassFile cf, java.lang.ClassLoader loader)
Deprecated.static java.lang.Class<?>
toClass(ClassFile cf, java.lang.ClassLoader loader, java.security.ProtectionDomain domain)
Deprecated.static java.lang.Class<?>
toClass(ClassFile cf, java.lang.invoke.MethodHandles.Lookup lookup)
Loads a class file by a given lookup.static int
typeIndex(java.lang.Class<?> type)
Returns an index for accessing arrays in this class.static void
writeFile(ClassFile cf, java.lang.String directoryName)
Writes a class file.
-
-
-
Field Detail
-
primitiveTypes
public static final java.lang.Class<?>[] primitiveTypes
Class
objects 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.Integer
object.
-
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.long
anddouble
are 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
Deprecated.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 signed jar file.- Throws:
CannotCompileException
- See Also:
toClass(ClassFile,Class,ClassLoader,ProtectionDomain)
-
toClass
public static java.lang.Class<?> toClass(ClassFile cf, java.lang.ClassLoader loader, java.security.ProtectionDomain domain) throws CannotCompileException
Deprecated.Loads a class file by a given class loader.- Parameters:
loader
- The class loader. It can be null ifneighbor
is not null.domain
- if it is null, a default domain is used.- Throws:
CannotCompileException
- Since:
- 3.3
- See Also:
toClass(ClassFile,Class,ClassLoader,ProtectionDomain)
-
toClass
public static java.lang.Class<?> toClass(ClassFile cf, java.lang.Class<?> neighbor, java.lang.ClassLoader loader, java.security.ProtectionDomain domain) throws CannotCompileException
Loads a class file by a given class loader.- Parameters:
neighbor
- a class belonging to the same package that the loaded class belongs to. It can be null.loader
- The class loader. It can be null ifneighbor
is not null.domain
- if it is null, a default domain is used.- Throws:
CannotCompileException
- Since:
- 3.3
-
toClass
public static java.lang.Class<?> toClass(ClassFile cf, java.lang.invoke.MethodHandles.Lookup lookup) throws CannotCompileException
Loads a class file by a given lookup.- Parameters:
lookup
- used to define the class.- Throws:
CannotCompileException
- Since:
- 3.24
-
writeFile
public static void writeFile(ClassFile cf, java.lang.String directoryName) throws CannotCompileException
Writes a class file.- Throws:
CannotCompileException
-
-