Package Torello.JavaDoc
Class Constructor
- java.lang.Object
-
- Torello.JavaDoc.Declaration
-
- Torello.JavaDoc.Callable
-
- Torello.JavaDoc.Constructor
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
,java.lang.Comparable<Constructor>
public class Constructor extends Callable implements java.io.Serializable, java.lang.Comparable<Constructor>, 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 Constructor'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
Classclass Constructor
allows for storing the name, definition, modifiers list, etc... of a constructor.
Reflection-Classes Inheritance-Diagram
Native JDK API Hook:
All reflection classes above, also contain an additional (transient
, non-Serializable
) field that hooks into the native Java Tree-Parser Tools available in JDK Packagecom.sun.source.tree.*
If a more in-depth Code-Analysis is needed, the JDK's AST's have full and complete Parses of your Source-Code that can facilitate almost any analysis.- See Also:
- Serialized Form
Hi-Lited Source-Code:- View Here: Torello/JavaDoc/Constructor.java
- Open New Browser-Tab: Torello/JavaDoc/Constructor.java
File Size: 12,493 Bytes Line Count: 285 '\n' Characters Found
-
-
Field Summary
Serializable ID Modifier and Type Field static long
serialVersionUID
Java-Parser Library-Hook Reference (Transient / Not Serializable) Modifier and Type Field MethodTree
methodTree
-
Fields inherited from class Torello.JavaDoc.Callable
autoFindID, exceptions, parameterAnnotations, parameterNames, parameterTypes, parameterTypesJOW
-
Fields inherited from class Torello.JavaDoc.Declaration
annotations, body, entity, id, jdComment, location, modifiers, name, signature
-
-
Constructor Summary
Public Constructors that are Intended for Internal-Use, Only Constructor Constructor(MethodTree mt, TreeUtils util, String constructorName)
Constructor(Torello.JDUInternal.DATA_RECORDS.MainLoopData.CallableSignature cSig)
Constructor(Torello.JDUInternal.DATA_RECORDS.MainLoopData.CallableSignature cSig, Constructor cFromSourceParser)
-
Method Summary
Methods: interface java.lang.Comparable Modifier and Type Method int
compareTo(Constructor c)
Methods: class java.lang.Object Modifier and Type Method boolean
equals(Constructor other)
String
toString()
String
toString(int flags)
-
Methods inherited from class Torello.JavaDoc.Callable
getParameterAnnotations, getParameterType, getParameterTypeJOW, hasAnnotatedParameters, numAnnotatedParameters, numParameters
-
-
-
-
Field Detail
-
serialVersionUID
public 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:
public static final long serialVersionUID = 1;
-
methodTree
public final transient com.sun.source.tree.MethodTree methodTree
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 Sun/OracleMethodTree
instance that was used to build thisConstructor
instance, it may be retrieved from thistransient
field.
NOTE: The packagecom.sun.source.tree
"reuses" or "overloads" theMethodTree
object such that it may represent either a Method, or a Constructor. When aMethodTree
instance is actually representing a constructor, the name that is used for the instance will be'<init>'
, rather than a method that abides by the standard Java naming conventions.
-
-
Method Detail
-
toString
public java.lang.String toString()
Generates a string of this constructor, with most information included.
NOTE: This will not return every piece of information contained by this class. For example, both the constructor body, and any possible JavaDoc Comments are not included. For a more enhancedtoString()
version, call the one that accepts flags.- Overrides:
toString
in classCallable
- Returns:
- A printable string of this field.
- See Also:
PF
,toString(int)
,StrCSV.toCSV(String[], boolean, boolean, Integer)
- Code:
- Exact Method Body:
return "Name: [" + name + "]\n" + "Signature: [" + StrPrint.abbrevEndRDSF(signature, MAX_STR_LEN, true) + "]\n" + "Modifiers: [" + StrCSV.toCSV(modifiers, true, true, null) + "]\n" + printedParameterNamesTS() + printedParameterTypesTS() + printedExceptionsTS() + // 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 class expects a flags that has been masked using the constant (public, static, final int
) fields of classPF
. Please view this class for more information about the flags available for modifying the return-value of thistoString()
method.- Overrides:
toString
in classCallable
- Parameters:
flags
- These are thetoString
flags from class PF ("Print Flags"). View available flags listed in classPF
.- Returns:
- A printable
String
of thisConstructor
, with comment information included as well. - See Also:
toString()
,StrCSV.toCSV(String[], boolean, boolean, Integer)
,PF
- Code:
- Exact Method Body:
boolean color = (flags & UNIX_COLORS) > 0; return printedName("Constructor", 20, color) + printedSignature(20, color) + printedModifiers(20) + printedParamNames() + printedParamTypes(jowFlags(flags)) + printedExceptions() + printedLocation(20, color, (flags & BRIEF_LOCATION) > 0) + // The previous method does not add a '\n' end to the end of the returned string // These are both optional, they add a '\n' AT THE BEGINNING if one of them is included printedComments(20, color, (flags & JAVADOC_COMMENTS) > 0) + printedCallableBody(flags);
-
compareTo
public int compareTo(Constructor c)
Java'sinterface Comparable<T>
requirements. This looks at the number of parameters, and parameter types in making a sort-decision.- Specified by:
compareTo
in interfacejava.lang.Comparable<Constructor>
- Parameters:
c
- Any otherConstructor
to be compared to'this' Constructor
- Returns:
- An integer that fulfils Java's
interface Comparable<Constructor> public boolean compareTo(Constructor c)
method requirements. - Code:
- Exact Method Body:
if (this == c) return 0; int ret = this.numParameters() - c.numParameters(); if (ret != 0) return ret; if (this.parameterTypesJOW != null) for (int i=0; i < this.parameterTypesJOW.size(); i++) { ret = this.parameterTypesJOW.get(i).compareTo(c.parameterTypesJOW.get(i)); if (ret != 0) return ret; } return 0;
-
equals
public boolean equals(Constructor other)
This should be called an "atypical version" of the usualequals(Object other)
constructor. This version of equals merely compares the name and parameters-list of the constructor. The presumption here is that the definition of a 'constructor' only has meaning - at all - inside the context of aclass
orenumerated-type
where that constructor is defined. Since inside any'.java'
source-code file, there may only be one constructor with a given parameter-list, this shall returnTRUE
whenever the constructor being compared has the same parameter types as'this'
does.- Parameters:
other
- This may be any other constructor. It is strongly suggested that this be a constructor defined in the same'.java'
source-code file as 'this' constructor.- Returns:
- This method returns
TRUE
when 'this' instance of Constructor has the same parameter-list as'other'
. - Code:
- Exact Method Body:
// If the number of parameters in the 'other' instance of Constructor differ from the // number of parameters in 'this' Constructor, then return FALSE immediately. It cannot be // a match if (this.numParameters() != other.numParameters()) return false; // If there are no parameters (for either of them), then return true immediately if (this.numParameters() == 0) return true; // If any of the parameter-names are different, break immediately and return false; for (int i=0; i < this.parameterNames.size(); i++) if (! this.parameterNames.get(i).equals(other.parameterNames.get(i))) return false; // If the parameter-types listed by the javadoc '.html' file differ from parameter-types // listed in the original '.java' source-code file, then break immediately. // // NOTE: The "package-information" for the FULL CLASS OR INTERFACE NAME is not always // available. for (int i=0; i < this.parameterTypes.size(); i++) if (! this.parameterTypesJOW.get(i).equals(other.parameterTypesJOW.get(i))) return false; // ALL TESTS PASSED return true;
-
-