it.imolinfo.jbi4ejb.webservice.generator.bcm
Class SerializableInspectorAdapter

java.lang.Object
  extended by org.objectweb.asm.ClassAdapter
      extended by it.imolinfo.jbi4ejb.webservice.generator.bcm.SerializableInspectorAdapter
All Implemented Interfaces:
org.objectweb.asm.ClassVisitor
Direct Known Subclasses:
SerializableDecorationAdapter

public class SerializableInspectorAdapter
extends org.objectweb.asm.ClassAdapter

Finds if a class implements the Serializable and gets the interface serial version UIDs, putting all the informtaion a ClassMetaInfo instance.


Field Summary
static java.lang.String FIELDNAME_SERIAL_VERSION_UID
          The 'serialVersionUID' field.
static java.lang.String INTERNAL_NAME_OF_SERIALIZABLE
          The internal name of the java interface 'Serializable'.
 
Fields inherited from class org.objectweb.asm.ClassAdapter
cv
 
Constructor Summary
SerializableInspectorAdapter(org.objectweb.asm.ClassVisitor cv)
          Instantiates a new serializable inspector adapter.
 
Method Summary
 ClassMetaInfo getClassMetaInfo()
          Gets the class meta info.
protected  boolean hasSerialVersionUIDField(java.lang.String name, java.lang.String desc)
          Checks if the field is a serial version UID field.
protected  boolean implementsSerializable(java.lang.String[] interfaces)
          Tests if Serializable is between the interfaces.
 void setClassMetaInfo(ClassMetaInfo classMetaInfo)
          Sets the class meta info.
 void visit(int version, int access, java.lang.String name, java.lang.String signature, java.lang.String superName, java.lang.String[] interfaces)
          Tests if the class implements serializable.
 org.objectweb.asm.FieldVisitor visitField(int access, java.lang.String name, java.lang.String desc, java.lang.String signature, java.lang.Object value)
          If find the serialVersionUID field, gets the value.
 
Methods inherited from class org.objectweb.asm.ClassAdapter
visitAnnotation, visitAttribute, visitEnd, visitInnerClass, visitMethod, visitOuterClass, visitSource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INTERNAL_NAME_OF_SERIALIZABLE

public static final java.lang.String INTERNAL_NAME_OF_SERIALIZABLE
The internal name of the java interface 'Serializable'.

See Also:
Constant Field Values

FIELDNAME_SERIAL_VERSION_UID

public static final java.lang.String FIELDNAME_SERIAL_VERSION_UID
The 'serialVersionUID' field.

See Also:
Constant Field Values
Constructor Detail

SerializableInspectorAdapter

public SerializableInspectorAdapter(org.objectweb.asm.ClassVisitor cv)
Instantiates a new serializable inspector adapter.

Parameters:
cv - The ClassVisitor
Method Detail

visit

public void visit(int version,
                  int access,
                  java.lang.String name,
                  java.lang.String signature,
                  java.lang.String superName,
                  java.lang.String[] interfaces)
Tests if the class implements serializable.

Specified by:
visit in interface org.objectweb.asm.ClassVisitor
Overrides:
visit in class org.objectweb.asm.ClassAdapter
Parameters:
version - The version
access - The access modifier
name - The class name
signature - The signature
superName - The superclass name
interfaces - The interfaces implemented

visitField

public org.objectweb.asm.FieldVisitor visitField(int access,
                                                 java.lang.String name,
                                                 java.lang.String desc,
                                                 java.lang.String signature,
                                                 java.lang.Object value)
If find the serialVersionUID field, gets the value.

Specified by:
visitField in interface org.objectweb.asm.ClassVisitor
Overrides:
visitField in class org.objectweb.asm.ClassAdapter
Parameters:
access - The access modifier
name - The field name
desc - The field desc
signature - The signature
value - The field value
Returns:
The FieldVisitor

hasSerialVersionUIDField

protected boolean hasSerialVersionUIDField(java.lang.String name,
                                           java.lang.String desc)
Checks if the field is a serial version UID field.

Parameters:
name - The field name
desc - The field descriptor
Returns:
true, if successful

implementsSerializable

protected boolean implementsSerializable(java.lang.String[] interfaces)
Tests if Serializable is between the interfaces.

Parameters:
interfaces - The interfaaces to test
Returns:
true, if successful

getClassMetaInfo

public ClassMetaInfo getClassMetaInfo()
Gets the class meta info.

Returns:
the class meta info

setClassMetaInfo

public void setClassMetaInfo(ClassMetaInfo classMetaInfo)
Sets the class meta info.

Parameters:
classMetaInfo - the new class meta info


Copyright © 2007-2008 Imola Informatica. All Rights Reserved.