Source Code Cross Referenced for CommonAnnotationMetadata.java in  » J2EE » ow2-easybeans » org » ow2 » easybeans » deployment » annotations » metadata » 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 » J2EE » ow2 easybeans » org.ow2.easybeans.deployment.annotations.metadata 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * EasyBeans
003:         * Copyright (C) 2006 Bull S.A.S.
004:         * Contact: easybeans@ow2.org
005:         *
006:         * This library is free software; you can redistribute it and/or
007:         * modify it under the terms of the GNU Lesser General Public
008:         * License as published by the Free Software Foundation; either
009:         * version 2.1 of the License, or any later version.
010:         *
011:         * This library is distributed in the hope that it will be useful,
012:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
013:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014:         * Lesser General Public License for more details.
015:         *
016:         * You should have received a copy of the GNU Lesser General Public
017:         * License along with this library; if not, write to the Free Software
018:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
019:         * USA
020:         *
021:         * --------------------------------------------------------------------------
022:         * $Id: CommonAnnotationMetadata.java 2059 2007-11-22 17:22:33Z benoitf $
023:         * --------------------------------------------------------------------------
024:         */package org.ow2.easybeans.deployment.annotations.metadata;
025:
026:        import java.util.Arrays;
027:
028:        import org.ow2.easybeans.deployment.annotations.impl.JAnnotationResource;
029:        import org.ow2.easybeans.deployment.annotations.impl.JEjbEJB;
030:        import org.ow2.easybeans.deployment.annotations.impl.JavaxPersistenceContext;
031:        import org.ow2.easybeans.deployment.annotations.impl.JavaxPersistenceUnit;
032:        import org.ow2.easybeans.deployment.annotations.metadata.interfaces.ISharedMetadata;
033:
034:        /**
035:         * Defines Metadata shared by Field, Method and Classes. For example
036:         * @javax.annotation.EJB, @javax.annotation.Resource, etc.
037:         * @author Florent Benoit
038:         */
039:        public class CommonAnnotationMetadata implements  ISharedMetadata {
040:
041:            /**
042:             * This field is used as a PersistenceContext.
043:             */
044:            private JavaxPersistenceContext javaxPersistenceContext = null;
045:
046:            /**
047:             * This field is used as a PersistenceUnit.
048:             */
049:            private JavaxPersistenceUnit javaxPersistenceUnit = null;
050:
051:            /**
052:             * Object representing @{@link javax.ejb.EJB} annotation.
053:             */
054:            private JEjbEJB jEjbEJB = null;
055:
056:            /**
057:             * Object representing @{@link javax.annotation.Resource} annotation.
058:             */
059:            private JAnnotationResource jAnnotationResource = null;
060:
061:            /**
062:             * @return JEjbEJB object representing javax.ejb.EJB annotation.
063:             */
064:            public JEjbEJB getJEjbEJB() {
065:                return jEjbEJB;
066:            }
067:
068:            /**
069:             * Set JAnnotationEJB object.
070:             * @param jEjbEJB object representing javax.annotation.EJB annotation.
071:             */
072:            public void setJEjbEJB(final JEjbEJB jEjbEJB) {
073:                this .jEjbEJB = jEjbEJB;
074:            }
075:
076:            /**
077:             * @return JAnnotationResource object representing javax.annotation.Resource
078:             *         annotation.
079:             */
080:            public JAnnotationResource getJAnnotationResource() {
081:                return jAnnotationResource;
082:            }
083:
084:            /**
085:             * Set JAnnotationResource object.
086:             * @param jAnnotationResource object representing javax.annotation.Resource
087:             *        annotation.
088:             */
089:            public void setJAnnotationResource(
090:                    final JAnnotationResource jAnnotationResource) {
091:                this .jAnnotationResource = jAnnotationResource;
092:            }
093:
094:            /**
095:             * @return true if this field is used as a persistence context.
096:             */
097:            public boolean isPersistenceContext() {
098:                return javaxPersistenceContext != null;
099:            }
100:
101:            /**
102:             * @return the persistence context infos.
103:             */
104:            public JavaxPersistenceContext getJavaxPersistenceContext() {
105:                return javaxPersistenceContext;
106:            }
107:
108:            /**
109:             * Sets the persistence context info on this field.
110:             * @param javaxPersistenceContext information on persistence context.
111:             */
112:            public void setJavaxPersistenceContext(
113:                    final JavaxPersistenceContext javaxPersistenceContext) {
114:                this .javaxPersistenceContext = javaxPersistenceContext;
115:            }
116:
117:            /**
118:             * @return true if this field is used as a persistence unit.
119:             */
120:            public boolean isPersistenceUnit() {
121:                return javaxPersistenceUnit != null;
122:            }
123:
124:            /**
125:             * @return the persistence unit infos.
126:             */
127:            public JavaxPersistenceUnit getJavaxPersistenceUnit() {
128:                return javaxPersistenceUnit;
129:            }
130:
131:            /**
132:             * Sets the persistence unit info on this field.
133:             * @param javaxPersistenceUnit information on persistence unit.
134:             */
135:            public void setJavaxPersistenceUnit(
136:                    final JavaxPersistenceUnit javaxPersistenceUnit) {
137:                this .javaxPersistenceUnit = javaxPersistenceUnit;
138:            }
139:
140:            /**
141:             * @return string representation
142:             */
143:            @Override
144:            public String toString() {
145:                StringBuilder sb = new StringBuilder();
146:                String titleIndent = " ";
147:                // classname
148:                sb.append(titleIndent);
149:                sb.append(this .getClass().getName().substring(
150:                        this .getClass().getPackage().getName().length() + 1));
151:                sb.append("[\n");
152:
153:                // jEjbEJB
154:                concatStringBuilder("jEjbEJB", jEjbEJB, sb);
155:
156:                // jAnnotationResource
157:                concatStringBuilder("jAnnotationResource", jAnnotationResource,
158:                        sb);
159:
160:                // javaxPersistenceContext
161:                concatStringBuilder("javaxPersistenceContext",
162:                        javaxPersistenceContext, sb);
163:
164:                // javaxPersistenceUnit
165:                concatStringBuilder("javaxPersistenceUnit",
166:                        javaxPersistenceUnit, sb);
167:
168:                sb.append(titleIndent);
169:                sb.append("]\n");
170:                return sb.toString();
171:            }
172:
173:            /**
174:             * Adds an entry to the given StringBuilder.
175:             * @param name the name of the entry.
176:             * @param object object to add.
177:             * @param sb the string builder object on which add the given element.
178:             * @param indent the indent to add at each line.
179:             */
180:            protected static void concatStringBuilder(final String name,
181:                    final Object object, final StringBuilder sb,
182:                    final String indent) {
183:                if (object instanceof  Boolean) {
184:                    // do not print if false.
185:                    if (!((Boolean) object).booleanValue()) {
186:                        return;
187:                    }
188:                }
189:                if (object != null) {
190:                    sb.append(indent);
191:                    sb.append(name);
192:                    sb.append("=");
193:                    // For arrays, use asList
194:                    if (object instanceof  Object[]) {
195:                        sb.append(Arrays.asList((Object[]) object));
196:                    } else {
197:                        sb.append(object);
198:                    }
199:                    sb.append("\n");
200:                }
201:            }
202:
203:            /**
204:             * Adds an entry to the given StringBuilder.
205:             * @param name the name of the entry.
206:             * @param object object to add.
207:             * @param sb the string builder object on which add the given element.
208:             */
209:            protected static void concatStringBuilder(final String name,
210:                    final Object object, final StringBuilder sb) {
211:                concatStringBuilder(name, object, sb, "    ");
212:            }
213:
214:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.