Java Doc for JAnnotation.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) 


java.lang.Object
   org.exolab.javasource.JAnnotation

JAnnotation
final public class JAnnotation (Code)
JAnnotation represents a single annotation against a code element. The methods described on the JAnnotatedElement interface are used to associate JAnnotation's with various other objects in this package describing Java code elements.

The print method outputs annotations in various forms (as described in the Java Language Specification Third Edition) based on the methods called.

For "Marker Annotation", construct with the appropriate JAnnotationType.

 JAnnotationType preliminaryType = new JAnnotationType("Preliminary");
 JAnnotation preliminary = new JAnnotation(preliminaryType);
 
outputs
 @Preliminary()
 
For "Single Element Annotation", construct as above and call the setValue(value) method to set the value of the "value" element of the annotation type.
 JAnnotationType copyrightType = new JAnnotationType("Copyright");
 JAnnotation copyright = new JAnnotation(copyrightType);
 copyright.setValue("\"2002 Yoyodyne Systems, Inc., All rights reserved.\"");
 
outputs
 @Copyright("2002 Yoyodyne Propulsion Systems, Inc., All rights reserved.")
 
For "Normal Annotation," construct as above then call the appropriate setValue methods that accept an "elementName" parameter.
 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\"");
 
outputs
 @RequestForEnhancement(
 id       = 2868724,
 sysopsis = "Provide time-travel functionality",
 engineer = "Mr. Peabody",
 date     = "4/1/2004")
 
"Complex" annotations are also supported via the various setValue methods that take a JAnnotation object.
 JAnnotationType nameType = new JAnnotationType("Name");
 JAnnotationType authorType = new JAnnotationType("Author");
 JAnnotation author = new JAnnotation(authorType);
 JAnnotation name = new JAnnotation(nameType);
 name.setElementValue("first", "\"Joe\"");
 name.setElementValue("last", "\"Hacker\"");
 author.setValue(name);
 
outputs
 @Author(@Name(
 first = "Joe",
 last  = "Hacker"))
 
Finally annotation elements whose types are arrays are supported via the setValue methods that take arrays:
 JAnnotationType endorsersType = new JAnnotationType("Endorsers");
 JAnnotation endorsers = new JAnnotation(endorsersType);
 endorsers.setValue(new String[] { "\"Children\"", "\"Unscrupulous dentists\""});
 
outputs
 @Endorsers(
 {
 "Children",
 "Unscrupulous dentists"
 })
 
Note: Conditional element values are not currently supported. However the setValue methods taking String values can be used to output this construct literally if desired.
author:
   Andrew Fawcett
version:
   $Revision: 6669 $ $Date: 2006-04-25 16:09:10 -0600 (Tue, 25 Apr 2006) $



Constructor Summary
public  JAnnotation(JAnnotationType annotationType)
     Constructs a JAnnotation for the given annotation type.

Method Summary
public  JAnnotationTypegetAnnotationType()
     Returns the JAnnotationType associated with this JAnnotation.
public  String[]getElementNames()
     Returns the names of the elements set by this annotation.
public  StringgetElementValue(String elementName)
     For the provided element name, returns the annotation element value when it is a String.
Parameters:
  elementName - Element to return the value of.
public  JAnnotationgetElementValueAnnotation(String elementName)
     For the provided element name, returns the annotation element value when it is a JAnnotation.
Parameters:
  elementName - Element to return the value of.
public  JAnnotation[]getElementValueAnnotationList(String elementName)
     For the provided element name, returns the annotation element value when it is an array of JAnnotation.
Parameters:
  elementName - Element to return the value of.
public  String[]getElementValueList(String elementName)
     For the provided element name, returns the annotation element value when it is an array of String.
Parameters:
  elementName - Element to return the value of.
public  ObjectgetElementValueObject(String elementName)
     Returns the given annotation element value as Object, typically used if the value type is not known.
public  StringgetValue()
     Returns the annotation element value when it is a String.
public  JAnnotationgetValueAnnotation()
     Returns the annotation element value when it is an annotation.
public  voidprint(JSourceWriter jsw)
     Prints the source code for this JAnnotation to the given JSourceWriter.
Parameters:
  jsw - the JSourceWriter to print to.
public  voidsetElementValue(String elementName, String stringValue)
     Adds an annotation element name=value pair.
public  voidsetElementValue(String elementName, String[] stringValues)
     Adds an annotation element name=list pair.
public  voidsetElementValue(String elementName, JAnnotation annotationValue)
     Adds an annotation element name=annotation pair.
public  voidsetElementValue(String elementName, JAnnotation[] annotationValues)
     Adds an annotation element name=array of annotations.
public  voidsetValue(String stringValue)
     Sets the "value" annotation element value.
public  voidsetValue(String[] stringValue)
     Sets the "value" annotation element value as a list.
public  voidsetValue(JAnnotation annotationValue)
     Sets the "value" annotation element value as an annotation.
public  voidsetValue(JAnnotation[] annotationValues)
     Sets the "value" annotation element value as a list of annotation values.


Constructor Detail
JAnnotation
public JAnnotation(JAnnotationType annotationType)(Code)
Constructs a JAnnotation for the given annotation type.
Parameters:
  annotationType - Annotation type.




Method Detail
getAnnotationType
public JAnnotationType getAnnotationType()(Code)
Returns the JAnnotationType associated with this JAnnotation. The JAnnotationType associated with this JAnnotation..



getElementNames
public String[] getElementNames()(Code)
Returns the names of the elements set by this annotation. Array of element names.



getElementValue
public String getElementValue(String elementName)(Code)
For the provided element name, returns the annotation element value when it is a String.
Parameters:
  elementName - Element to return the value of. The annotation element value.



getElementValueAnnotation
public JAnnotation getElementValueAnnotation(String elementName)(Code)
For the provided element name, returns the annotation element value when it is a JAnnotation.
Parameters:
  elementName - Element to return the value of. The annotation element value.



getElementValueAnnotationList
public JAnnotation[] getElementValueAnnotationList(String elementName)(Code)
For the provided element name, returns the annotation element value when it is an array of JAnnotation.
Parameters:
  elementName - Element to return the value of. The annotation element value.



getElementValueList
public String[] getElementValueList(String elementName)(Code)
For the provided element name, returns the annotation element value when it is an array of String.
Parameters:
  elementName - Element to return the value of. The annotation element value.



getElementValueObject
public Object getElementValueObject(String elementName)(Code)
Returns the given annotation element value as Object, typically used if the value type is not known. This will either be a String or JAnnotation or an array of String or an array of JAnnotation.
Parameters:
  elementName - Element to return the value of. Annotation element value as Object.



getValue
public String getValue()(Code)
Returns the annotation element value when it is a String. The annotation element value.



getValueAnnotation
public JAnnotation getValueAnnotation()(Code)
Returns the annotation element value when it is an annotation. The annotation element value when it is an annotation.



print
public void print(JSourceWriter jsw)(Code)
Prints the source code for this JAnnotation to the given JSourceWriter.
Parameters:
  jsw - the JSourceWriter to print to. Must not be null.



setElementValue
public void setElementValue(String elementName, String stringValue)(Code)
Adds an annotation element name=value pair.
Parameters:
  elementName - Name of this annotation element.
Parameters:
  stringValue - Value of this annotation element.



setElementValue
public void setElementValue(String elementName, String[] stringValues)(Code)
Adds an annotation element name=list pair.
Parameters:
  elementName - Name of this annotation element.
Parameters:
  stringValues - String array value of this annotation element.



setElementValue
public void setElementValue(String elementName, JAnnotation annotationValue)(Code)
Adds an annotation element name=annotation pair.
Parameters:
  elementName - Name of this annotation element.
Parameters:
  annotationValue - Annotation to be used as the value.



setElementValue
public void setElementValue(String elementName, JAnnotation[] annotationValues)(Code)
Adds an annotation element name=array of annotations.
Parameters:
  elementName - Name of this annotation element.
Parameters:
  annotationValues - Array of annotations to be used as the value.



setValue
public void setValue(String stringValue)(Code)
Sets the "value" annotation element value.
Parameters:
  stringValue - Literal String value.



setValue
public void setValue(String[] stringValue)(Code)
Sets the "value" annotation element value as a list.
Parameters:
  stringValue - Array of literal String values.



setValue
public void setValue(JAnnotation annotationValue)(Code)
Sets the "value" annotation element value as an annotation.
Parameters:
  annotationValue - JAnnotation to be used as this JAnnotation's value.



setValue
public void setValue(JAnnotation[] annotationValues)(Code)
Sets the "value" annotation element value as a list of annotation values.
Parameters:
  annotationValues - Array of JAnnotations to be used as thisJAnnotation's value.



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.