Source Code Cross Referenced for JModifiers.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 Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * Redistribution and use of this software and associated documentation
003:         * ("Software"), with or without modification, are permitted provided
004:         * that the following conditions are met:
005:         *
006:         * 1. Redistributions of source code must retain copyright
007:         *    statements and notices.  Redistributions must also contain a
008:         *    copy of this document.
009:         *
010:         * 2. Redistributions in binary form must reproduce the
011:         *    above copyright notice, this list of conditions and the
012:         *    following disclaimer in the documentation and/or other
013:         *    materials provided with the distribution.
014:         *
015:         * 3. The name "Exolab" must not be used to endorse or promote
016:         *    products derived from this Software without prior written
017:         *    permission of Intalio, Inc.  For written permission,
018:         *    please contact info@exolab.org.
019:         *
020:         * 4. Products derived from this Software may not be called "Exolab"
021:         *    nor may "Exolab" appear in their names without prior written
022:         *    permission of Intalio, Inc. Exolab is a registered
023:         *    trademark of Intalio, Inc.
024:         *
025:         * 5. Due credit should be given to the Exolab Project
026:         *    (http://www.exolab.org/).
027:         *
028:         * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS
029:         * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
030:         * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
031:         * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
032:         * INTALIO, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
033:         * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
034:         * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
035:         * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
036:         * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
037:         * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
038:         * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
039:         * OF THE POSSIBILITY OF SUCH DAMAGE.
040:         *
041:         * Copyright 1999-2000 (C) Intalio, Inc. All Rights Reserved.
042:         */package org.exolab.javasource;
043:
044:        /**
045:         * Represents the set of modifiers for a Method or Member variable.
046:         *
047:         * @author <a href="mailto:keith AT kvisco DOT com">Keith Visco</a>
048:         * @version $Revision: 6669 $ $Date: 2005-02-26 17:30:28 -0700 (Sat, 26 Feb 2005) $
049:         */
050:        public final class JModifiers {
051:            //--------------------------------------------------------------------------
052:
053:            /** String that marks a method or member as being abstract. */
054:            private static final String ABSTRACT = "abstract";
055:
056:            /** String that marks a method or member as being final. */
057:            private static final String FINAL = "final";
058:
059:            /** String that marks a method or member as having private scope. */
060:            private static final String PRIVATE = "private";
061:
062:            /** String that marks a method or member as having protected scope. */
063:            private static final String PROTECTED = "protected";
064:
065:            /** String that marks a method or member as having package scope. */
066:            private static final String PACKAGE = "";
067:
068:            /** String that marks a method or member as having public scope. */
069:            private static final String PUBLIC = "public";
070:
071:            /** String that marks a method or member as being static. */
072:            private static final String STATIC = "static";
073:
074:            /** String that marks a method or member as being transient. */
075:            private static final String TRANSIENT = "transient";
076:
077:            /** Visibility is private. */
078:            private static final short VISIBILITY_PRIVATE = 1;
079:
080:            /** Visibility is protected. */
081:            private static final short VISIBILITY_PROTECTED = 2;
082:
083:            /** Visibility is public. */
084:            private static final short VISIBILITY_PUBLIC = 3;
085:
086:            /** Visibility is package. */
087:            private static final short VISIBILITY_PACKAGE = 4;
088:
089:            //--------------------------------------------------------------------------
090:
091:            /** The visibility modifier for the object associated with this JModifiers. */
092:            private short _visibility = VISIBILITY_PUBLIC;
093:
094:            /** A flag indicating whether or not the object associated with this
095:             *  JModifiers is static. */
096:            private boolean _isStatic = false;
097:
098:            /** A flag indicating whether or not the object associated with this
099:             *  JModifiers is final. */
100:            private boolean _isFinal = false;
101:
102:            /** A flag indicating whether or not the object associated with this
103:             *  JModifiers is abstract. */
104:            private boolean _isAbstract = false;
105:
106:            /** A flag indicating whether or not the object associated with this
107:             *  JModifiers is transient. */
108:            private boolean _isTransient = false;
109:
110:            //--------------------------------------------------------------------------
111:
112:            /**
113:             * Creates a new JModifiers class. By default the only modifier present is
114:             * public.
115:             */
116:            public JModifiers() {
117:                super ();
118:            }
119:
120:            /**
121:             * Creates a new JModifiers instance.
122:             *
123:             * @param visibility The visibility qualifier.
124:             * @param isStatic A boolean, if true, indicating that this JModifiers
125:             *        includes "static" as a qualifier.
126:             * @param isFinal A boolean, if true, indicating that this JModifiers
127:             *        includes "final" as a qualifier.
128:             */
129:            private JModifiers(final short visibility, final boolean isStatic,
130:                    final boolean isFinal) {
131:                _visibility = visibility;
132:                _isStatic = isStatic;
133:                _isFinal = isFinal;
134:            }
135:
136:            //--------------------------------------------------------------------------
137:
138:            /**
139:             * Creates a copy of this JModifiers instance.
140:             *
141:             * @return A copy of this JModifiers.
142:             */
143:            public JModifiers copy() {
144:                JModifiers mods = new JModifiers(_visibility, _isStatic,
145:                        _isFinal);
146:                mods.setAbstract(_isAbstract);
147:                mods.setTransient(_isTransient);
148:                return mods;
149:            }
150:
151:            //--------------------------------------------------------------------------
152:
153:            /**
154:             * Changes the visibility qualifier to "private".
155:             */
156:            public void makePrivate() {
157:                _visibility = VISIBILITY_PRIVATE;
158:            }
159:
160:            /**
161:             * Changes the visibility qualifier to "protected".
162:             */
163:            public void makeProtected() {
164:                _visibility = VISIBILITY_PROTECTED;
165:            }
166:
167:            /**
168:             * Changes the visibility qualifier to "public".
169:             */
170:            public void makePublic() {
171:                _visibility = VISIBILITY_PUBLIC;
172:            }
173:
174:            /**
175:             * Changes the visibility qualifier to package (= without qualifier).
176:             */
177:            public void makePackage() {
178:                _visibility = VISIBILITY_PACKAGE;
179:            }
180:
181:            /**
182:             * Returns true if this JModifiers includes the qualifier "final". This
183:             * is only applicable to methods and classes.
184:             *
185:             * @return True if this JModifiers includes the qualifier "final". This
186:             *         is only applicable to methods and classes.
187:             */
188:            public boolean isFinal() {
189:                return _isFinal;
190:            }
191:
192:            /**
193:             * Returns true if this JModifiers includes the qualifier "abstract". This
194:             * is only applicable to methods and classes.
195:             *
196:             * @return True if this JModifiers includes the qualifier "abstract". This
197:             *         is only applicable to methods and classes.
198:             */
199:            public boolean isAbstract() {
200:                return _isAbstract;
201:            }
202:
203:            /**
204:             * Returns true if the visibility modifier for this JModifier is "private".
205:             *
206:             * @return True if the visibility modifier for this JModifier is "private".
207:             */
208:            public boolean isPrivate() {
209:                return (_visibility == VISIBILITY_PRIVATE);
210:            }
211:
212:            /**
213:             * Returns true if the visibility modifier for this JModifier is "protected".
214:             *
215:             * @return True if the visibility modifier for this JModifier is "protected".
216:             */
217:            public boolean isProtected() {
218:                return (_visibility == VISIBILITY_PROTECTED);
219:            }
220:
221:            /**
222:             * Returns true if the visibility modifier for this JModifier is "public".
223:             *
224:             * @return True if the visibility modifier for this JModifier is "public".
225:             */
226:            public boolean isPublic() {
227:                return (_visibility == VISIBILITY_PUBLIC);
228:            }
229:
230:            /**
231:             * Returns true if the visibility modifier for this JModifier is package
232:             * (i.e., without qualifier).
233:             *
234:             * @return True if the visibility modifier for this JModifier is package
235:             *         (i.e., without qualifier).
236:             */
237:            public boolean isPackage() {
238:                return (_visibility == VISIBILITY_PACKAGE);
239:            }
240:
241:            /**
242:             * Returns true if this JModifier includes the qualifier "static".
243:             *
244:             * @return True if this JModifier includes the qualifier "static".
245:             */
246:            public boolean isStatic() {
247:                return _isStatic;
248:            }
249:
250:            /**
251:             * Returns true if this JModifier includes the qualifier "transient".
252:             *
253:             * @return True if this JModifier includes the qualifier "transient".
254:             */
255:            public boolean isTransient() {
256:                return _isTransient;
257:            }
258:
259:            /**
260:             * Sets whether or not this JModifiers includes the qualifier "abstract".
261:             * This applies only to methods or classes.
262:             *
263:             * @param isAbstract If true, indicates that this JModifier should include
264:             *        the qualifier "abstract".
265:             */
266:            public void setAbstract(final boolean isAbstract) {
267:                _isAbstract = isAbstract;
268:            }
269:
270:            /**
271:             * Sets whether or not this JModifiers includes the qualifier "final".
272:             *
273:             * @param isFinal If true, indicates that this JModifier should include the
274:             *        qualifier "final".
275:             */
276:            public void setFinal(final boolean isFinal) {
277:                _isFinal = isFinal;
278:            }
279:
280:            /**
281:             * Sets whether or not this JModifiers includes the qualifier "static".
282:             *
283:             * @param isStatic If true, indicates that this JModifier should include the
284:             *        qualifier "static".
285:             */
286:            public void setStatic(final boolean isStatic) {
287:                _isStatic = isStatic;
288:            }
289:
290:            /**
291:             * Sets whether or not this JModifiers includes the qualifier "transient".
292:             *
293:             * @param isTransient Is a boolean which when true indicates that this
294:             *        JModifier should include the qualifier "transient".
295:             */
296:            public void setTransient(final boolean isTransient) {
297:                _isTransient = isTransient;
298:            }
299:
300:            //--------------------------------------------------------------------------
301:
302:            /**
303:             * {@inheritDoc}
304:             */
305:            public String toString() {
306:                StringBuffer sb = new StringBuffer();
307:
308:                //-- visibility
309:                switch (_visibility) {
310:                case VISIBILITY_PRIVATE:
311:                    sb.append(PRIVATE);
312:                    break;
313:                case VISIBILITY_PROTECTED:
314:                    sb.append(PROTECTED);
315:                    break;
316:                case VISIBILITY_PACKAGE:
317:                    sb.append(PACKAGE);
318:                    break;
319:                default:
320:                    sb.append(PUBLIC);
321:                    break;
322:                }
323:
324:                //-- static
325:                if (_isStatic) {
326:                    if (sb.length() > 0) {
327:                        sb.append(' ');
328:                    }
329:                    sb.append(STATIC);
330:                }
331:
332:                //-- final
333:                if (_isFinal) {
334:                    if (sb.length() > 0) {
335:                        sb.append(' ');
336:                    }
337:                    sb.append(FINAL);
338:                }
339:
340:                //-- abstract
341:                if (_isAbstract) {
342:                    if (sb.length() > 0) {
343:                        sb.append(' ');
344:                    }
345:                    sb.append(ABSTRACT);
346:                }
347:
348:                //-- transient
349:                if (_isTransient) {
350:                    if (sb.length() > 0) {
351:                        sb.append(' ');
352:                    }
353:                    sb.append(TRANSIENT);
354:                }
355:
356:                return sb.toString();
357:            }
358:
359:            //--------------------------------------------------------------------------
360:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.