Java Doc for ClassFile.java in  » Byte-Code » Javassist » javassist » bytecode » 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 » Byte Code » Javassist » javassist.bytecode 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   javassist.bytecode.ClassFile

ClassFile
final public class ClassFile (Code)
ClassFile represents a Java .class file, which consists of a constant pool, methods, fields, and attributes.
See Also:   javassist.CtClass.getClassFile


Field Summary
 intaccessFlags
    
 LinkedListattributes
    
 String[]cachedInterfaces
    
 StringcachedSuperclass
    
 ConstPoolconstPool
    
 ArrayListfields
    
 int[]interfaces
    
 intmajorminor
    
 ArrayListmethods
    
 intsuperClass
    
 intthisClass
    
 Stringthisclassname
    

Constructor Summary
public  ClassFile(DataInputStream in)
     Constructs a class file from a byte stream.
public  ClassFile(boolean isInterface, String classname, String superclass)
     Constructs a class file including no members.
Parameters:
  isInterface - true if this is an interface.

Method Summary
public  voidaddAttribute(AttributeInfo info)
     Appends an attribute.
public  voidaddField(FieldInfo finfo)
     Appends a field to the class.
public  voidaddInterface(String name)
     Appends an interface to the interfaces implemented by the class.
public  voidaddMethod(MethodInfo minfo)
     Appends a method to the class.
public  voidcompact()
     Eliminates dead constant pool items.
public  intgetAccessFlags()
     Returns access flags.
public  AttributeInfogetAttribute(String name)
     Returns the attribute with the specified name.
public  ListgetAttributes()
     Returns all the attributes.
public  ConstPoolgetConstPool()
     Returns a constant pool table.
public  ListgetFields()
     Returns all the fields declared in the class.
public  intgetInnerAccessFlags()
     Returns access and property flags of this nested class. This method returns -1 if the class is not a nested class.
public  String[]getInterfaces()
     Returns the names of the interfaces implemented by the class.
public  intgetMajorVersion()
     Get the Major version.
public  MethodInfogetMethod(String name)
     Returns the method with the specified name.
public  ListgetMethods()
     Returns all the methods declared in the class.
public  intgetMinorVersion()
     Get the minor version.
public  StringgetName()
     Returns the class name.
public  StringgetSourceFile()
     Returns the source file containing this class.
public  MethodInfogetStaticInitializer()
     Returns a static initializer (class initializer), or null if it does not exist.
public  StringgetSuperclass()
     Returns the super class name.
public  intgetSuperclassId()
     Returns the index of the constant pool entry representing the super class.
public  booleanisAbstract()
     Returns true if this is an abstract class or an interface.
public  booleanisFinal()
     Returns true if this is a final class or interface.
public  booleanisInterface()
     Returns true if this is an interface.
public  voidprune()
     Discards all attributes, associated with both the class file and the members such as a code attribute and exceptions attribute.
final public  voidrenameClass(String oldname, String newname)
     Replaces all occurrences of a class name in the class file.

If class X is substituted for class Y in the class file, X and Y must have the same signature.

final public  voidrenameClass(Map classnames)
     Replaces all occurrences of several class names in the class file.
public  voidsetAccessFlags(int acc)
     Changes access flags.
public  voidsetInterfaces(String[] nameList)
     Sets the interfaces.
public  voidsetMajorVersion(int major)
     Set the major version.
public  voidsetMinorVersion(int minor)
     Set the minor version.
public  voidsetName(String name)
     Sets the class name.
public  voidsetSuperclass(String superclass)
     Sets the super class.
public  voidsetVersionToJava5()
     Sets the major and minor version to Java 5.
public  voidwrite(DataOutputStream out)
     Writes a class file represened by this object into an output stream.

Field Detail
accessFlags
int accessFlags(Code)



attributes
LinkedList attributes(Code)



cachedInterfaces
String[] cachedInterfaces(Code)



cachedSuperclass
String cachedSuperclass(Code)



constPool
ConstPool constPool(Code)



fields
ArrayList fields(Code)



interfaces
int[] interfaces(Code)



majorminor
int majorminor(Code)



methods
ArrayList methods(Code)



superClass
int superClass(Code)



thisClass
int thisClass(Code)



thisclassname
String thisclassname(Code)




Constructor Detail
ClassFile
public ClassFile(DataInputStream in) throws IOException(Code)
Constructs a class file from a byte stream.



ClassFile
public ClassFile(boolean isInterface, String classname, String superclass)(Code)
Constructs a class file including no members.
Parameters:
  isInterface - true if this is an interface. false if this is a class.
Parameters:
  classname - a fully-qualified class name
Parameters:
  superclass - a fully-qualified super class name




Method Detail
addAttribute
public void addAttribute(AttributeInfo info)(Code)
Appends an attribute. If there is already an attribute with the same name, the new one substitutes for it.
See Also:   ClassFile.getAttributes()



addField
public void addField(FieldInfo finfo) throws DuplicateMemberException(Code)
Appends a field to the class.
throws:
  DuplicateMemberException - when the field is already included.



addInterface
public void addInterface(String name)(Code)
Appends an interface to the interfaces implemented by the class.



addMethod
public void addMethod(MethodInfo minfo) throws DuplicateMemberException(Code)
Appends a method to the class.
throws:
  DuplicateMemberException - when the method is already included.



compact
public void compact()(Code)
Eliminates dead constant pool items. If a method or a field is removed, the constant pool items used by that method/field become dead items. This method recreates a constant pool.



getAccessFlags
public int getAccessFlags()(Code)
Returns access flags.
See Also:   javassist.bytecode.AccessFlag



getAttribute
public AttributeInfo getAttribute(String name)(Code)
Returns the attribute with the specified name. If there are multiple attributes with that name, this method returns either of them. It returns null if the specified attributed is not found.
Parameters:
  name - attribute name
See Also:   ClassFile.getAttributes()



getAttributes
public List getAttributes()(Code)
Returns all the attributes. The returned List object is shared with this object. If you add a new attribute to the list, the attribute is also added to the classs file represented by this object. If you remove an attribute from the list, it is also removed from the class file. a list of AttributeInfo objects.
See Also:   AttributeInfo



getConstPool
public ConstPool getConstPool()(Code)
Returns a constant pool table.



getFields
public List getFields()(Code)
Returns all the fields declared in the class. a list of FieldInfo.
See Also:   FieldInfo



getInnerAccessFlags
public int getInnerAccessFlags()(Code)
Returns access and property flags of this nested class. This method returns -1 if the class is not a nested class.

The returned value is obtained from inner_class_access_flags of the entry representing this nested class itself in InnerClasses_attribute>.




getInterfaces
public String[] getInterfaces()(Code)
Returns the names of the interfaces implemented by the class. The returned array is read only.



getMajorVersion
public int getMajorVersion()(Code)
Get the Major version. the major version



getMethod
public MethodInfo getMethod(String name)(Code)
Returns the method with the specified name. If there are multiple methods with that name, this method returns one of them. null if no such a method is found.



getMethods
public List getMethods()(Code)
Returns all the methods declared in the class. a list of MethodInfo.
See Also:   MethodInfo



getMinorVersion
public int getMinorVersion()(Code)
Get the minor version. the minor version



getName
public String getName()(Code)
Returns the class name.



getSourceFile
public String getSourceFile()(Code)
Returns the source file containing this class. null if this information is not available.



getStaticInitializer
public MethodInfo getStaticInitializer()(Code)
Returns a static initializer (class initializer), or null if it does not exist.



getSuperclass
public String getSuperclass()(Code)
Returns the super class name.



getSuperclassId
public int getSuperclassId()(Code)
Returns the index of the constant pool entry representing the super class.



isAbstract
public boolean isAbstract()(Code)
Returns true if this is an abstract class or an interface.



isFinal
public boolean isFinal()(Code)
Returns true if this is a final class or interface.



isInterface
public boolean isInterface()(Code)
Returns true if this is an interface.



prune
public void prune()(Code)
Discards all attributes, associated with both the class file and the members such as a code attribute and exceptions attribute. The unused constant pool entries are also discarded (a new packed constant pool is constructed).



renameClass
final public void renameClass(String oldname, String newname)(Code)
Replaces all occurrences of a class name in the class file.

If class X is substituted for class Y in the class file, X and Y must have the same signature. If Y provides a method m(), X must provide it even if X inherits m() from the super class. If this fact is not guaranteed, the bytecode verifier may cause an error.
Parameters:
  oldname - the replaced class name
Parameters:
  newname - the substituted class name




renameClass
final public void renameClass(Map classnames)(Code)
Replaces all occurrences of several class names in the class file.
Parameters:
  classnames - specifies which class name is replaced with which new name.Class names must be described with the JVM-internalrepresentation like java/lang/Object.
See Also:   ClassFile.renameClass(String,String)



setAccessFlags
public void setAccessFlags(int acc)(Code)
Changes access flags.
See Also:   javassist.bytecode.AccessFlag



setInterfaces
public void setInterfaces(String[] nameList)(Code)
Sets the interfaces.
Parameters:
  nameList - the names of the interfaces.



setMajorVersion
public void setMajorVersion(int major)(Code)
Set the major version.
Parameters:
  major - the major version



setMinorVersion
public void setMinorVersion(int minor)(Code)
Set the minor version.
Parameters:
  minor - the minor version



setName
public void setName(String name)(Code)
Sets the class name. This method substitutes the new name for all occurrences of the old class name in the class file.



setSuperclass
public void setSuperclass(String superclass) throws CannotCompileException(Code)
Sets the super class.

This method modifies constructors so that they call constructors declared in the new super class.




setVersionToJava5
public void setVersionToJava5()(Code)
Sets the major and minor version to Java 5. If the major version is older than 49, Java 5 extensions such as annotations are ignored by the JVM.



write
public void write(DataOutputStream out) throws IOException(Code)
Writes a class file represened by this object into an output stream.



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.