Java Doc for SerialVersionUIDAdder.java in  » IDE » tIDE » org » objectweb » asm » commons » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » IDE » tIDE » org.objectweb.asm.commons 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.objectweb.asm.ClassAdapter
      org.objectweb.asm.commons.SerialVersionUIDAdder

SerialVersionUIDAdder
public class SerialVersionUIDAdder extends ClassAdapter (Code)
A ClassAdapter that adds a serial version unique identifier to a class if missing. Here is typical usage of this class:
 ClassWriter cw = new ClassWriter(...);
 ClassVisitor sv = new SerialVersionUIDAdder(cw);
 ClassVisitor ca = new MyClassAdapter(sv);
 new ClassReader(orginalClass).accept(ca, false);
 
The SVUID algorithm can be found http://java.sun.com/j2se/1.4.2/docs/guide/serialization/spec/class.html:
 The serialVersionUID is computed using the signature of a stream of bytes
 that reflect the class definition. The National Institute of Standards and
 Technology (NIST) Secure Hash Algorithm (SHA-1) is used to compute a
 signature for the stream. The first two 32-bit quantities are used to form a
 64-bit hash. A java.lang.DataOutputStream is used to convert primitive data
 types to a sequence of bytes. The values input to the stream are defined by
 the Java Virtual Machine (VM) specification for classes.
 The sequence of items in the stream is as follows:
 1. The class name written using UTF encoding.
 2. The class modifiers written as a 32-bit integer.
 3. The name of each interface sorted by name written using UTF encoding.
 4. For each field of the class sorted by field name (except private static
 and private transient fields):
 1. The name of the field in UTF encoding.
 2. The modifiers of the field written as a 32-bit integer.
 3. The descriptor of the field in UTF encoding
 5. If a class initializer exists, write out the following:
 1. The name of the method, <clinit>, in UTF encoding.
 2. The modifier of the method, java.lang.reflect.Modifier.STATIC,
 written as a 32-bit integer.
 3. The descriptor of the method, ()V, in UTF encoding.
 6. For each non-private constructor sorted by method name and signature:
 1. The name of the method, <init>, in UTF encoding.
 2. The modifiers of the method written as a 32-bit integer.
 3. The descriptor of the method in UTF encoding.
 7. For each non-private method sorted by method name and signature:
 1. The name of the method in UTF encoding.
 2. The modifiers of the method written as a 32-bit integer.
 3. The descriptor of the method in UTF encoding.
 8. The SHA-1 algorithm is executed on the stream of bytes produced by
 DataOutputStream and produces five 32-bit values sha[0..4].
 9. The hash value is assembled from the first and second 32-bit values of
 the SHA-1 message digest. If the result of the message digest, the five
 32-bit words H0 H1 H2 H3 H4, is in an array of five int values named
 sha, the hash value would be computed as follows:
 long hash = ((sha[0] >>> 24) & 0xFF) |
 ((sha[0] >>> 16) & 0xFF) << 8 |
 ((sha[0] >>> 8) & 0xFF) << 16 |
 ((sha[0] >>> 0) & 0xFF) << 24 |
 ((sha[1] >>> 24) & 0xFF) << 32 |
 ((sha[1] >>> 16) & 0xFF) << 40 |
 ((sha[1] >>> 8) & 0xFF) << 48 |
 ((sha[1] >>> 0) & 0xFF) << 56;
 

author:
   Rajendra Inamdar, Vishal Vishnoi

Inner Class :static class Item implements Comparable

Field Summary
protected  intaccess
     Classes access flags.
protected  booleancomputeSVUID
     Flag that indicates if we need to compute SVUID.
protected  booleanhasSVUID
     Set to true if the class already has SVUID.
protected  booleanhasStaticInitializer
     Set to true if the class has static initializer.
protected  String[]interfaces
     Interfaces implemented by the class.
protected  Stringname
    
protected  CollectionsvuidConstructors
     Collection of non-private constructors.
protected  CollectionsvuidFields
     Collection of fields.
protected  CollectionsvuidMethods
     Collection of non-private methods.

Constructor Summary
public  SerialVersionUIDAdder(ClassVisitor cv)
     Creates a new SerialVersionUIDAdder .

Method Summary
protected  byte[]computeSHAdigest(byte[] value)
     Returns the SHA-1 message digest of the given value.
Parameters:
  value - the value whose SHA message digest must be computed.
protected  longcomputeSVUID()
     Returns the value of SVUID if the class doesn't have one already.
public  voidvisit(int version, int access, String name, String signature, String superName, String[] interfaces)
    
public  voidvisitEnd()
    
public  FieldVisitorvisitField(int access, String name, String desc, String signature, Object value)
    
public  MethodVisitorvisitMethod(int access, String name, String desc, String signature, String[] exceptions)
    

Field Detail
access
protected int access(Code)
Classes access flags.



computeSVUID
protected boolean computeSVUID(Code)
Flag that indicates if we need to compute SVUID.



hasSVUID
protected boolean hasSVUID(Code)
Set to true if the class already has SVUID.



hasStaticInitializer
protected boolean hasStaticInitializer(Code)
Set to true if the class has static initializer.



interfaces
protected String[] interfaces(Code)
Interfaces implemented by the class.



name
protected String name(Code)
Internal name of the class



svuidConstructors
protected Collection svuidConstructors(Code)
Collection of non-private constructors.



svuidFields
protected Collection svuidFields(Code)
Collection of fields. (except private static and private transient fields)



svuidMethods
protected Collection svuidMethods(Code)
Collection of non-private methods.




Constructor Detail
SerialVersionUIDAdder
public SerialVersionUIDAdder(ClassVisitor cv)(Code)
Creates a new SerialVersionUIDAdder .
Parameters:
  cv - a ClassVisitor to which this visitor will delegatecalls.




Method Detail
computeSHAdigest
protected byte[] computeSHAdigest(byte[] value)(Code)
Returns the SHA-1 message digest of the given value.
Parameters:
  value - the value whose SHA message digest must be computed. the SHA-1 message digest of the given value.



computeSVUID
protected long computeSVUID() throws IOException(Code)
Returns the value of SVUID if the class doesn't have one already. Please note that 0 is returned if the class already has SVUID, thus use isHasSVUID to determine if the class already had an SVUID. Returns the serial version UID
throws:
  IOException -



visit
public void visit(int version, int access, String name, String signature, String superName, String[] interfaces)(Code)



visitEnd
public void visitEnd()(Code)



visitField
public FieldVisitor visitField(int access, String name, String desc, String signature, Object value)(Code)



visitMethod
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions)(Code)



Fields inherited from org.objectweb.asm.ClassAdapter
protected ClassVisitor cv(Code)(Java Doc)

Methods inherited from org.objectweb.asm.ClassAdapter
public void visit(int version, int access, String name, String signature, String superName, String[] interfaces)(Code)(Java Doc)
public AnnotationVisitor visitAnnotation(String desc, boolean visible)(Code)(Java Doc)
public void visitAttribute(Attribute attr)(Code)(Java Doc)
public void visitEnd()(Code)(Java Doc)
public FieldVisitor visitField(int access, String name, String desc, String signature, Object value)(Code)(Java Doc)
public void visitInnerClass(String name, String outerName, String innerName, int access)(Code)(Java Doc)
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions)(Code)(Java Doc)
public void visitOuterClass(String owner, String name, String desc)(Code)(Java Doc)
public void visitSource(String source, String debug)(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.