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


java.lang.Object
   javassist.CtMember
      javassist.CtBehavior
         javassist.CtConstructor

CtConstructor
final public class CtConstructor extends CtBehavior (Code)
An instance of CtConstructor represents a constructor. It may represent a static constructor (class initializer). To distinguish a constructor and a class initializer, call isClassInitializer().

See the super class CtBehavior as well since a number of useful methods are in CtBehavior.
See Also:   CtClass.getDeclaredConstructors
See Also:   CtClass.getClassInitializer
See Also:   CtNewConstructor




Constructor Summary
protected  CtConstructor(MethodInfo minfo, CtClass declaring)
    
public  CtConstructor(CtClass[] parameters, CtClass declaring)
     Creates a constructor with no constructor body.
public  CtConstructor(CtConstructor src, CtClass declaring, ClassMap map)
     Creates a copy of a CtConstructor object. The created constructor must be added to a class with CtClass.addConstructor().

All occurrences of class names in the created constructor are replaced with names specified by map if map is not null.

By default, all the occurrences of the names of the class declaring src and the superclass are replaced with the name of the class and the superclass that the created constructor is added to. This is done whichever map is null or not. To prevent this replacement, call ClassMap.fix().

Note: if the .class notation (for example, String.class) is included in an expression, the Javac compiler may produce a helper method. Since this constructor never copies this helper method, the programmers have the responsiblity of copying it.


Method Summary
public  booleancallsSuper()
     Returns true if this constructor calls a constructor of the super class.
public  StringgetName()
     Obtains the name of this constructor. It is the same as the simple name of the class declaring this constructor.
 intgetStartPosOfBody(CodeAttribute ca)
    
public  voidinsertBeforeBody(String src)
     Inserts bytecode just after another constructor in the super class or this class is called.
public  booleanisClassInitializer()
     Returns true if this object represents a static initializer.
public  booleanisConstructor()
     Returns true if this object represents a constructor.
public  booleanisEmpty()
     Returns true if the constructor (or static initializer) is the default one.
public  voidsetBody(String src)
     Sets a constructor body.
public  voidsetBody(CtConstructor src, ClassMap map)
     Copies a constructor body from another constructor.
public  CtMethodtoMethod(String name, CtClass declaring)
     Makes a copy of this constructor and converts it into a method. The signature of the mehtod is the same as the that of this constructor. The return type is void.
public  CtMethodtoMethod(String name, CtClass declaring, ClassMap map)
     Makes a copy of this constructor and converts it into a method. The signature of the mehtod is the same as the that of this constructor. The return type is void.


Constructor Detail
CtConstructor
protected CtConstructor(MethodInfo minfo, CtClass declaring)(Code)



CtConstructor
public CtConstructor(CtClass[] parameters, CtClass declaring)(Code)
Creates a constructor with no constructor body. The created constructor must be added to a class with CtClass.addConstructor().

The created constructor does not include a constructor body, must be specified with setBody().
Parameters:
  declaring - the class to which the created method is added.
Parameters:
  parameters - a list of the parameter types
See Also:   CtClass.addConstructor(CtConstructor)
See Also:   CtConstructor.setBody(String)
See Also:   CtConstructor.setBody(CtConstructorClassMap)




CtConstructor
public CtConstructor(CtConstructor src, CtClass declaring, ClassMap map) throws CannotCompileException(Code)
Creates a copy of a CtConstructor object. The created constructor must be added to a class with CtClass.addConstructor().

All occurrences of class names in the created constructor are replaced with names specified by map if map is not null.

By default, all the occurrences of the names of the class declaring src and the superclass are replaced with the name of the class and the superclass that the created constructor is added to. This is done whichever map is null or not. To prevent this replacement, call ClassMap.fix().

Note: if the .class notation (for example, String.class) is included in an expression, the Javac compiler may produce a helper method. Since this constructor never copies this helper method, the programmers have the responsiblity of copying it. Otherwise, use Class.forName() in the expression.
Parameters:
  src - the source method.
Parameters:
  declaring - the class to which the created method is added.
Parameters:
  map - the hashtable associating original class nameswith substituted names.It can be null.
See Also:   CtClass.addConstructor(CtConstructor)
See Also:   ClassMap.fix(String)





Method Detail
callsSuper
public boolean callsSuper() throws CannotCompileException(Code)
Returns true if this constructor calls a constructor of the super class. This method returns false if it calls another constructor of this class by this().



getName
public String getName()(Code)
Obtains the name of this constructor. It is the same as the simple name of the class declaring this constructor. If this object represents a class initializer, then this method returns "<clinit>".



getStartPosOfBody
int getStartPosOfBody(CodeAttribute ca) throws CannotCompileException(Code)



insertBeforeBody
public void insertBeforeBody(String src) throws CannotCompileException(Code)
Inserts bytecode just after another constructor in the super class or this class is called. It does not work if this object represents a class initializer.
Parameters:
  src - the source code representing the inserted bytecode.It must be a single statement or block.



isClassInitializer
public boolean isClassInitializer()(Code)
Returns true if this object represents a static initializer.



isConstructor
public boolean isConstructor()(Code)
Returns true if this object represents a constructor.



isEmpty
public boolean isEmpty()(Code)
Returns true if the constructor (or static initializer) is the default one. This method returns true if the constructor takes some arguments but it does not perform anything except calling super() (the no-argument constructor of the super class).



setBody
public void setBody(String src) throws CannotCompileException(Code)
Sets a constructor body.
Parameters:
  src - the source code representing the constructor body.It must be a single statement or block.If it is null, the substitutedconstructor body does nothing except callingsuper().



setBody
public void setBody(CtConstructor src, ClassMap map) throws CannotCompileException(Code)
Copies a constructor body from another constructor.

All occurrences of the class names in the copied body are replaced with the names specified by map if map is not null.
Parameters:
  src - the method that the body is copied from.
Parameters:
  map - the hashtable associating original class nameswith substituted names.It can be null.




toMethod
public CtMethod toMethod(String name, CtClass declaring) throws CannotCompileException(Code)
Makes a copy of this constructor and converts it into a method. The signature of the mehtod is the same as the that of this constructor. The return type is void. The resulting method must be appended to the class specified by declaring. If this constructor is a static initializer, the resulting method takes no parameter.

An occurrence of another constructor call this() or a super constructor call super() is eliminated from the resulting method.

The immediate super class of the class declaring this constructor must be also a super class of the class declaring the resulting method. If the constructor accesses a field, the class declaring the resulting method must also declare a field with the same name and type.
Parameters:
  name - the name of the resulting method.
Parameters:
  declaring - the class declaring the resulting method.




toMethod
public CtMethod toMethod(String name, CtClass declaring, ClassMap map) throws CannotCompileException(Code)
Makes a copy of this constructor and converts it into a method. The signature of the mehtod is the same as the that of this constructor. The return type is void. The resulting method must be appended to the class specified by declaring. If this constructor is a static initializer, the resulting method takes no parameter.

An occurrence of another constructor call this() or a super constructor call super() is eliminated from the resulting method.

The immediate super class of the class declaring this constructor must be also a super class of the class declaring the resulting method. If the constructor accesses a field, the class declaring the resulting method must also declare a field with the same name and type.
Parameters:
  name - the name of the resulting method.
Parameters:
  declaring - the class declaring the resulting method.
Parameters:
  map - the hash table associating original class nameswith substituted names. The original class names will bereplaced while making a copy.map can be null.




Fields inherited from javassist.CtBehavior
protected MethodInfo methodInfo(Code)(Java Doc)

Methods inherited from javassist.CtBehavior
public void addCatch(String src, CtClass exceptionType) throws CannotCompileException(Code)(Java Doc)
public void addCatch(String src, CtClass exceptionType, String exceptionName) throws CannotCompileException(Code)(Java Doc)
public void addLocalVariable(String name, CtClass type) throws CannotCompileException(Code)(Java Doc)
void copy(CtBehavior src, boolean isCons, ClassMap map) throws CannotCompileException(Code)(Java Doc)
protected void extendToString(StringBuffer buffer)(Code)(Java Doc)
public Object[] getAnnotations() throws ClassNotFoundException(Code)(Java Doc)
public byte[] getAttribute(String name)(Code)(Java Doc)
public Object[] getAvailableAnnotations()(Code)(Java Doc)
public Object[][] getAvailableParameterAnnotations()(Code)(Java Doc)
public CtClass[] getExceptionTypes() throws NotFoundException(Code)(Java Doc)
public MethodInfo getMethodInfo()(Code)(Java Doc)
public MethodInfo getMethodInfo2()(Code)(Java Doc)
public int getModifiers()(Code)(Java Doc)
public Object[][] getParameterAnnotations() throws ClassNotFoundException(Code)(Java Doc)
Object[][] getParameterAnnotations(boolean ignoreNotFound) throws ClassNotFoundException(Code)(Java Doc)
public CtClass[] getParameterTypes() throws NotFoundException(Code)(Java Doc)
CtClass getReturnType0() throws NotFoundException(Code)(Java Doc)
public String getSignature()(Code)(Java Doc)
int getStartPosOfBody(CodeAttribute ca) throws CannotCompileException(Code)(Java Doc)
public void insertAfter(String src) throws CannotCompileException(Code)(Java Doc)
public void insertAfter(String src, boolean asFinally) throws CannotCompileException(Code)(Java Doc)
public int insertAt(int lineNum, String src) throws CannotCompileException(Code)(Java Doc)
public int insertAt(int lineNum, boolean modify, String src) throws CannotCompileException(Code)(Java Doc)
public void insertBefore(String src) throws CannotCompileException(Code)(Java Doc)
public void instrument(CodeConverter converter) throws CannotCompileException(Code)(Java Doc)
public void instrument(ExprEditor editor) throws CannotCompileException(Code)(Java Doc)
abstract public boolean isEmpty()(Code)(Java Doc)
public void setAttribute(String name, byte[] data)(Code)(Java Doc)
public void setBody(String src) throws CannotCompileException(Code)(Java Doc)
public void setBody(String src, String delegateObj, String delegateMethod) throws CannotCompileException(Code)(Java Doc)
static void setBody0(CtClass srcClass, MethodInfo srcInfo, CtClass destClass, MethodInfo destInfo, ClassMap map) throws CannotCompileException(Code)(Java Doc)
public void setExceptionTypes(CtClass[] types) throws NotFoundException(Code)(Java Doc)
public void setModifiers(int mod)(Code)(Java Doc)
public void useCflow(String name) throws CannotCompileException(Code)(Java Doc)

Fields inherited from javassist.CtMember
protected CtClass declaringClass(Code)(Java Doc)
protected CtMember next(Code)(Java Doc)

Methods inherited from javassist.CtMember
static CtMember append(CtMember list, CtMember previousTail, CtMember tail)(Code)(Java Doc)
static CtMember append(CtMember list, CtMember tail)(Code)(Java Doc)
static int count(CtMember f)(Code)(Java Doc)
abstract protected void extendToString(StringBuffer buffer)(Code)(Java Doc)
abstract public Object[] getAnnotations() throws ClassNotFoundException(Code)(Java Doc)
abstract public byte[] getAttribute(String name)(Code)(Java Doc)
abstract public Object[] getAvailableAnnotations() throws ClassNotFoundException(Code)(Java Doc)
public CtClass getDeclaringClass()(Code)(Java Doc)
abstract public int getModifiers()(Code)(Java Doc)
abstract public String getName()(Code)(Java Doc)
abstract public String getSignature()(Code)(Java Doc)
static CtMember remove(CtMember list, CtMember m)(Code)(Java Doc)
abstract public void setAttribute(String name, byte[] data)(Code)(Java Doc)
abstract public void setModifiers(int mod)(Code)(Java Doc)
public String toString()(Code)(Java Doc)
public boolean visibleFrom(CtClass clazz)(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.