Top Description Fields Constructors Methods
org.eclipse.persistence.internal.jpa.weaving

pack-priv Class ComputeClassWriter

extends ClassWriter
Class Inheritance
Imports
java.io.IOException, .InputStream, org.eclipse.persistence.asm.ASMFactory, .AnnotationVisitor, .ClassReader, .ClassWriter, .Opcodes

A ClassWriter that computes the common super class of two classes without actually loading them with a ClassLoader.
Author
Eric Bruneton

Field Summary

Modifier and TypeField and Description
private ClassLoader
l

Inherited from org.eclipse.persistence.asm.ClassWriter:
customClassWriter

Constructor Summary

AccessConstructor and Description
public
ComputeClassWriter(ClassLoader loader, final int flags)

Method Summary

Modifier and TypeMethod and Description
public String
public byte[]
private StringBuilder

Returns:

a StringBuilder containing the ancestor classes of 'type', separated by ';'. The returned string has the following format: ";type1;type2 ... ;typeN", where type1 is 'type', and typeN is a direct subclass of Object. If 'type' is Object, the returned string is empty.
typeAncestors
(String
the internal name of a class or interface.
type
,
ClassReader
the ClassReader corresponding to 'type'.
info
)

Returns the internal names of the ancestor classes of the given type.

private boolean

Returns:

true if 'type' implements directly or indirectly 'itf'
typeImplements
(String
the internal name of a class or interface.
type
,
ClassReader
the ClassReader corresponding to 'type'.
info
,
String
the internal name of a interface.
itf
)

Returns true if the given type implements the given interface.

private ClassReader

Returns:

the ClassReader corresponding to 'type'.
typeInfo
(final String
the internal name of a class or interface.
type
)

Returns a ClassReader corresponding to the given class or interface.

public <T> T
public void
visit(int access, String name, String signature, String superName, String[] interfaces)

Overrides org.eclipse.persistence.asm.ClassWriter.visit.

public AnnotationVisitor
Inherited from org.eclipse.persistence.asm.ClassWriter:
getInternalsetCustomClassWritersetCustomClassWriterInImpltoByteArraySupervalueIntvisitvisitAnnotationSupervisitEndvisitFieldvisitFieldSupervisitMethodvisitMethodSuper

Field Detail

lback to summary
private ClassLoader l

Constructor Detail

ComputeClassWriterback to summary
public ComputeClassWriter(ClassLoader loader, final int flags)

Method Detail

getCommonSuperClassback to summary
public String getCommonSuperClass(final String type1, final String type2)

Implements abstract org.eclipse.persistence.asm.ClassWriter.getCommonSuperClass.

Annotations
@Override
toByteArrayback to summary
public byte[] toByteArray()

Overrides org.eclipse.persistence.asm.ClassWriter.toByteArray.

Annotations
@Override
typeAncestorsback to summary
private StringBuilder typeAncestors(String type, ClassReader info) throws IOException

Returns the internal names of the ancestor classes of the given type.

Parameters
type:String

the internal name of a class or interface.

info:ClassReader

the ClassReader corresponding to 'type'.

Returns:StringBuilder

a StringBuilder containing the ancestor classes of 'type', separated by ';'. The returned string has the following format: ";type1;type2 ... ;typeN", where type1 is 'type', and typeN is a direct subclass of Object. If 'type' is Object, the returned string is empty.

Exceptions
IOException:
if the bytecode of 'type' or of some of its ancestor class cannot be loaded.
typeImplementsback to summary
private boolean typeImplements(String type, ClassReader info, String itf) throws IOException

Returns true if the given type implements the given interface.

Parameters
type:String

the internal name of a class or interface.

info:ClassReader

the ClassReader corresponding to 'type'.

itf:String

the internal name of a interface.

Returns:boolean

true if 'type' implements directly or indirectly 'itf'

Exceptions
IOException:
if the bytecode of 'type' or of some of its ancestor class cannot be loaded.
typeInfoback to summary
private ClassReader typeInfo(final String type) throws IOException

Returns a ClassReader corresponding to the given class or interface.

Parameters
type:String

the internal name of a class or interface.

Returns:ClassReader

the ClassReader corresponding to 'type'.

Exceptions
IOException:
if the bytecode of 'type' cannot be loaded.
unwrapback to summary
public <T> T unwrap()

Implements abstract org.eclipse.persistence.asm.ClassWriter.unwrap.

Annotations
@Override
visitback to summary
public void visit(int access, String name, String signature, String superName, String[] interfaces)

Overrides org.eclipse.persistence.asm.ClassWriter.visit.

Annotations
@Override
visitAnnotationback to summary
public AnnotationVisitor visitAnnotation(String descriptor, boolean visible)

Overrides org.eclipse.persistence.asm.ClassWriter.visitAnnotation.

Annotations
@Override