Java Doc for JAnnotatedElement.java in  » Database-ORM » castor » org » exolab » javasource » 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 » Database ORM » castor » org.exolab.javasource 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.exolab.javasource.JAnnotatedElement

All known Subclasses:   org.exolab.javasource.JAnnotatedElementHelper,  org.exolab.javasource.JStructure,  org.exolab.javasource.JMethod,
JAnnotatedElement
public interface JAnnotatedElement (Code)
Defines methods for manipulating annotations held against various program code elements, such as classes, fields, methods etc. This interface is similar to the java.lang.reflect.AnnotatedElement except that it also allows modifications of associated annotations. It is implemented by the classes within this package that represent applicable code elements.

Adding the class annotations

 JClass lollipop = new JClass("Lollipop");
 JAnnotationType endorsersType = new JAnnotationType("Endorsers");
 JAnnotation endorsers = new JAnnotation(endorsersType);
 endorsers.setValue(new String[] { "\"Children\"", "\"Unscrupulous dentists\""});
 lollipop.addAnnotation(endorsers);
 
outputs
 @Endorsers(
 {
 "Children",
 "Unscrupulous dentists"
 })
 public class Lollipop {
 }
 
Adding the method annotations
 JClass timeMachine = new JClass("TimeMachine");
 JAnnotationType requestType = new JAnnotationType("RequestForEnhancement");
 JAnnotation request = new JAnnotation(requestType);
 request.setElementValue("id", "2868724");
 request.setElementValue("synopsis", "\"Provide time-travel functionality\"");
 request.setElementValue("engineer", "\"Mr. Peabody\"");
 request.setElementValue("date", "\"4/1/2004\"");
 JMethod travelThroughTime = new JMethod(null, "travelThroughTime");
 travelThroughTime.addAnnotation(request);
 travelThroughTime.addParameter(new JParameter(new JClass("Date"), "date"));
 timeMachine.addMethod(travelThroughTime);
 
outputs
 @RequestForEnhancement(
 id       = 2868724,
 synopsis = "Provide time-travel functionality",
 engineer = "Mr. Peabody",
 date     = "4/1/2004")
 public void travelThroughTime(Date date)
 {
 }
 
Adding the field annotations
 JClass timeMachine = new JClass("EventProducer");
 JAnnotationType suppressWarningsType = new JAnnotationType("SuppressWarnings");
 JAnnotation suppressWarnings = new JAnnotation(suppressWarningsType);
 JField field = new JField(new JClass("DocumentHandler"), "documentHandler");
 field.addAnnotation(suppressWarnings);
 timeMachine.addField(field);
 
outputs
 @SuppressWarnings()
 private DocumentHandler documentHandler;
 

author:
   Andrew Fawcett
version:
   $Revision: 6669 $ $Date: 2006-04-25 16:09:10 -0600 (Tue, 25 Apr 2006) $




Method Summary
 voidaddAnnotation(JAnnotation annotation)
     Adds a JAnnotation to this source element.
 JAnnotationgetAnnotation(JAnnotationType annotationType)
     Retrieves a JAnnotation for the given JAnnotationType, returns null if no annotation has been set.
Parameters:
  annotationType - Annotation type to retrieve.
 JAnnotation[]getAnnotations()
     Returns a list of JAnnotation's already set on this source element.
 booleanhasAnnotations()
     Returns true if this source element has any annotations.
 booleanisAnnotationPresent(JAnnotationType annotationType)
     Returns true if a JAnnotation exists for the given JAnnotationType.
Parameters:
  annotationType - Annotation type to check for presence or absense.
 JAnnotationremoveAnnotation(JAnnotationType annotationType)
     Removes the JAnnotation from this source element for the given JAnnotationType.



Method Detail
addAnnotation
void addAnnotation(JAnnotation annotation)(Code)
Adds a JAnnotation to this source element. An IllegalArgumentException is thrown if one already exists for the associated JAnnotationType.
Parameters:
  annotation - A JAnnotation to add to this source element.



getAnnotation
JAnnotation getAnnotation(JAnnotationType annotationType)(Code)
Retrieves a JAnnotation for the given JAnnotationType, returns null if no annotation has been set.
Parameters:
  annotationType - Annotation type to retrieve. A JAnnotation for the given JAnnotationType.



getAnnotations
JAnnotation[] getAnnotations()(Code)
Returns a list of JAnnotation's already set on this source element. A list of all JAnnotations associated with this source element.



hasAnnotations
boolean hasAnnotations()(Code)
Returns true if this source element has any annotations. Returns true if this source element has any annotations.



isAnnotationPresent
boolean isAnnotationPresent(JAnnotationType annotationType)(Code)
Returns true if a JAnnotation exists for the given JAnnotationType.
Parameters:
  annotationType - Annotation type to check for presence or absense. True if a JAnnotation has been added for the given JAnnotationType.



removeAnnotation
JAnnotation removeAnnotation(JAnnotationType annotationType)(Code)
Removes the JAnnotation from this source element for the given JAnnotationType. An IllegalArgumentException is thrown if the provided JAnnotation isn't present.
Parameters:
  annotationType - Annotation type to remove. The JAnnotation that was associated with this source element.



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