Source Code Cross Referenced for JAnnotationArrayMember.java in  » 6.0-JDK-Modules » jaxb-xjc » com » sun » codemodel » 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 » 6.0 JDK Modules » jaxb xjc » com.sun.codemodel 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * The contents of this file are subject to the terms
003:         * of the Common Development and Distribution License
004:         * (the "License").  You may not use this file except
005:         * in compliance with the License.
006:         * 
007:         * You can obtain a copy of the license at
008:         * https://jwsdp.dev.java.net/CDDLv1.0.html
009:         * See the License for the specific language governing
010:         * permissions and limitations under the License.
011:         * 
012:         * When distributing Covered Code, include this CDDL
013:         * HEADER in each file and include the License file at
014:         * https://jwsdp.dev.java.net/CDDLv1.0.html  If applicable,
015:         * add the following below this CDDL HEADER, with the
016:         * fields enclosed by brackets "[]" replaced with your
017:         * own identifying information: Portions Copyright [yyyy]
018:         * [name of copyright owner]
019:         */
020:        package com.sun.codemodel;
021:
022:        import java.lang.annotation.Annotation;
023:        import java.util.ArrayList;
024:        import java.util.List;
025:
026:        /**
027:         * Represents an arrays as annotation members
028:         *
029:         * <p>
030:         * This class implements {@link JAnnotatable} to allow
031:         * new annotations to be added as a member of the array.
032:         *
033:         * @author
034:         *     Bhakti Mehta (bhakti.mehta@sun.com)
035:         */
036:        public final class JAnnotationArrayMember extends JAnnotationValue
037:                implements  JAnnotatable {
038:            private final List<JAnnotationValue> values = new ArrayList<JAnnotationValue>();
039:            private final JCodeModel owner;
040:
041:            JAnnotationArrayMember(JCodeModel owner) {
042:                this .owner = owner;
043:            }
044:
045:            /**
046:             * Adds an array member to this annotation
047:             *
048:             * @param value Adds a string value to the array member
049:             * @return The JAnnotationArrayMember. More elements can be added by calling
050:             *         the same method multiple times
051:             */
052:            public JAnnotationArrayMember param(String value) {
053:                JAnnotationValue annotationValue = new JAnnotationStringValue(
054:                        JExpr.lit(value));
055:                values.add(annotationValue);
056:                return this ;
057:            }
058:
059:            public JAnnotationArrayMember param(boolean value) {
060:                JAnnotationValue annotationValue = new JAnnotationStringValue(
061:                        JExpr.lit(value));
062:                values.add(annotationValue);
063:                return this ;
064:            }
065:
066:            /**
067:             * Adds an array member to this annotation
068:             *
069:             * @param value Adds an int value to the array member
070:             * @return The JAnnotationArrayMember. More elements can be added by calling
071:             *         the same method multiple times
072:             */
073:            public JAnnotationArrayMember param(int value) {
074:                JAnnotationValue annotationValue = new JAnnotationStringValue(
075:                        JExpr.lit(value));
076:                values.add(annotationValue);
077:                return this ;
078:            }
079:
080:            /**
081:             * Adds an array member to this annotation
082:             *
083:             * @param value Adds a float value to the array member
084:             * @return The JAnnotationArrayMember. More elements can be added by calling
085:             *         the same method multiple times
086:             */
087:            public JAnnotationArrayMember param(float value) {
088:                JAnnotationValue annotationValue = new JAnnotationStringValue(
089:                        JExpr.lit(value));
090:                values.add(annotationValue);
091:                return this ;
092:            }
093:
094:            public JAnnotationArrayMember param(Class value) {
095:                JAnnotationValue annotationValue = new JAnnotationStringValue(
096:                        JExpr.lit(value.getName()));
097:                values.add(annotationValue);
098:                return this ;
099:            }
100:
101:            public JAnnotationArrayMember param(JType type) {
102:                JClass clazz = type.boxify();
103:                JAnnotationValue annotationValue = new JAnnotationStringValue(
104:                        clazz.dotclass());
105:                values.add(annotationValue);
106:                return this ;
107:            }
108:
109:            /**
110:             * Adds a new annotation to the array.
111:             */
112:            public JAnnotationUse annotate(Class<? extends Annotation> clazz) {
113:                return annotate(owner.ref(clazz));
114:            }
115:
116:            /**
117:             * Adds a new annotation to the array.
118:             */
119:            public JAnnotationUse annotate(JClass clazz) {
120:                JAnnotationUse a = new JAnnotationUse(clazz);
121:                values.add(a);
122:                return a;
123:            }
124:
125:            public <W extends JAnnotationWriter> W annotate2(Class<W> clazz) {
126:                return TypedAnnotationWriter.create(clazz, this );
127:            }
128:
129:            /**
130:             * Adds an annotation member to this annotation  array
131:             * This can be used for e.g &#64;XmlCollection(values= &#64;XmlCollectionItem(type=Foo.class))
132:             * @param value
133:             *        Adds a annotation  to the array member
134:             * @return
135:             *        The JAnnotationArrayMember. More elements can be added by calling
136:             *        the same method multiple times
137:             *
138:             * @deprecated
139:             *      use {@link #annotate}
140:             */
141:            public JAnnotationArrayMember param(JAnnotationUse value) {
142:                values.add(value);
143:                return this ;
144:            }
145:
146:            public void generate(JFormatter f) {
147:                f.p('{').nl().i();
148:
149:                boolean first = true;
150:                for (JAnnotationValue aValue : values) {
151:                    if (!first)
152:                        f.p(',').nl();
153:                    f.g(aValue);
154:                    first = false;
155:                }
156:                f.nl().o().p('}');
157:            }
158:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.