| java.lang.Object de.gulden.util.javasource.sourclet.AbstractSourclet de.gulden.util.javasource.sourclet.standard.StandardSourclet
StandardSourclet | public class StandardSourclet extends AbstractSourclet (Code) | | The StandardSourclet used by BeautyJ.
See documentation of Beauty and the Java Sourclet API.
author: Jens Gulden version: 1.1 |
Constructor Summary | |
public | StandardSourclet() Creates a new instance of StandardSourclet. |
Method Summary | |
protected String | applyCodeFormatting(String code) Apply code transformations according to options set by the user. | public void | buildBodySource(OutputStream out, SourceObjectDeclared o) Outputs the body content of the source object. | protected static void | buildDocumentationTagged(OutputStream out, DocumentationTagged tag, String spaces) Builds the documentation tagged. | public void | buildEndSource(OutputStream out, SourceObjectDeclared o) Outputs everything that occurs after the SourceObject. | public void | buildHeadSource(OutputStream out, SourceObjectDeclared o) Outputs the head part of a source object. | protected void | buildHeader(OutputStream out, char mark, String header) Outputs a seperating header, if the corresponding option is set. | protected void | buildHeader(OutputStream out, char mark, String header, String headerPlural, int num) Outputs a seperating header, if the corresponding option is set. | protected void | buildHeader(OutputStream out, char mark, String header, int num) Outputs a seperating header, if the corresponding option is set. | protected void | buildSourceAll(OutputStream out, Vector v, String header) Builds all source objects in Vector v , sorted by
- public
- protected
- package-private
- private
modifiers.
In front of the generated code, a header is attached which names the type
of the source objects, distinguishing between singular (if v.size()==1) and plural (f v.size()>1) form.
Here, the plural form is derived from simply adding an 's', which works for
most english words. | protected void | buildSourceAll(OutputStream out, Vector v, String header, String headerPlural) Builds all source objects in Vector v , sorted by
- public
- protected
- package-private
- private
modifiers.
In front of the generated code, a header is attached which names the type
of the source objects, distinguishing between singular (if v.size()==1) and plural (f v.size()>1) form. | public void | buildStartSource(OutputStream out, SourceObjectDeclared o) Outputs the start part of a source object.
This is the part which comes before the 'normal' head
(e.g. | protected void | buildTagDocumentation(OutputStream out, SourceObjectDeclared o, DocumentationDeclared doc, DocumentationDeclared supDoc) Builds the tag documentation. | protected void | buildTagDocumentationSynthesize(OutputStream out, String typeName, String tagName, String tagItem, String defaultValue, DocumentationDeclared doc, DocumentationDeclared supDoc, String spaces, boolean synthesize) Builds the tag documentation synthesize. | public static String | chars(char mark, int count) Returns a string repeating the character mark
for count times. | public static String | cleanCode(String c) Removes out-commented dead lines of from a block of Java code. | protected String | format(String code) Format a code block according to standard auto-indentation rules. | protected String | getExceptionText(String exc) Returns the associated description for the exception class name specified by exc . | protected String | getHeaderfile() If a headerfile is specified, get the content as string. | protected static String | getParentQualifier(String name) Returns the parent part of a fully qualified identifier name. | public static String | getSpecialPrefix(String id) Returns the special prefix of the identifer, if there is any. | public static String | getTypeCode(SourceObject o) Returns the canonical string representation of a SourceObject's type. | public static boolean | hasSpecialPrefix(String id) Tests whether the identifier has a special prefix. | protected String | indent(String text, int steps) Indents a given block of text by the given number of steps. | protected String | indent(int steps) Returns a string with spaces. | public static boolean | isDeadCodeLine(String l) Tests whether a line of Java code is an out-commented dead line of code. | public static boolean | isDummy(String text) | public static String | isodate() Returns the current date in ISO date format yyyy-MM-dd. | protected String | makeSureIsQualifyable(Class inClass, String unqualified, String qualified) Tests if an unqulified class name can be fully qualified inside a class declaration. | public static String | replace(String s, String find, String repl) Replaces all occurrences of string find in s by repl . | public static String | spaces(int count) Returns a string repeating the space character
for count times. | public static String | startWithStars(String s, String spaces) Appends a vertical line of star characters in front of s . | public static String | toWords(String s) Convert a string of format "xxxYyyyZzzz" to "xxx yyyy zzzz".
This is a simple mechanism to retrieve english language
for auto-generating Javadoc comments from semantically rich identifier names.
Parameters: s - The identifier name. | protected static DocumentationDeclared | tryGetDocumentationFromSuperclass(SourceObjectDeclared o) | public static String | unqualify(String n) Return the name part of an identifier behind the last '.' occurrence.
Parameters: n - The qualified (or already unqualified) identifier name. | protected String | unqualifyClassname(Class inClass, String name) |
defaultExceptionTexts | protected static String defaultExceptionTexts(Code) | | These defaults are also named for option doc.exception.texts in the configuration XML File.
But if they are overwritten by the user, they still get used, so keep here as constant and always add to user's texts.
|
headerfileText | protected String headerfileText(Code) | | The headerfile text.
|
StandardSourclet | public StandardSourclet()(Code) | | Creates a new instance of StandardSourclet.
|
applyCodeFormatting | protected String applyCodeFormatting(String code)(Code) | | Apply code transformations according to options set by the user.
|
buildBodySource | public void buildBodySource(OutputStream out, SourceObjectDeclared o) throws IOException(Code) | | Outputs the body content of the source object. For example,
in case of methods this is Java code, in case of classes this recursively
contains other SourceObjects' code.
throws: IOException - if an i/o error occurs |
buildHeader | protected void buildHeader(OutputStream out, char mark, String header, String headerPlural, int num) throws IOException(Code) | | Outputs a seperating header, if the corresponding option is set. Depending on num ,
the plural or singular form is used (or nothing, if num==0).
throws: IOException - if an i/o error occurs |
buildHeader | protected void buildHeader(OutputStream out, char mark, String header, int num) throws IOException(Code) | | Outputs a seperating header, if the corresponding option is set. Depending on num ,
a plural or singular form is used (or nothing, if num==0). The plural is auto-generated by adding an 's'.
throws: IOException - if an i/o error occurs |
buildSourceAll | protected void buildSourceAll(OutputStream out, Vector v, String header) throws IOException(Code) | | Builds all source objects in Vector v , sorted by
- public
- protected
- package-private
- private
modifiers.
In front of the generated code, a header is attached which names the type
of the source objects, distinguishing between singular (if v.size()==1) and plural (f v.size()>1) form.
Here, the plural form is derived from simply adding an 's', which works for
most english words.
throws: IOException - if an i/o error occurs |
buildSourceAll | protected void buildSourceAll(OutputStream out, Vector v, String header, String headerPlural) throws IOException(Code) | | Builds all source objects in Vector v , sorted by
- public
- protected
- package-private
- private
modifiers.
In front of the generated code, a header is attached which names the type
of the source objects, distinguishing between singular (if v.size()==1) and plural (f v.size()>1) form.
throws: IOException - if an i/o error occurs |
buildStartSource | public void buildStartSource(OutputStream out, SourceObjectDeclared o) throws IOException(Code) | | Outputs the start part of a source object.
This is the part which comes before the 'normal' head
(e.g. before a method's signature), so usually this is
the place where to output Javadoc comments.
throws: IOException - if an i/o error occurs |
chars | public static String chars(char mark, int count)(Code) | | Returns a string repeating the character mark
for count times.
|
format | protected String format(String code)(Code) | | Format a code block according to standard auto-indentation rules.
This is a quick solution and could be done much more sophisticated.
(The current version of the StandardSourclet puts focus in the overall
organization of .java files, not primarily on the code blocks.)
Maybe later versions should incorporate mature code from other OpenSource
beautifier projects here - volunteers welcome!
|
getExceptionText | protected String getExceptionText(String exc)(Code) | | Returns the associated description for the exception class name specified by exc .
|
getHeaderfile | protected String getHeaderfile()(Code) | | If a headerfile is specified, get the content as string.
|
getParentQualifier | protected static String getParentQualifier(String name)(Code) | | Returns the parent part of a fully qualified identifier name.
|
getTypeCode | public static String getTypeCode(SourceObject o)(Code) | | Returns the canonical string representation of a SourceObject's type.
|
indent | protected String indent(String text, int steps)(Code) | | Indents a given block of text by the given number of steps.
The size of each step in 'number of spaces' is set by option
code.indent.spaces.
Indented text. |
indent | protected String indent(int steps)(Code) | | Returns a string with spaces. The number is determined by steps*option('code.indent.spaces').
|
isDeadCodeLine | public static boolean isDeadCodeLine(String l)(Code) | | Tests whether a line of Java code is an out-commented dead line of code.
This is the case when it starts with "//" and end with either ';', '{' or '}'.
|
isodate | public static String isodate()(Code) | | Returns the current date in ISO date format yyyy-MM-dd.
|
makeSureIsQualifyable | protected String makeSureIsQualifyable(Class inClass, String unqualified, String qualified)(Code) | | Tests if an unqulified class name can be fully qualified inside a class declaration.
If this is not the case, depending on the user-option '-code.auto.import' an import statement
is generated, or just a warning message is output.
|
spaces | public static String spaces(int count)(Code) | | Returns a string repeating the space character
for count times.
|
startWithStars | public static String startWithStars(String s, String spaces)(Code) | | Appends a vertical line of star characters in front of s .
s may contain multiple lines, seperated by either \n or \r,
in that case a multi-line result is returned.
|
toWords | public static String toWords(String s)(Code) | | Convert a string of format "xxxYyyyZzzz" to "xxx yyyy zzzz".
This is a simple mechanism to retrieve english language
for auto-generating Javadoc comments from semantically rich identifier names.
Parameters: s - The identifier name. English language fragment retrieved from identifier name. |
unqualify | public static String unqualify(String n)(Code) | | Return the name part of an identifier behind the last '.' occurrence.
Parameters: n - The qualified (or already unqualified) identifier name. The unqualified identifier name. |
|
|