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


java.lang.Object
   de.gulden.util.javasource.SourceParser

SourceParser
public class SourceParser implements ParserTreeConstants(Code)
SourceParser main utitility class. This class provides functionality to parse Java source codes and build a tree of objects representing the source elements. This tree of objects can be output as XML or, instead of parsing Java sources, be parsed from previously generated XML.
author:
   Jens Gulden
version:
   1.1
See Also:   de.gulden.util.javasource.sourclet.Sourclet
See Also:   de.gulden.util.javasource.sourclet.standard.StandardSourclet


Field Summary
final public static  StringVERSION
    
protected static  DocumentBuilderdocumentBuilder
     Document builder for parsing XML.
public static  booleanincludeXMLDoctype
     Flag specifying whether to include a DTD reference () into generated XML.
public static  LogPerformerlogPerformer
     Log performer, may be set externally.
public static  Stringnl
     Linefeed.
public static  booleanvalidateXML
     Flag specifying whether to validate an XML file against its DTD before it is parsed.
public static  booleanverbose
     Global verbose flag.
final protected static  StringworkaroundUnicodeSingleCharMarker
     Constant workaroundUnicodeSingleCharMarker.


Method Summary
protected static  voidanalysePass1(Package basePackage, InputStream in, String source, ProgressTracker pt)
    
protected static  voidanalysePass2(Package pack, ProgressTracker pt)
     Parsing pass 2.
Now that all classes in packages are already known, unqualified references can be qualified clearly.
public static  voidbuildSource(Package p, File dir, File[] sources, Sourclet sourclet)
     Output object tree of source code elements as Java source files, applying a Sourclet for formatting the code.
Parameters:
  p - Package containing all other packages with classes that are to be output as formatted source code.
Parameters:
  dir - Base directory where to output .java-files.
public static  DocumentbuildXML(Package p)
     Output an object tree of source code elements to XML.
Parameters:
  p - Package containing all other packages with classes that are to be converted to XML.
protected static  charendsQuoted(String s)
    
protected static  DocumentBuildergetDocumentBuilder()
     Creates XML document builder.
public static  Stringindent(String s, int depth)
     Tool function: indent a multi-line string by depth blank characters in front of each line.
protected static  voidlog(String msg)
     Outputs a log message if the verbose-flag is set..
public static  Packageparse(File file, ProgressTracker pt)
     Create object tree from Java source inputs.
public static  Packageparse(File[] files, ProgressTracker pt)
     Create object tree from Java source inputs.
Parameters:
  files - A list of files and/or directories.
public static  voidparse(File[] files, Package basePackage, ProgressTracker pt)
     Parses files and adds the parsed objects to the specified base package.
public static  voidparse(File file, Package basePackage, ProgressTracker pt)
     Parses a file and adds the parsed objects to the specified bas package.
public static  Packageparse(String[] filenames, ProgressTracker pt)
     Create object tree from Java source inputs.
protected static  voidparsePass1(Package basePackage, File[] files, ProgressTracker pt)
    
public static  PackageparseXML(InputStream in)
     Create object tree from XML input, previously created from parsed .java-files.
protected static  intquoteEnd(String s, int pos, char quoteChar)
    
protected static  StringreadFile(File f)
    
public static  Stringrepeat(String s, int c)
     Tool function: create a new String which contains s repeated c times.
public static  Stringreplace(String s, String old, String neu)
     Tool function: replace any occurrence of old in s with neu.
protected static  voidwarning(String msg)
     Outputs a warning message, which is the same as outputting a log message, but is performed even is verbose==false.
protected static  StringworkaroundAvoidUnicodeSingleChar(String s)
     Replaces all occurrences of single-character-constants using unicode with a pseudo-string.
public static  StringworkaroundRestoreUnicodeSingleChar(String s)
     Restores manipualted Java source code which avoided single-char unicode characters back to the original code.

Field Detail
VERSION
final public static String VERSION(Code)
Version



documentBuilder
protected static DocumentBuilder documentBuilder(Code)
Document builder for parsing XML. Will be initialized when first used.



includeXMLDoctype
public static boolean includeXMLDoctype(Code)
Flag specifying whether to include a DTD reference () into generated XML. Externally set.



logPerformer
public static LogPerformer logPerformer(Code)
Log performer, may be set externally.



nl
public static String nl(Code)
Linefeed.



validateXML
public static boolean validateXML(Code)
Flag specifying whether to validate an XML file against its DTD before it is parsed. Externally set.



verbose
public static boolean verbose(Code)
Global verbose flag.



workaroundUnicodeSingleCharMarker
final protected static String workaroundUnicodeSingleCharMarker(Code)
Constant workaroundUnicodeSingleCharMarker.





Method Detail
analysePass1
protected static void analysePass1(Package basePackage, InputStream in, String source, ProgressTracker pt) throws IOException, ParseException(Code)
Parsing pass 1.
This calls the parser generated by JavaCC and converts input source code into an object-structure.

throws:
  IOException - if an i/o error occurs
See Also:   SourceParser.analysePass2



analysePass2
protected static void analysePass2(Package pack, ProgressTracker pt) throws IOException, ParseException(Code)
Parsing pass 2.
Now that all classes in packages are already known, unqualified references can be qualified clearly. So let classes/ interfaces perform their 'real' initialization now.
throws:
  IOException - if an i/o error occurs
See Also:   SourceParser.analysePass1



buildSource
public static void buildSource(Package p, File dir, File[] sources, Sourclet sourclet) throws IOException(Code)
Output object tree of source code elements as Java source files, applying a Sourclet for formatting the code.
Parameters:
  p - Package containing all other packages with classes that are to be output as formatted source code.
Parameters:
  dir - Base directory where to output .java-files. A directory structure matching the classes' packages structure will be created.
Parameters:
  sourclet - The Sourclet to use for formatting the output.
throws:
  IOException - if an i/o error occurs



buildXML
public static Document buildXML(Package p)(Code)
Output an object tree of source code elements to XML.
Parameters:
  p - Package containing all other packages with classes that are to be converted to XML. The XML DOM-document.
See Also:   SourceParser.parseXML



endsQuoted
protected static char endsQuoted(String s)(Code)



getDocumentBuilder
protected static DocumentBuilder getDocumentBuilder()(Code)
Creates XML document builder.



indent
public static String indent(String s, int depth)(Code)
Tool function: indent a multi-line string by depth blank characters in front of each line.



log
protected static void log(String msg)(Code)
Outputs a log message if the verbose-flag is set..
Parameters:
  msg - The log message string.



parse
public static Package parse(File file, ProgressTracker pt) throws IOException, ParseException(Code)
Create object tree from Java source inputs.
throws:
  IOException - if an i/o error occurs Root package (named "") containing all other packages with classes.



parse
public static Package parse(File[] files, ProgressTracker pt) throws IOException, ParseException(Code)
Create object tree from Java source inputs.
Parameters:
  files - A list of files and/or directories. Any .java-file will be parsed, any other ignored.
throws:
  IOException - if an i/o error occurs Root package (named "") containing all other packages with classes.



parse
public static void parse(File[] files, Package basePackage, ProgressTracker pt) throws IOException, ParseException(Code)
Parses files and adds the parsed objects to the specified base package.
throws:
  IOException - if an i/o error occurs



parse
public static void parse(File file, Package basePackage, ProgressTracker pt) throws IOException, ParseException(Code)
Parses a file and adds the parsed objects to the specified bas package.
throws:
  IOException - if an i/o error occurs



parse
public static Package parse(String[] filenames, ProgressTracker pt) throws IOException, ParseException(Code)
Create object tree from Java source inputs.
throws:
  IOException - if an i/o error occurs Base package (named "") containing all other packages with classes.



parsePass1
protected static void parsePass1(Package basePackage, File[] files, ProgressTracker pt) throws IOException, ParseException(Code)

throws:
  IOException - if an i/o error occurs



parseXML
public static Package parseXML(InputStream in) throws IOException, SAXException(Code)
Create object tree from XML input, previously created from parsed .java-files.
throws:
  IOException - if an i/o error occurs
throws:
  SAXException - if an XML parser error occurs Base package (named "") containing all other packages with classes.
See Also:   SourceParser.buildXML



quoteEnd
protected static int quoteEnd(String s, int pos, char quoteChar)(Code)



readFile
protected static String readFile(File f) throws IOException(Code)

throws:
  IOException - if an i/o error occurs



repeat
public static String repeat(String s, int c)(Code)
Tool function: create a new String which contains s repeated c times.



replace
public static String replace(String s, String old, String neu)(Code)
Tool function: replace any occurrence of old in s with neu.



warning
protected static void warning(String msg)(Code)
Outputs a warning message, which is the same as outputting a log message, but is performed even is verbose==false.
Parameters:
  msg - The warning message string.



workaroundAvoidUnicodeSingleChar
protected static String workaroundAvoidUnicodeSingleChar(String s)(Code)
Replaces all occurrences of single-character-constants using unicode with a pseudo-string. This way, the parser does not resolve the unicode char. This is quite an ugly workaround, but usually not too costy, as single unicode chars are rarely used.
Parameters:
  s - Java source code string, maybe containg single-char unicode constants. manipulated Java source string
See Also:   SourceParser.workaroundRestoreUnicodeSingleChar(String)



workaroundRestoreUnicodeSingleChar
public static String workaroundRestoreUnicodeSingleChar(String s)(Code)
Restores manipualted Java source code which avoided single-char unicode characters back to the original code. Called only from Code.java.
Parameters:
  s - manipulated Java source string, as returned from workaroundAvoidUnicodeSingleChar() the original Java source code, as it had been passed as input to workaroundAvoidUnicodeSingleChar()
See Also:   SourceParser.workaroundAvoidUnicodeSingleChar(String)



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.