Source Code Cross Referenced for AbstractSourclet.java in  » Code-Analyzer » beautyJ » de » gulden » util » javasource » sourclet » 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 » Code Analyzer » beautyJ » de.gulden.util.javasource.sourclet 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Project: BeautyJ - Customizable Java Source Code Transformer
003:         * Class:   de.gulden.util.javasource.sourclet.AbstractSourclet
004:         * Version: 1.1
005:         *
006:         * Date:    2004-09-29
007:         *
008:         * Note:    Contains auto-generated Javadoc comments created by BeautyJ.
009:         *  
010:         * This is licensed under the GNU General Public License (GPL)
011:         * and comes with NO WARRANTY. See file license.txt for details.
012:         *
013:         * Author:  Jens Gulden
014:         * Email:   beautyj@jensgulden.de
015:         */
016:
017:        package de.gulden.util.javasource.sourclet;
018:
019:        import de.gulden.util.javasource.SourceObjectDeclared;
020:        import java.io.*;
021:        import java.util.*;
022:
023:        /**
024:         * Class AbstractSourclet.
025:         *  
026:         * @author  Jens Gulden
027:         * @version  1.0
028:         */
029:        public abstract class AbstractSourclet implements  Sourclet,
030:                SourcletOptions {
031:
032:            // ------------------------------------------------------------------------
033:            // --- static field                                                     ---
034:            // ------------------------------------------------------------------------
035:
036:            /**
037:             * Helper for quick newline character(s) access.
038:             */
039:            public static String nl = System.getProperty("line.separator");
040:
041:            // ------------------------------------------------------------------------
042:            // --- field                                                            ---
043:            // ------------------------------------------------------------------------
044:
045:            /**
046:             * Proxy object that may work as provider of option values.
047:             *  
048:             * @see  #setOptions
049:             */
050:            protected SourcletOptions options = null;
051:
052:            // ------------------------------------------------------------------------
053:            // --- constructor                                                      ---
054:            // ------------------------------------------------------------------------
055:
056:            /**
057:             * Creates a new instance of AbstractSourclet.
058:             */
059:            protected AbstractSourclet() {
060:                super ();
061:            }
062:
063:            // ------------------------------------------------------------------------
064:            // --- methods                                                          ---
065:            // ------------------------------------------------------------------------
066:
067:            /**
068:             * Sets an object that works as a proxy for asccessing option values.
069:             * The default implementations of <code>getOption</code>,
070:             * <code>getIntOption</code> and <code>isOption</code> acess this proxy
071:             * to deliver option values to the Sourclet.<br>
072:             * Alternatively, <code>getOption</code>,
073:             * <code>getIntOption</code> and <code>isOption</code> can be reimplemented
074:             * (overwritten) by the Sourclet implementation to use its own option
075:             * retrieval mechanism.
076:             *  
077:             * @see  #getOption
078:             * @see  #getIntOption
079:             * @see  #isOption
080:             */
081:            public void setOptions(SourcletOptions options) {
082:                this .options = options;
083:            }
084:
085:            /**
086:             * Returns the options.
087:             *  
088:             * @return  the options proxy, if it exists. Otherwise returns <code>null</code>.
089:             */
090:            public SourcletOptions getOptions() {
091:                return options;
092:            }
093:
094:            /**
095:             * Initializes the Sourclet. This is called once before the
096:             * first SourceObject's code is being generated.
097:             */
098:            public void init(SourcletOptions options) {
099:                setOptions(options);
100:            }
101:
102:            /**
103:             * Passes requests for option values to the SourcletOptions proxy object that has been set through setOptions(..).
104:             * May be overwritten by a subclass to provide options from a different source.
105:             */
106:            public String getOption(String name) {
107:                return options.getOption(name);
108:            }
109:
110:            /**
111:             * Passes requests for option values to the SourcletOptions proxy object that has been set through setOptions(..).
112:             * May be overwritten by a subclass to provide options from a different source.
113:             */
114:            public int getIntOption(String name) {
115:                return options.getIntOption(name);
116:            }
117:
118:            /**
119:             * Passes requests for option values to the SourcletOptions proxy object that has been set through setOptions(..).
120:             * May be overwritten by a subclass to provide options from a different source.
121:             */
122:            public boolean isOption(String name) {
123:                return options.isOption(name);
124:            }
125:
126:            /**
127:             * Passes requests for option values to the SourcletOptions proxy object that has been set through setOptions(..).
128:             * May be overwritten by a subclass to provide options from a different source.
129:             */
130:            public boolean isOption(String name, String value) {
131:                return options.isOption(name, value);
132:            }
133:
134:            /**
135:             * Passes requests for option values to the SourcletOptions proxy object that has been set through setOptions(..).
136:             * May be overwritten by a subclass to provide options from a different source.
137:             */
138:            public boolean hasOption(String name, String value) {
139:                return options.hasOption(name, value);
140:            }
141:
142:            /**
143:             * Outputs the source code for an entire SourceObject to an OutputStream.
144:             *  
145:             * @throws IOException if an i/o error occurs
146:             */
147:            public void buildSource(OutputStream out, SourceObjectDeclared o)
148:                    throws IOException {
149:                buildStartSource(out, o);
150:                buildHeadSource(out, o);
151:                buildBodySource(out, o);
152:                buildEndSource(out, o);
153:            }
154:
155:            /**
156:             * Outputs the start part of a source object.
157:             * This is the part which comes before the 'normal' head
158:             * (e.g. before a method's signature), so usually this is
159:             * the place where to output Javadoc comments.
160:             *  
161:             * @throws IOException if an i/o error occurs
162:             */
163:            public abstract void buildStartSource(OutputStream out,
164:                    SourceObjectDeclared o) throws IOException;
165:
166:            /**
167:             * Outputs the head part of a source object.
168:             * This is the actual Java code that declares the source object,
169:             * for example a method's signature.
170:             *  
171:             * @throws IOException if an i/o error occurs
172:             */
173:            public abstract void buildHeadSource(OutputStream out,
174:                    SourceObjectDeclared o) throws IOException;
175:
176:            /**
177:             * Outputs the body content of the source object. For example,
178:             * in case of methods this is Java code, in case of classes this recursively
179:             * contains other SourceObjects' code.
180:             *  
181:             * @throws IOException if an i/o error occurs
182:             */
183:            public abstract void buildBodySource(OutputStream out,
184:                    SourceObjectDeclared o) throws IOException;
185:
186:            /**
187:             * Outputs everything that occurs after the SourceObject.
188:             *  
189:             * @throws IOException if an i/o error occurs
190:             */
191:            public abstract void buildEndSource(OutputStream out,
192:                    SourceObjectDeclared o) throws IOException;
193:
194:            // ------------------------------------------------------------------------
195:            // --- static methods                                                   ---
196:            // ------------------------------------------------------------------------
197:
198:            /**
199:             * Tool method for writing a string to an OutputStream.
200:             *  
201:             * @throws IOException if an i/o error occurs
202:             */
203:            public static void write(OutputStream out, String s)
204:                    throws IOException {
205:                out.write(s.getBytes());
206:            }
207:
208:            /**
209:             * Tool method for writing a string concatenated with a newline-feed to an OutputStream.
210:             *  
211:             * @throws IOException if an i/o error occurs
212:             */
213:            public static void writeln(OutputStream out, String s)
214:                    throws IOException {
215:                write(out, s + nl);
216:            }
217:
218:        } // end AbstractSourclet
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.