Source Code Cross Referenced for AptPropertySet.java in  » Library » Apache-beehive-1.0.2-src » org » apache » beehive » controls » runtime » generator » 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 » Library » Apache beehive 1.0.2 src » org.apache.beehive.controls.runtime.generator 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Licensed to the Apache Software Foundation (ASF) under one or more
003:         * contributor license agreements.  See the NOTICE file distributed with
004:         * this work for additional information regarding copyright ownership.
005:         * The ASF licenses this file to You under the Apache License, Version 2.0
006:         * (the "License"); you may not use this file except in compliance with
007:         * the License.  You may obtain a copy of the License at
008:         * 
009:         *     http://www.apache.org/licenses/LICENSE-2.0
010:         * 
011:         * Unless required by applicable law or agreed to in writing, software
012:         * distributed under the License is distributed on an "AS IS" BASIS,
013:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         * See the License for the specific language governing permissions and
015:         * limitations under the License.
016:         *
017:         * $Header:$
018:         */
019:        package org.apache.beehive.controls.runtime.generator;
020:
021:        import java.util.ArrayList;
022:        import java.util.Collection;
023:
024:        import com.sun.mirror.declaration.AnnotationTypeDeclaration;
025:        import com.sun.mirror.declaration.AnnotationTypeElementDeclaration;
026:        import com.sun.mirror.declaration.MethodDeclaration;
027:        import com.sun.mirror.declaration.Declaration;
028:
029:        import org.apache.beehive.controls.api.properties.PropertySet;
030:        import org.apache.beehive.controls.runtime.generator.apt.TwoPhaseAnnotationProcessor;
031:
032:        /**
033:         * The AptPropertySet class represents a control PropertySet where the property list
034:         * is derived using APT metadata
035:         */
036:        public class AptPropertySet {
037:            /**
038:             * Constructs a new AptPropertySet instance from APT metadata
039:             * @param controlIntf the declaring bean interface.  May be null (external property set)
040:             * @param propertySet the PropertySet declaration
041:             * @param ap the annotation processor
042:             */
043:            public AptPropertySet(AptControlInterface controlIntf,
044:                    Declaration propertySet, TwoPhaseAnnotationProcessor ap) {
045:                _ap = ap;
046:                _controlIntf = controlIntf;
047:
048:                if (!(propertySet instanceof  AnnotationTypeDeclaration)) {
049:                    _ap.printError(propertySet, "propertyset.illegal.usage");
050:                    return;
051:                }
052:                _propertySet = (AnnotationTypeDeclaration) propertySet;
053:
054:                _isOptional = _propertySet.getAnnotation(PropertySet.class)
055:                        .optional();
056:                _hasSetters = _propertySet.getAnnotation(PropertySet.class)
057:                        .hasSetters();
058:
059:                _properties = initProperties();
060:            }
061:
062:            /**
063:             * Initializes the list of ControlProperties associated with this ControlPropertySet
064:             */
065:            protected ArrayList<AptProperty> initProperties() {
066:                ArrayList<AptProperty> properties = new ArrayList<AptProperty>();
067:
068:                if (_propertySet == null || _propertySet.getMethods() == null)
069:                    return properties;
070:
071:                // Add all declared method, but ignore the mystery <clinit> methods
072:                for (MethodDeclaration methodDecl : _propertySet.getMethods())
073:                    if (!methodDecl.toString().equals("<clinit>()"))
074:                        properties.add(new AptProperty(this ,
075:                                (AnnotationTypeElementDeclaration) methodDecl,
076:                                _ap));
077:
078:                return properties;
079:            }
080:
081:            /**
082:             * Returns the list of ControlProperties associated with this ControlPropertySet
083:             */
084:            public Collection<AptProperty> getProperties() {
085:                return _properties;
086:            }
087:
088:            /**
089:             * Returns the fully qualified package name of this property set
090:             */
091:            public String getPackage() {
092:                if (_propertySet == null || _propertySet.getPackage() == null)
093:                    return "";
094:
095:                return _propertySet.getPackage().getQualifiedName();
096:            }
097:
098:            /**
099:             * Returns the unqualified classname of this property set
100:             */
101:            public String getShortName() {
102:                if (_propertySet == null)
103:                    return "";
104:
105:                return _propertySet.getSimpleName();
106:            }
107:
108:            /**
109:             * Returns the fully qualified class name of the property set
110:             */
111:            public String getClassName() {
112:                if (_propertySet == null)
113:                    return "";
114:
115:                return _propertySet.getQualifiedName();
116:            }
117:
118:            /**
119:             * Returns the property name prefix for properties in this PropertySet
120:             */
121:            public String getPrefix() {
122:                if (_propertySet == null
123:                        || _propertySet.getAnnotation(PropertySet.class) == null)
124:                    return "";
125:
126:                return _propertySet.getAnnotation(PropertySet.class).prefix();
127:            }
128:
129:            /**
130:             * Returns whether or not this propertyset exposes setters
131:             */
132:            public boolean isOptional() {
133:                return _isOptional;
134:            }
135:
136:            /**
137:             * Returns whether or not this propertyset exposes setters
138:             */
139:            public boolean hasSetters() {
140:                return _hasSetters;
141:            }
142:
143:            private AnnotationTypeDeclaration _propertySet;
144:            private AptControlInterface _controlIntf; // may be null if an external property set
145:            private ArrayList<AptProperty> _properties;
146:            private TwoPhaseAnnotationProcessor _ap;
147:            private boolean _isOptional;
148:            private boolean _hasSetters;
149:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.