Java Doc for AsmHelper.java in  » Net » Terracotta » com » tc » aspectwerkz » transform » inlining » 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 » Net » Terracotta » com.tc.aspectwerkz.transform.inlining 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.tc.aspectwerkz.transform.inlining.AsmHelper

AsmHelper
public class AsmHelper implements TransformationConstants(Code)
Helper class with utility methods for the ASM library.
author:
   Jonas BonŽr
author:
   Alexandre Vasseur


Field Summary
final public static  ClassInfoBOOLEAN
    
final public static  ClassInfoBYTE
    
final public static  ClassInfoCHARACTER
    
final public static  ClassInfoDOUBLE
    
final public static  ClassInfoFLOAT
    
final public static  ClassInfoINTEGER
    
final public static  booleanIS_JAVA_5
    
public static  intJAVA_VERSION
    
final public static  ClassInfoLONG
    
final public static  ClassInfoSHORT
    
final public static  ClassInfoVOID
    


Method Summary
public static  voidaddDefaultValue(MethodVisitor cv, Type type)
     Adds the default value for a type.
public static  voidaddNullableString(MethodVisitor cv, String value)
     Adds a string and inserts null if the string is null.
public static  voidaddReturnStatement(MethodVisitor mv, Type type)
     Adds the correct return statement.
public static  intcalculateClassHash(String declaringType)
     Calculates the class hash.
public static  intcalculateConstructorHash(String desc)
     Calculates the constructor hash.
public static  intcalculateFieldHash(String name, String desc)
     Calculates the field hash.
public static  intcalculateMethodHash(String name, String desc)
     Calculates the method hash.
public static  StringconvertArrayTypeName(String typeName)
    
public static  StringconvertReflectDescToTypeDesc(String desc)
     Converts a java reflect type desc to ASM type desc.
public static  StringconvertTypeDescToReflectDesc(String typeDesc)
    
public static  ClassdefineClass(ClassLoader loader, byte[] bytes, String name)
     Adds a class to a class loader and loads it.
public static  voiddumpClass(String dumpDir, String className, byte[] bytes)
     Dumps an ASM class to disk.
public static  voiddumpClass(String dumpDir, String className, ClassWriter cw)
     Dumps an ASM class to disk.
public static  ClassforName(ClassLoader loader, String name)
     Tries to load a class if unsuccessful returns null.
public static  Type[]getArgumentTypes(Constructor constructor)
     Gets the argument types for a constructor.
public static  Type[]getArgumentTypes(MethodInfo method)
     Returns the Java types corresponding to the argument types of the given method. Adapted from ASM getArgumentTypes(Method)
Parameters:
  method - a method.
public static  StringgetClassDescriptor(ClassInfo c)
     Returns the descriptor corresponding to the given Java type. Adapted from ASM Type.getClassDescriptor(Class)

TODO remove the delegation to private method
Parameters:
  c - an object class, a primitive class or an array class.

public static  StringgetConstructorDescriptor(ConstructorInfo constructor)
     Returns the descriptor corresponding to the given constructor info.
public static  StringgetFieldDescriptor(FieldInfo field)
     Returns the descriptor corresponding to the given field info.
public static  StringgetMethodDescriptor(MethodInfo method)
     Returns the descriptor corresponding to the given method info.
public static  intgetRegisterDepth(Type[] typesOnStack)
    
public static  intgetRegisterIndexOf(Type[] typesOnStack, int typeIndex)
    
public static  TypegetType(ClassInfo c)
     Returns the Java type corresponding to the given class. Adapted from ASM getType(Class)
Parameters:
  c - a class.
public static  intgetTypeIndexOf(Type[] typesOnStack, int registerIndex)
    
public static  intincrementIndex(int index, Type type)
     Increments the index (takes doubles and longs in to account).
public static  booleanisPrimitive(Type returnType)
     Checks if the Type is a primitive.
public static  voidloadArgumentTypes(MethodVisitor mv, Type[] argumentTypes, boolean staticMethod)
     Loads argument types.
public static  voidloadIntegerConstant(MethodVisitor cv, int index)
     Creates and adds the correct parameter index for integer types.
public static  voidloadStringConstant(MethodVisitor cv, String s)
     Push the string on the stack.
public static  intloadType(MethodVisitor cv, int index, Type type)
     Loads a type.
public static  ClassWriternewClassWriter(boolean computeMax)
    
public static  voidprepareWrappingOfPrimitiveType(MethodVisitor cv, Type type)
     Prepares the wrapping or a primitive type.
public static  intstoreType(MethodVisitor cv, int index, Type type)
     Stores a type.
public static  voidunwrapType(MethodVisitor cv, Type type)
     Handles the unwrapping of a type, unboxing of primitives and casting to the correct object type.
public static  voidwrapPrimitiveType(MethodVisitor cv, Type type)
     Handles the wrapping of a primitive type.

Field Detail
BOOLEAN
final public static ClassInfo BOOLEAN(Code)



BYTE
final public static ClassInfo BYTE(Code)



CHARACTER
final public static ClassInfo CHARACTER(Code)



DOUBLE
final public static ClassInfo DOUBLE(Code)



FLOAT
final public static ClassInfo FLOAT(Code)



INTEGER
final public static ClassInfo INTEGER(Code)



IS_JAVA_5
final public static boolean IS_JAVA_5(Code)
A boolean to check if we have a J2SE 5 support



JAVA_VERSION
public static int JAVA_VERSION(Code)



LONG
final public static ClassInfo LONG(Code)



SHORT
final public static ClassInfo SHORT(Code)



VOID
final public static ClassInfo VOID(Code)





Method Detail
addDefaultValue
public static void addDefaultValue(MethodVisitor cv, Type type)(Code)
Adds the default value for a type.
Parameters:
  cv -
Parameters:
  type -



addNullableString
public static void addNullableString(MethodVisitor cv, String value)(Code)
Adds a string and inserts null if the string is null.
Parameters:
  cv -
Parameters:
  value -



addReturnStatement
public static void addReturnStatement(MethodVisitor mv, Type type)(Code)
Adds the correct return statement.
Parameters:
  mv -
Parameters:
  type -



calculateClassHash
public static int calculateClassHash(String declaringType)(Code)
Calculates the class hash.
Parameters:
  declaringType -



calculateConstructorHash
public static int calculateConstructorHash(String desc)(Code)
Calculates the constructor hash.
Parameters:
  desc -



calculateFieldHash
public static int calculateFieldHash(String name, String desc)(Code)
Calculates the field hash.
Parameters:
  name -
Parameters:
  desc -



calculateMethodHash
public static int calculateMethodHash(String name, String desc)(Code)
Calculates the method hash. The computation MUST be the same as in ReflectHelper, thus we switch back the names to Java style. Note that for array type, Java.reflect is using "[Lpack.foo;" style unless primitive.
Parameters:
  name -
Parameters:
  desc -



convertArrayTypeName
public static String convertArrayTypeName(String typeName)(Code)
Converts an internal Java array type name ([Lblabla) to the a the format used by the expression matcher (blabla[])
Parameters:
  typeName - is type name



convertReflectDescToTypeDesc
public static String convertReflectDescToTypeDesc(String desc)(Code)
Converts a java reflect type desc to ASM type desc.
Parameters:
  desc -



convertTypeDescToReflectDesc
public static String convertTypeDescToReflectDesc(String typeDesc)(Code)
Converts an ASM type descriptor" (I, [I, [Ljava/lang/String;, Ljava/lang/String;) to a Java.reflect one (int, [I, [Ljava.lang.String;, java.lang.String)
Parameters:
  typeDesc - the Java.reflect string representation



defineClass
public static Class defineClass(ClassLoader loader, byte[] bytes, String name)(Code)
Adds a class to a class loader and loads it.
Parameters:
  loader - the class loader (if null the context class loader will be used)
Parameters:
  bytes - the bytes for the class
Parameters:
  name - the name of the class the class



dumpClass
public static void dumpClass(String dumpDir, String className, byte[] bytes) throws IOException(Code)
Dumps an ASM class to disk.
Parameters:
  dumpDir -
Parameters:
  className -
Parameters:
  bytes -
throws:
  java.io.IOException -



dumpClass
public static void dumpClass(String dumpDir, String className, ClassWriter cw) throws IOException(Code)
Dumps an ASM class to disk.
Parameters:
  dumpDir -
Parameters:
  className -
Parameters:
  cw -
throws:
  java.io.IOException -



forName
public static Class forName(ClassLoader loader, String name)(Code)
Tries to load a class if unsuccessful returns null.
Parameters:
  loader - the class loader
Parameters:
  name - the name of the class the class



getArgumentTypes
public static Type[] getArgumentTypes(Constructor constructor)(Code)
Gets the argument types for a constructor.

Parts of code in this method is taken from the ASM codebase.
Parameters:
  constructor - the ASM argument types for the constructor




getArgumentTypes
public static Type[] getArgumentTypes(MethodInfo method)(Code)
Returns the Java types corresponding to the argument types of the given method. Adapted from ASM getArgumentTypes(Method)
Parameters:
  method - a method. the Java types corresponding to the argument types of the givenmethod.



getClassDescriptor
public static String getClassDescriptor(ClassInfo c)(Code)
Returns the descriptor corresponding to the given Java type. Adapted from ASM Type.getClassDescriptor(Class)

TODO remove the delegation to private method
Parameters:
  c - an object class, a primitive class or an array class. the descriptor corresponding to the given class.




getConstructorDescriptor
public static String getConstructorDescriptor(ConstructorInfo constructor)(Code)
Returns the descriptor corresponding to the given constructor info.
Parameters:
  constructor - the descriptor of the given constructor.



getFieldDescriptor
public static String getFieldDescriptor(FieldInfo field)(Code)
Returns the descriptor corresponding to the given field info.
Parameters:
  field - the descriptor of the given field.



getMethodDescriptor
public static String getMethodDescriptor(MethodInfo method)(Code)
Returns the descriptor corresponding to the given method info. Adapted from ASM Type.getMethodDescriptor()
Parameters:
  method - the descriptor of the given method.



getRegisterDepth
public static int getRegisterDepth(Type[] typesOnStack)(Code)
Compute the register depth, based on an array of types (long, double = 2 bytes address)
Parameters:
  typesOnStack - depth of the stack



getRegisterIndexOf
public static int getRegisterIndexOf(Type[] typesOnStack, int typeIndex)(Code)
Compute the index on the stack of a given argument based on its index in the signature
Parameters:
  typesOnStack -
Parameters:
  typeIndex -



getType
public static Type getType(ClassInfo c)(Code)
Returns the Java type corresponding to the given class. Adapted from ASM getType(Class)
Parameters:
  c - a class. the Java type corresponding to the given class.



getTypeIndexOf
public static int getTypeIndexOf(Type[] typesOnStack, int registerIndex)(Code)
Compute the index on the signature of a given argument based on its index as if it was on the stack where the stack would start at the first argument
Parameters:
  typesOnStack -
Parameters:
  registerIndex -



incrementIndex
public static int incrementIndex(int index, Type type)(Code)
Increments the index (takes doubles and longs in to account).
Parameters:
  index -
Parameters:
  type - the incremented index



isPrimitive
public static boolean isPrimitive(Type returnType)(Code)
Checks if the Type is a primitive.
Parameters:
  returnType - TRUE/FALSE



loadArgumentTypes
public static void loadArgumentTypes(MethodVisitor mv, Type[] argumentTypes, boolean staticMethod)(Code)
Loads argument types.
Parameters:
  mv -
Parameters:
  argumentTypes -



loadIntegerConstant
public static void loadIntegerConstant(MethodVisitor cv, int index)(Code)
Creates and adds the correct parameter index for integer types.
Parameters:
  cv -
Parameters:
  index -



loadStringConstant
public static void loadStringConstant(MethodVisitor cv, String s)(Code)
Push the string on the stack. Deal when case where string is null.
Parameters:
  cv -
Parameters:
  s -



loadType
public static int loadType(MethodVisitor cv, int index, Type type)(Code)
Loads a type.
Parameters:
  cv -
Parameters:
  index -
Parameters:
  type - the incremented index



newClassWriter
public static ClassWriter newClassWriter(boolean computeMax)(Code)
Factory method for ASM ClassWriter and J2SE 5 support See http://www.objectweb.org/wws/arc/asm/2004-08/msg00005.html
Parameters:
  computeMax -



prepareWrappingOfPrimitiveType
public static void prepareWrappingOfPrimitiveType(MethodVisitor cv, Type type)(Code)
Prepares the wrapping or a primitive type.
Parameters:
  cv -
Parameters:
  type -



storeType
public static int storeType(MethodVisitor cv, int index, Type type)(Code)
Stores a type.
Parameters:
  cv -
Parameters:
  index -
Parameters:
  type - the incremented index



unwrapType
public static void unwrapType(MethodVisitor cv, Type type)(Code)
Handles the unwrapping of a type, unboxing of primitives and casting to the correct object type. Takes care of null value replaced by default primitive value.
(obj==null)?0L:((Long)obj).longValue();

Parameters:
  cv -
Parameters:
  type -



wrapPrimitiveType
public static void wrapPrimitiveType(MethodVisitor cv, Type type)(Code)
Handles the wrapping of a primitive type.
Parameters:
  cv -
Parameters:
  type -



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.