Package Torello.JavaDoc
Class Field
- java.lang.Object
-
- Torello.JavaDoc.Declaration
-
- Torello.JavaDoc.Field
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
,java.lang.Comparable<Field>
public class Field extends Declaration implements java.io.Serializable, java.lang.Comparable<Field>, java.lang.Cloneable
Similar tojava.lang.reflect
This class is heavily used internally, and can be used (if needed) to modify Java Doc Web-Pages, programmatically.
HTML Processors that sort the Web-Page "Summary-Tables" will provide instances of this class to your Summary-Sorter Handler methods. Summary-Sorter handlers usually implement theSummarySorterHelper
interface; please review that class for more about sorting Java-Doc Page Summary Tables.
The HTML Processors that upgrade Web-Page "Detail Elements" also rely heavily on this class. Please review the class:ReflHTML
for more information about Java-Doc Web-Page Detail Sections.Reflection Class:
Holds all information extracted from'.java'
Source-Files about Field's identified in that file.
Instances of this Class are Obtained From:
Use of the Reflection-HTML API is *NOT REQUIRED* to perform a standard Java Doc HTML File Upgrade. This "extra API" allows for programmatic modification of Java Doc HTML. This class contains quite a bit of reflected information, and furthermore, here there is a hook to the Native Java Parser Reflection Class.ReflHTML
&SummaryTableHTML
ClassField
allows for storing the name, definition and modifiers list of a Field.- See Also:
- Serialized Form
Hi-Lited Source-Code:- View Here: Torello/JavaDoc/Field.java
- Open New Browser-Tab: Torello/JavaDoc/Field.java
File Size: 13,008 Bytes Line Count: 303 '\n' Characters Found
-
-
Field Summary
Serializable ID Modifier and Type Field protected static long
serialVersionUID
Reflection & Inspection final-String(s) Modifier and Type Field String
definition
String
type
String
typeJOW
Source-Parser Library-Hook References (Transient / Not Serializable) Modifier and Type Field VariableTree
variableTree
-
Fields inherited from class Torello.JavaDoc.Declaration
annotations, body, entity, id, jdComment, jduAnnotationMirrors, location, modifiers, name, signature
-
-
-
-
Field Detail
-
serialVersionUID
protected static final long serialVersionUID
This fulfils the SerialVersion UID requirement for all classes that implement Java'sinterface java.io.Serializable
. Using theSerializable
Implementation offered by java is very easy, and can make saving program state when debugging a lot easier. It can also be used in place of more complicated systems like "hibernate" to store data as well.- See Also:
- Constant Field Values
- Code:
- Exact Field Declaration Expression:
protected static final long serialVersionUID = 1;
-
definition
public final java.lang.String definition
The definition of this field, as aString
.
-
type
public final java.lang.String type
The type / class of this field, as aString
.
-
typeJOW
public final java.lang.String typeJOW
The type / class of this field, as aString
.
JOW: Just One Word
The Just One Word convention used by the JDU Tool elminates BOTH Package-Name Information AND (for Inner-Types / Nested-Types) any & all Container-Class Information from the Type-String's
.
The Java-Doc Upgrader does not perform a Compiler-Styled "Linking Pass" on the Java-Doc Web-Pages it parses, and must suffice with the unlinked Type-Names provided by the Oracle AST-Parser and Java-Doc'.html'
Output Pages.
As an example of this, If a parameter to aMethod
, or the type of aField
inside of a class had the fully qualified type-name:java.util.stream.Stream.Builder<String>
theJOW-String
for that type would simply be the word"Builder"
For Arrays:
If the type, itself, is an array of any kind, any & all Array-Brackets will be included in thisString
-Name. Please review the Example Table, below:Output JOW-String Input Type "Entry"
"java.util.Map.Entry<K, V>"
"Vector"
"java.util.Vector<E>"
"Vector"
"Vector<TagNode>"
"Vector"
"Vector<Vector<TagNode>>"
"Vector"
"java.util.Vector<Vector<TagNode>>"
"String"
"String"
"String"
"java.lang.String"
"String[]"
"java.lang.String[]"
"Integer"
"Integer"
"Integer[]"
"java.lang.Integer[]"
"String[]"
"String..."
"String[]"
"java.lang.String..."
-
variableTree
public final transient com.sun.source.tree.VariableTree variableTree
Hook Reference to Sun/Oracle Parser-Refletion Class
Though this class offers a streamlined set of reflection features, the Native Oracle Library Reflection-Classes offer a detailed AST interface into the standard Java Compiler. If you would like to use these Tree's to provide further code analysis on your Java-Doc Pages, this field is provided as a convenience for such purposes.
If a user decides to make use of the native OracleVariableTree
-Instance that was used to build thisField
-Instance, theVariableTree
may be retrieved from thistransient
field.
-
-
Method Detail
-
toString
public java.lang.String toString()
Generates aString
of this field, with all information included.- Overrides:
toString
in classDeclaration
- Returns:
- A printable
String
of this field. - See Also:
toString(int)
- Code:
- Exact Method Body:
String defStr = (definition == null) ? "null" : StrPrint.abbrevEndRDSF(definition, MAX_STR_LEN, true); return "Name: [" + name + "]\n" + "Declaration: [" + StrPrint.abbrevEndRDSF(signature, MAX_STR_LEN, true) + "]\n" + "Type: [" + type + "]\n" + "Definition: [" + defStr + "]\n" + "Modifiers: [" + StrCSV.toCSV(modifiers, true, true, null) + "]\n" + // This will **NEVER** be null - unless 'this' instance was built from an HTML File, // rather than a source-code file. Instances like that are only used temporarily, and // are garbage collected instantly. Do this check anyway (just in case). "Location: " + ((this.location == null) ? "null" : ('[' + this.location.quickSummary() + ']'));
-
toString
public java.lang.String toString(int flags)
This method accepts a'flags'
parameter which has been constructed using the Bit-Masks provided by thePF
class. Please view the Static-Constants which are provided by classPF
for more information about modifying the return-value of thistoString(int)
method.
There is additional information printed by this'toString'
method (versus the zero-argument, standard, Java'toString'
). This method will print any available Java-Doc Comment's that were placed on thisField
.
This'toString'
also allows for adding UNIX-Terminal color codes.- Overrides:
toString
in classDeclaration
- Parameters:
flags
- These are defined in thePrint-Flags
class- Returns:
- A printable
String
of thisField
. - See Also:
PF
,toString()
- Code:
- Exact Method Body:
boolean color = (flags & UNIX_COLORS) > 0; return printedName("Field", 15, color) + printedDeclaration(15, color) + printedType(jowFlags(flags)) + printedDefinition(color) + printedModifiers(15) + printedLocation(15, color, (flags & BRIEF_LOCATION) > 0) + // The previous method does not add a '\n' end to the end of the returned string // This is optional, it adds a '\n' AT THE BEGINNING if it is included printedComments(15, color, (flags & JAVADOC_COMMENTS) > 0);
-
compareTo
public int compareTo(Field f)
Java'sinterface Comparable<T>
requirements. This does a very simple comparison using the two field'sDeclaration.name
field.- Specified by:
compareTo
in interfacejava.lang.Comparable<Field>
- Parameters:
f
- Any otherField
to be compared to'this' Field
- Returns:
- An integer that fulfills Java's
Comparable<Field>
interface requirements. - Code:
- Exact Method Body:
return (this == f) ? 0 : this.name.compareTo(f.name);
-
equals
public boolean equals(Field other)
This should be called an "atypical version" of the usualequals(Object other)
method. This version of equals merely compares the name of the field defined. The presumption here is that the definition of a 'field' only has meaning - at all - inside the context of aclass, interface,
orenumerated-type
where that field is defined. Since inside any'.java'
source-code file, there may only be one field with a given name, this method shall returnTRUE
whenever the field being compared also has the same name.- Parameters:
other
- This may be any other field. It is strongly suggested that'other'
be a field defined in the same'.java'
source-code file as'this'
field.- Returns:
- This method returns
TRUE
when'this'
instance ofField
has the same'name'
as the name-field of input-parameter'other'
- Code:
- Exact Method Body:
return this.name.equals(other.name);
-
-