Top Inners Fields Constructors Methods
org.springframework.cglib.core

public Class ClassEmitter

extends ClassTransformer
Class Inheritance
Known Direct Subclasses
org.springframework.cglib.proxy.MixinEmitter, org.springframework.cglib.reflect.FastClassEmitter, org.springframework.cglib.transform.ClassEmitterTransformer, org.springframework.cglib.util.ParallelSorterEmitter, org.springframework.cglib.beans.BeanMapEmitter, org.springframework.cglib.beans.BulkBeanEmitter
Annotations
@SuppressWarnings:rawtypes, unchecked
Imports
java.util.HashMap, .Map, org.springframework.asm.ClassVisitor, .FieldVisitor, .MethodVisitor, .Type

Author
Juozas Baliuka, Chris Nokleberg

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class

Field Summary

Modifier and TypeField and Description
private ClassInfo
private Map<K, V>
private static int
private MethodVisitor
private CodeEmitter
private Signature
private CodeEmitter

Constructor Summary

AccessConstructor and Description
public
public

Method Summary

Modifier and TypeMethod and Description
public void
begin_class(int version, final int access, String className, final Type superType, final Type[] interfaces, String source)

public CodeEmitter
begin_method(int access, Signature sig, Type[] exceptions)

public CodeEmitter
public void
declare_field(int access, String name, Type type, Object value)

public void
public int
public ClassInfo
public Type
pack-priv ClassEmitter.FieldInfo
private static synchronized int
public CodeEmitter
public Type
protected void
init()

pack-priv boolean
public void
public void
visit(int
the class version. The minor version is stored in the 16 most significant bits, and the major version in the 16 least significant bits.
version
,
int
the class's access flags (see Opcodes). This parameter also indicates if the class is deprecated Opcodes#ACC_DEPRECATED or a record Opcodes#ACC_RECORD.
access
,
String
the internal name of the class (see Type#getInternalName()).
name
,
String
the signature of this class. May be null if the class is not a generic one, and does not extend or implement generic classes or interfaces.
signature
,
String
the internal of name of the super class (see Type#getInternalName()). For interfaces, the super class is Object. May be null, but only for the Object class.
superName
,
String[]
the internal names of the class's interfaces (see Type#getInternalName()). May be null.
interfaces
)

Overrides org.springframework.asm.ClassVisitor.visit.

Visits the header of the class.
public void
visitEnd()

Overrides org.springframework.asm.ClassVisitor.visitEnd.

Visits the end of the class.
public FieldVisitor
visitField(int
the field's access flags (see Opcodes). This parameter also indicates if the field is synthetic and/or deprecated.
access
,
String
the field's name.
name
,
String
the field's descriptor (see Type).
desc
,
String
the field's signature. May be null if the field's type does not use generic types.
signature
,
Object
the field's initial value. This parameter, which may be null if the field does not have an initial value, must be an Integer, a Float, a Long, a Double or a String (for int, float, long or String fields respectively). This parameter is only used for static fields. Its value is ignored for non static fields, which must be initialized through bytecode instructions in constructors or methods.
value
)

Overrides org.springframework.asm.ClassVisitor.visitField.

Visits a field of the class.
public MethodVisitor
visitMethod(int
the method's access flags (see Opcodes). This parameter also indicates if the method is synthetic and/or deprecated.
access
,
String
the method's name.
name
,
String
the method's descriptor (see Type).
desc
,
String
the method's signature. May be null if the method parameters, return type and exceptions do not use generic types.
signature
,
String[]
the internal names of the method's exception classes (see Type#getInternalName()). May be null.
exceptions
)

Overrides org.springframework.asm.ClassVisitor.visitMethod.

Visits a method of the class.

Field Detail

classInfoback to summary
private ClassInfo classInfo
fieldInfoback to summary
private Map<K, V> fieldInfo
hookCounterback to summary
private static int hookCounter
rawStaticInitback to summary
private MethodVisitor rawStaticInit
staticHookback to summary
private CodeEmitter staticHook
staticHookSigback to summary
private Signature staticHookSig
staticInitback to summary
private CodeEmitter staticInit

Constructor Detail

ClassEmitterback to summary
public ClassEmitter(ClassVisitor cv)
ClassEmitterback to summary
public ClassEmitter()

Method Detail

begin_classback to summary
public void begin_class(int version, final int access, String className, final Type superType, final Type[] interfaces, String source)
begin_methodback to summary
public CodeEmitter begin_method(int access, Signature sig, Type[] exceptions)
begin_staticback to summary
public CodeEmitter begin_static()
declare_fieldback to summary
public void declare_field(int access, String name, Type type, Object value)
end_classback to summary
public void end_class()
getAccessback to summary
public int getAccess()
getClassInfoback to summary
public ClassInfo getClassInfo()
getClassTypeback to summary
public Type getClassType()
getFieldInfoback to summary
pack-priv ClassEmitter.FieldInfo getFieldInfo(String name)
getNextHookback to summary
private static synchronized int getNextHook()
getStaticHookback to summary
public CodeEmitter getStaticHook()
getSuperTypeback to summary
public Type getSuperType()
initback to summary
protected void init()
isFieldDeclaredback to summary
pack-priv boolean isFieldDeclared(String name)
setTargetback to summary
public void setTarget(ClassVisitor cv)

Implements abstract org.springframework.cglib.core.ClassTransformer.setTarget.

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

Overrides org.springframework.asm.ClassVisitor.visit.

Doc from org.springframework.asm.ClassVisitor.visit.

Visits the header of the class.

Parameters
version:int

the class version. The minor version is stored in the 16 most significant bits, and the major version in the 16 least significant bits.

access:int

the class's access flags (see Opcodes). This parameter also indicates if the class is deprecated Opcodes#ACC_DEPRECATED or a record Opcodes#ACC_RECORD.

name:String

the internal name of the class (see Type#getInternalName()).

signature:String

the signature of this class. May be null if the class is not a generic one, and does not extend or implement generic classes or interfaces.

superName:String

the internal of name of the super class (see Type#getInternalName()). For interfaces, the super class is Object. May be null, but only for the Object class.

interfaces:String[]

the internal names of the class's interfaces (see Type#getInternalName()). May be null.

Annotations
@Override
visitEndback to summary
public void visitEnd()

Overrides org.springframework.asm.ClassVisitor.visitEnd.

Doc from org.springframework.asm.ClassVisitor.visitEnd.

Visits the end of the class. This method, which is the last one to be called, is used to inform the visitor that all the fields and methods of the class have been visited.

Annotations
@Override
visitFieldback to summary
public FieldVisitor visitField(int access, String name, String desc, String signature, Object value)

Overrides org.springframework.asm.ClassVisitor.visitField.

Doc from org.springframework.asm.ClassVisitor.visitField.

Visits a field of the class.

Parameters
access:int

the field's access flags (see Opcodes). This parameter also indicates if the field is synthetic and/or deprecated.

name:String

the field's name.

desc:String

the field's descriptor (see Type).

signature:String

the field's signature. May be null if the field's type does not use generic types.

value:Object

the field's initial value. This parameter, which may be null if the field does not have an initial value, must be an Integer, a Float, a Long, a Double or a String (for int, float, long or String fields respectively). This parameter is only used for static fields. Its value is ignored for non static fields, which must be initialized through bytecode instructions in constructors or methods.

Returns:FieldVisitor

a visitor to visit field annotations and attributes, or null if this class visitor is not interested in visiting these annotations and attributes.

Annotations
@Override
visitMethodback to summary
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions)

Overrides org.springframework.asm.ClassVisitor.visitMethod.

Doc from org.springframework.asm.ClassVisitor.visitMethod.

Visits a method of the class. This method must return a new MethodVisitor instance (or null) each time it is called, i.e., it should not return a previously returned visitor.

Parameters
access:int

the method's access flags (see Opcodes). This parameter also indicates if the method is synthetic and/or deprecated.

name:String

the method's name.

desc:String

the method's descriptor (see Type).

signature:String

the method's signature. May be null if the method parameters, return type and exceptions do not use generic types.

exceptions:String[]

the internal names of the method's exception classes (see Type#getInternalName()). May be null.

Returns:MethodVisitor

an object to visit the byte code of the method, or null if this class visitor is not interested in visiting the code of this method.

Annotations
@Override
org.springframework.cglib.core back to summary

pack-priv Class ClassEmitter.FieldInfo

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv int
pack-priv String
pack-priv Type
pack-priv Object

Constructor Summary

AccessConstructor and Description
public
FieldInfo(int access, String name, Type type, Object value)

Method Summary

Modifier and TypeMethod and Description
public boolean
equals(Object
the reference object with which to compare.
o
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.
public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for the object.
Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAlltoStringwaitwaitwait

Field Detail

accessback to summary
pack-priv int access
nameback to summary
pack-priv String name
typeback to summary
pack-priv Type type
valueback to summary
pack-priv Object value

Constructor Detail

FieldInfoback to summary
public FieldInfo(int access, String name, Type type, Object value)

Method Detail

equalsback to summary
public boolean equals(Object o)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
o:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object.

Annotations
@Override