Top Description Fields Constructors Methods
javassist.util.proxy

public Class FactoryHelper

extends Object
Class Inheritance
Imports
java.io.BufferedOutputStream, .ByteArrayOutputStream, .DataOutputStream, .File, .FileOutputStream, .IOException, java.security.ProtectionDomain, javassist.CannotCompileException, javassist.bytecode.ClassFile

A helper class for implementing ProxyFactory. The users of ProxyFactory do not have to see this class.
See Also
ProxyFactory

Field Summary

Modifier and TypeField and Description
public static final int[]
dataSize

The data size of primitive types.

public static final Class<?>[]
primitiveTypes

Class objects representing primitive types.

public static final String[]
unwarpMethods

The names of methods for obtaining a primitive value from a wrapper object.

public static final String[]
unwrapDesc

The descriptors of the unwrapping methods contained in unwrapMethods.

public static final String[]
wrapperDesc

The descriptors of the constructors of wrapper classes.

public static final String[]
wrapperTypes

The fully-qualified names of wrapper classes for primitive types.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private static byte[]
public static Class<?>
toClass(ClassFile cf, ClassLoader loader)
Deprecated

Loads a class file by a given class loader.

public static Class<?>
toClass(ClassFile cf, ClassLoader
The class loader. It can be null if neighbor is not null.
loader
,
ProtectionDomain
if it is null, a default domain is used.
domain
)
Deprecated

Loads a class file by a given class loader.

public static Class<?>
toClass(ClassFile cf, Class<?>
a class belonging to the same package that the loaded class belongs to. It can be null.
neighbor
,
ClassLoader
The class loader. It can be null if neighbor is not null.
loader
,
ProtectionDomain
if it is null, a default domain is used.
domain
)

Loads a class file by a given class loader.

public static Class<?>
toClass(ClassFile cf, MethodHandles.Lookup
used to define the class.
lookup
)

Loads a class file by a given lookup.

public static final int
typeIndex(Class<?> type)

Returns an index for accessing arrays in this class.

public static void
writeFile(ClassFile cf, String directoryName)

Writes a class file.

private static void
writeFile0(ClassFile cf, String directoryName)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

dataSizeback to summary
public static final int[] dataSize

The data size of primitive types. long and double are 2; the others are 1.

primitiveTypesback to summary
public static final Class<?>[] primitiveTypes

Class objects representing primitive types.

unwarpMethodsback to summary
public static final 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 a java.lang.Integer object.

unwrapDescback to summary
public static final String[] unwrapDesc

The descriptors of the unwrapping methods contained in unwrapMethods.

wrapperDescback to summary
public static final String[] wrapperDesc

The descriptors of the constructors of wrapper classes.

wrapperTypesback to summary
public static final String[] wrapperTypes

The fully-qualified names of wrapper classes for primitive types.

Constructor Detail

FactoryHelperback to summary
public FactoryHelper()

Method Detail

toBytecodeback to summary
private static byte[] toBytecode(ClassFile cf) throws IOException
toClassback to summary
public static Class<?> toClass(ClassFile cf, 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.

See Also
toClass(ClassFile, Class, ClassLoader, ProtectionDomain)
toClassback to summary
public static Class<?> toClass(ClassFile cf, ClassLoader loader, ProtectionDomain domain) throws CannotCompileException

Deprecated

Loads a class file by a given class loader.

Parameters
loader:ClassLoader

The class loader. It can be null if neighbor is not null.

domain:ProtectionDomain

if it is null, a default domain is used.

Since
3.3
See Also
toClass(ClassFile, Class, ClassLoader, ProtectionDomain)
toClassback to summary
public static Class<?> toClass(ClassFile cf, Class<?> neighbor, ClassLoader loader, ProtectionDomain domain) throws CannotCompileException

Loads a class file by a given class loader.

Parameters
neighbor:Class<?>

a class belonging to the same package that the loaded class belongs to. It can be null.

loader:ClassLoader

The class loader. It can be null if neighbor is not null.

domain:ProtectionDomain

if it is null, a default domain is used.

Since
3.3
toClassback to summary
public static Class<?> toClass(ClassFile cf, MethodHandles.Lookup lookup) throws CannotCompileException

Loads a class file by a given lookup.

Parameters
lookup:MethodHandles.Lookup

used to define the class.

Since
3.24
typeIndexback to summary
public static final int typeIndex(Class<?> type)

Returns an index for accessing arrays in this class.

Exceptions
RuntimeException:
if a given type is not a primitive type.
writeFileback to summary
public static void writeFile(ClassFile cf, String directoryName) throws CannotCompileException

Writes a class file.

writeFile0back to summary
private static void writeFile0(ClassFile cf, String directoryName) throws CannotCompileException, IOException