xbn.jdlcode
Class UtilJDLCode

java.lang.Object
  |
  +--xbn.XBNObject
        |
        +--xbn.jdlcode.UtilJDLCode

public class UtilJDLCode
extends XBNObject

Random functions used throughout the xbn.jdlcode package.

Source code:  UtilJDLCode.java.


Field Summary
static String sUD
          To shorten code and Javadoc.
 
Fields inherited from class xbn.XBNObject
bFALSE_IN_PRODUCTION, bTRUE_IN_PRODUCTION, sCNSTR, sES, sLINE_SEP
 
Constructor Summary
UtilJDLCode()
          Create a UtilJDLCode.
 
Method Summary
 void appendRelUrl(SplitLinkCode split_linkCode, StringBuffer str_buffer, JDFile jdf_linkSource, JDCArray jdc_array, boolean b_crashIfBadTarget, boolean b_ignoreIndirectJDLCs)
          Append a relative url to the class-dot-function (or constructor or local function) represented by the parts existing in this SplitLinkCode.
 void appendRelUrl(SplitLinkCode split_linkCode, StringOrBuffer str_orBfr, JDFile jdf_linkSource, JDCArray jdc_array, boolean b_crashIfBadTarget, boolean b_ignoreIndirectJDLCs)
          Append a relative url to the class-dot-function (or constructor or local function) represented by the parts existing in this SplitLinkCode.
 void appendRelUrlToFile(StringBuffer str_buffer, JDFile jdf_linkSource, JDClass jdc_toLinkTo)
          Append the relative url from one html file to another onto the StringBuffer.
 void appendRelUrlToFile(StringOrBuffer str_orBfr, JDFile jdf_linkSource, JDClass jdc_toLinkTo)
          Get the relative url from one html file to another onto the StringOrBuffer.
 void crashIfBadTarget(JDFile jdf_linkSource, SplitLinkCode split_linkCode, JDCArray jdc_array, boolean b_ignoreIndirectJDLCs)
          If the JavaDoc Link Code points to a non-existant target, die with a descriptive error message.
 s_s get2StringsFromLine(String s_cfgFileLine, String s_callingFunc, int i_lineNumber, String s_itemOneType, String s_itemTwoType, boolean b_twoPartsRqd)
          Get two strings from a single line in a class map configuration text file.
 Class getClassForName(String s_fqClassName)
          Get the Class for the provided fully-qualified name.
 Class getClassForName(String s_callingClsFnc, String s_fqClassName)
          Get the Class for the provided fully-qualified name.
 String getJavadocLine(String s_line, JDFile jdf_current, JDCArray jdc_array, boolean b_cibJDLCTarget, boolean b_ignoreIndirectJDLCs)
          Given the provided line of Javadoc, return the same line with all JavaDoc Link Codes translated to actual urls.
 String getJavadocLine(String s_line, JDFile jdf_current, JDCArray jdc_array, boolean b_cibJDLCTarget, boolean b_ignoreIndirectJDLCs, TLAObjects tla_objects)
          Given the provided line of Javadoc, return the same line with all JavaDoc Link Codes translated to actual urls.
 JDCArray getJDCAFromFLR(ForLineRetrieval for_lineRetrieval)
          Create a JDCArray from the provided Doclet Class Map.
 JDCArray getJDCAFromMapFile(String s_mapFile)
          Create a JDCArray from a file.
 JDClass getJDClassFromLine(String s_cfgFileLine, int i_lineNumber, PTArray pt_array)
          Get a new JDClass based on the two values in a line from the class map configuration text file.
 String getJDLinkGapEnd()
          Get the JavaDoc Link Code end gap.
 String getJDLinkGapStart()
          Get the JavaDoc Link Code start gap.
static String getJDLinkGapTextEnd()
          Get the text used for the JavaDoc Link Code end gap.
static String getJDLinkGapTextStart()
          Get the text used for the JavaDoc Link Code start gap.
 StringBuffer getJDTextFromJava(ForLineRetrieval flr_javaSourceCode)
          [SLASH]**, alone on a line (after trimming tabs and spaces), is the start of a JavaDoc comment.
 String getOriginalCode(SplitLinkCode split_linkCode)
          Get the original code, exactly as passed into the SplitLinkCode constructor.
 PackageType getPackageTypeFromLine(String s_cfgFileLine, int i_lineNumber)
          Get a new PackageType based on the one-or-two values in a line from the class map configuration text file.
 String getRelUrl(SplitLinkCode split_linkCode, JDFile jdf_linkSource, JDCArray jdc_array, boolean b_crashIfBadTarget, boolean b_ignoreIndirectJDLCs)
          Get the relative url (to the class-dot-function or constructor or local function), as defined by the parts existing in this SplitLinkCode.
 StringBuffer getRelUrlAppended(SplitLinkCode split_linkCode, StringBuffer str_buffer, JDFile jdf_linkSource, JDCArray jdc_array, boolean b_crashIfBadTarget, boolean b_ignoreIndirectJDLCs)
          Get a copy of the StringBuffer where the relative url (to the class-dot-function or constructor or local function), as defined by the parts existing in this SplitLinkCode, is appended.
 String getRelUrlAppended(SplitLinkCode split_linkCode, String s_tr, JDFile jdf_linkSource, JDCArray jdc_array, boolean b_crashIfBadTarget, boolean b_ignoreIndirectJDLCs)
          Get a copy of the string where the relative url (to the class-dot-function or constructor or local function), as defined by the parts existing in this SplitLinkCode, is appended.
 SOBStringBuffer getRelUrlAppended(SplitLinkCode split_linkCode, StringOrBuffer str_orBfr, JDFile jdf_linkSource, JDCArray jdc_array, boolean b_crashIfBadTarget, boolean b_ignoreIndirectJDLCs)
          Get a copy of the StringOrBuffer (as an SOBStringBuffer) where the relative url (to the class-dot-function or constructor or local function), as defined by the parts existing in this SplitLinkCode, is appended.
 String getRelUrlToFile(JDFile jdf_linkSource, JDClass jdc_toLinkTo)
          Get the relative url from one html file to another.
 int getSamePartCount(JDFile jd_file1, JDFile jd_file2)
          How many "parts" do the provided JDFiles have in common, starting from the left?
 TLAObjects getTLAOForGJL(Outputter optr_dbg)
          Get the TLAObjects needed for getJavadocLine.
 boolean hasSameParams(SplitLinkCode split_linkCode, Class[] ac_parameters, JDCArray jdc_array)
          Do the SplitLinkCode and Class array share the same exact parameter list (including order)?
 void reportJDLinkCodeErrors(String s_docletClassMapFile, String s_dirToAnalyze, boolean b_analyzeJDLCodes, String s_sourceCodeBaseDir, String s_relUrlJDToCodeBases, boolean b_listAllSCLs, boolean b_cibJDLCTarget, boolean b_printXOnTheFly, String s_pkgPrefix, OWriter ow_output)
          This analyzes the source code existing in a directory, verifying all JavaDoc Link Codes, as well as links to source code.
 
Methods inherited from class xbn.XBNObject
getXMsgPrefix, sop, sopl, sopl, throwAX, throwAXIfBadStr, throwAXIfNull, throwAXSpoof
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sUD

public static final String sUD

To shorten code and Javadoc.

Equal to "xbn.jdlcode.UtilJDLCode."

Constructor Detail

UtilJDLCode

public UtilJDLCode()

Create a UtilJDLCode. This constructor does nothing.

Method Detail

getJDLinkGapTextStart

public static final String getJDLinkGapTextStart()

Get the text used for the JavaDoc Link Code start gap.

Returns:
JD

getJDLinkGapTextEnd

public static final String getJDLinkGapTextEnd()

Get the text used for the JavaDoc Link Code end gap.

Returns:
EJD

getJDLinkGapStart

public final String getJDLinkGapStart()

Get the JavaDoc Link Code start gap.

Returns:
UtilGap.getTag(getJDLinkGapTextStart())

getJDLinkGapEnd

public final String getJDLinkGapEnd()

Get the JavaDoc Link Code end gap.

Returns:
UtilGap.getTag(getJDLinkGapTextEnd())

getSamePartCount

public final int getSamePartCount(JDFile jd_file1,
                                  JDFile jd_file2)

How many "parts" do the provided JDFiles have in common, starting from the left?

Parameters:
jd_file1 - The JDFile to compare against jd_file2. May not be null.
jd_file2 - The JDFile to compare against jd_file1. May not be null.
Returns:
For example:

If jd_file1 is... ...and jd_file2 is... ...then this is returned
xbn.jdlcode.JDFile xbn.jdlcode.JDFile 3
xbn.jdlcode.UtilJDLCode xbn.jdlcode.JDFile 2
xbn.array.VWObject xbn.array.UtilArray 1
overview-summary xbn.jdlcode.JDFile 0
xbn.jdlcode.subdoclet.SDClass xbn.jdlcode.JDFile 2
xbn.jdlcode.subdoclet.JDFile xbn.jdlcode.JDFile 2
xbn.jdlcode.JDFile xbn.jdlcode.subdoclet.JDFile 2


getRelUrlToFile

public final String getRelUrlToFile(JDFile jdf_linkSource,
                                    JDClass jdc_toLinkTo)

Get the relative url from one html file to another. This is only a link from one file to another, not to a location within the file.

Returns:
The contents of the SOBStringBuffer: appendRelUrlToFile((new SOBStringBuffer("")), jdf_linkSource, jdc_toLinkTo)

appendRelUrlToFile

public final void appendRelUrlToFile(StringBuffer str_buffer,
                                     JDFile jdf_linkSource,
                                     JDClass jdc_toLinkTo)

Append the relative url from one html file to another onto the StringBuffer.

Equal to appendRelUrlToFile([UtilStringBuffer].getSOBSB(str_buffer, sUD + "appendRelUrlToFile"), jdf_linkSource, jdc_toLinkTo)


appendRelUrlToFile

public final void appendRelUrlToFile(StringOrBuffer str_orBfr,
                                     JDFile jdf_linkSource,
                                     JDClass jdc_toLinkTo)

Get the relative url from one html file to another onto the StringOrBuffer. This is only a link from one file to another, not to a location within the file.

See appendRelUrlToFile.

Parameters:
jdf_linkSource - The JDFile representing the html file in which the link will reside. May not be null.
jdc_toLinkTo - The JDClass representing the html file the link should point to. Must not be primitive.
Returns:
The relative url from the html/class file represented by jf_linkFrom to the html/class file represented jdc_linkTo. For example:

From To Url to file
xbn.jdlcode.UtilJDLCode xbn.string.UtilString ../string/UtilString.html
xbn.string.UtilString xbn.array.VWString VWString.html
xbn.string.UtilString xbn.string.UtilString Empty string
xbn.jdlcode.UtilJDLCode java.lang.Object http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html


get2StringsFromLine

public final s_s get2StringsFromLine(String s_cfgFileLine,
                                     String s_callingFunc,
                                     int i_lineNumber,
                                     String s_itemOneType,
                                     String s_itemTwoType,
                                     boolean b_twoPartsRqd)

Get two strings from a single line in a class map configuration text file. All lines in the class map must be in the form.

[str_one][one_or_more_tabs][str_two]

Parameters:
s_cfgFileLine - A single line from the configuration file. May not be null or zero characters in length. If there are two strings in this line, they must be divided by one or more tabs.
s_callingFunc - The function calling this one, for potential error messages only.
i_lineNumber - The line number of s_cfgFileLine, for potential error messages only.
s_itemOneType - The type description of string one. For potential errors messages only.
s_itemTwoType - The type description of string two. For potential errors messages only.
b_twoPartsRqd - If true, then there must be two strings in s_cfgFileLine, divided by at least one tab. If false, there may be one or two strings.
Returns:
An s_s where the first string is s1 and the second is s2. If no tabs exist, it is assumed that the entire value of this parameter is a single string. sTwo will be null.

getJDClassFromLine

public final JDClass getJDClassFromLine(String s_cfgFileLine,
                                        int i_lineNumber,
                                        PTArray pt_array)

Get a new JDClass based on the two values in a line from the class map configuration text file. See getJDCAFromFLR.

Parameters:
s_cfgFileLine - The line from the class map configuration text file. Must contain exactly two strings (at least one character each), divided by at least one tab. The first string is the abbreviation, and the second string is the fully qualified class name (or file name). Examples:
i			int
o			java.lang.Object
srq		javax.servlet.ServletRequest
pkgjdlc	xbn.jdlcode.package-summary
vwo		xbn.array.VWObject
i_lineNumber - The line number of s_cfgFileLine, for potential error messages only.
pt_array - The PTArray containing all legal package name prefixes.
Returns:
(new JDClass([string1], [string2], pt_array))

getPackageTypeFromLine

public final PackageType getPackageTypeFromLine(String s_cfgFileLine,
                                                int i_lineNumber)

Get a new PackageType based on the one-or-two values in a line from the class map configuration text file. See getJDCAFromFLR and PackageType.

Parameters:
s_cfgFileLine - The line from the class map configuration text file. Must contain exactly two strings (at least one character each), divided by at least one tab. The first string is the PackageType, and the second string (if any) is the base url for that package's JavaDoc. Examples:
java		http://java.sun.com/j2se/1.3/docs/api/
javax		http://java.sun.com/products/servlet/2.2/javadoc/
random_util	file:/home/java_code/random_util/javadoc/
eckggg
xbn
i_lineNumber - The line number of s_cfgFileLine, for potential error messages only.
pt_array - The PTArray containing all legal package name prefixes.
Returns:
(new PackageType([string1], [string2]))

getJDCAFromMapFile

public final JDCArray getJDCAFromMapFile(String s_mapFile)

Create a JDCArray from a file.

Parameters:
s_mapFile - The full path and file name to the class map configuration text file. Must be non-null, and point to an existing and readable text file.
Returns:
getJDCAFromFLR(new FLRFile(s_mapFile))

getJDCAFromFLR

public final JDCArray getJDCAFromFLR(ForLineRetrieval for_lineRetrieval)

Create a JDCArray from the provided Doclet Class Map.

Example code  XmplUtilJDLCode_gjdcafflr.java.  Take a look at the actual XBN Doclet Class Map.

Parameters:
for_lineRetrieval - The ForLineRetrieval containing the source text of the class map configuration text file. Must be in the following form:

[package_type_line1]
[package_type_line2]
[package_type_line3]
...

[divider line]

[class_map_line1]
[class_map_line2]
[class_map_line3]
...

Where...
  • [package_type_line] is in the form required by getPackageTypeFromLine. See PackageType
  • [divider_line] is a line that starts with a single "~" (ignoring trailing tabs and spaces). All characters after it are ignored.
  • [class_map_line] is in the form required by getJDClassFromLine. See JDClass

There must be at least one package type that is local (in other words, has no referring url).

Throws:
AssertException - The special PackageType "overview-summary", with an abbreviation of "over" is defined in this function. An exception is thrown if you also define either in your class map.

getTLAOForGJL

public final TLAObjects getTLAOForGJL(Outputter optr_dbg)

Get the TLAObjects needed for getJavadocLine. See getJavadocLine.

The object is created each time this function is called.

Parameters:
optr_dbg - The Outputter for debugging output. May not be null.

getJavadocLine

public String getJavadocLine(String s_line,
                             JDFile jdf_current,
                             JDCArray jdc_array,
                             boolean b_cibJDLCTarget,
                             boolean b_ignoreIndirectJDLCs)
                      throws TemplateFormatException

Given the provided line of Javadoc, return the same line with all JavaDoc Link Codes translated to actual urls.

Equal to getJavadocLine(s_line, jdf_current, jdc_array, b_cibJDLCTarget, b_ignoreIndirectJDLCs, (new TLAObjects()))


getJavadocLine

public final String getJavadocLine(String s_line,
                                   JDFile jdf_current,
                                   JDCArray jdc_array,
                                   boolean b_cibJDLCTarget,
                                   boolean b_ignoreIndirectJDLCs,
                                   TLAObjects tla_objects)
                            throws TemplateFormatException

Given the provided line of Javadoc, return the same line with all JavaDoc Link Codes translated to actual urls.

It is assumed that jdf_current is legal (represents an html file that actually exists). When called by xbn_doclet.XBNDoclet (via the JavaDoc command), it is. You could easily pass in an invalid one...

Parameters:
s_line - The line of javadoc html. May not be null or zero characters in length.
jdf_current - The JDFile representing the file in which s_line exists. It is therefore the html file in which links will be "from". May not be null. Passed directly to getRelUrl.
jdc_array - The JDCArray containing all existing JDClasses (abbreviations and fully qualified class/file names.). May not be null. Passed directly to getRelUrl.
b_ignoreIndirectJDLCs - Passed directly to the SplitLinkCode constructor.
tla_objects - The TLAObjects provided directly to the TemplateLineAnalyzer constructor. May not be null. This also contains the Outputter used for debugging output. See getTLAOForGJL.

getJDTextFromJava

public final StringBuffer getJDTextFromJava(ForLineRetrieval flr_javaSourceCode)

[SLASH]**, alone on a line (after trimming tabs and spaces), is the start of a JavaDoc comment. **[SLASH], alone on a line (after trimming tabs and spaces), is the end of a JavaDoc comment. This may not exist in any function or code.

Use a single asterisk for internal (existing in functions), multi-lined documentation. For any other multi-line comments that exist outside of functions, but should still be ignored (such as license text), also use a single asterisk. This is not required (as long as the license text has nothing "illegal" in it), but will speed up the javadoc process.


getClassForName

public final Class getClassForName(String s_fqClassName)

Get the Class for the provided fully-qualified name.

Equal to getClassForName(sUD + "getClassForName", s_fqClassName)


getClassForName

public final Class getClassForName(String s_callingClsFnc,
                                   String s_fqClassName)

Get the Class for the provided fully-qualified name. See Class.forName.

Parameters:
s_callingClsFnc - The class-name-plus-function from which potential error messages should appear as coming from.
s_fqClassName - The fully-qualified class name to be analyzed.

crashIfBadTarget

public final void crashIfBadTarget(JDFile jdf_linkSource,
                                   SplitLinkCode split_linkCode,
                                   JDCArray jdc_array,
                                   boolean b_ignoreIndirectJDLCs)

If the JavaDoc Link Code points to a non-existant target, die with a descriptive error message. Otherwise, do nothing.

Example code  XmplUtilJDLCode_cibt.java

Note: This validates JavaDoc Link Codes only, not hard-coded links (or portions thereof). So this link

<A HREF="~JD~getClassForName(s,s)~EJD~#bogus_name_link">my link</A>

is considered legal, because only the part within ~JD~ and ~EJD~ is recognized (and therefore analyzed).

As long as a JavaDoc Link Code exists somewhere within a JavaDoc block, they are all analyzed, even if they're not in the url of an "A HREF" tag.

Parameters:
jdf_linkSource - Represents the html file in which the JavaDoc Link Code exists. May not be null, and hasNoJDLCodes must equal false.
split_linkCode - Holds the JavaDoc Link Code. May not be null, and every part (class, function/constructor, and parameters) must exist in jdc_array. If this contains no class name, then this link is local (it's target class is the same as the class in which the JavaDoc Link Code exists). Therefore, this link's target is jdf_linkSource.getList(".").
jdc_array - Contains information generated from the doclet class map. May not be null.
b_ignoreIndirectJDLCs - If true and jdf_linkSource.hasJDLCsIndirectly equals true and jdf_linkSource.hasJDLCsDirectly equals false, then this function does nothing. If this parameter is false, then indirect links are validated. No matter what, when jdf_linkSource.hasJDLCsDirectly equals true, the JavaDoc Link Code is always validated.

hasSameParams

public final boolean hasSameParams(SplitLinkCode split_linkCode,
                                   Class[] ac_parameters,
                                   JDCArray jdc_array)

Do the SplitLinkCode and Class array share the same exact parameter list (including order)?

Parameters:
split_linkCode - The SplitLinkCode whose parameters should be compared to ac_parameters. May not be null.
ac_parameters - The array of Class objects, which should be compared to split_linkCode's parameter list.
jdc_array - The mapping of full class name to JavaDoc Link Code. May not be null.
Returns:
true If split_linkCode contains the same amount of parameters as ac_parameters.length, and every element X in split_linkCode represents the same class as element X in ac_parameters.
false If otherwise.

getRelUrl

public final String getRelUrl(SplitLinkCode split_linkCode,
                              JDFile jdf_linkSource,
                              JDCArray jdc_array,
                              boolean b_crashIfBadTarget,
                              boolean b_ignoreIndirectJDLCs)

Get the relative url (to the class-dot-function or constructor or local function), as defined by the parts existing in this SplitLinkCode.

Returns:
getRelUrlAppended(SplitLinkCode split_linkCode, "", jdf_linkSource, jdc_array, b_cibJDLCTarget, b_ignoreIndirectJDLCs)

getRelUrlAppended

public final String getRelUrlAppended(SplitLinkCode split_linkCode,
                                      String s_tr,
                                      JDFile jdf_linkSource,
                                      JDCArray jdc_array,
                                      boolean b_crashIfBadTarget,
                                      boolean b_ignoreIndirectJDLCs)

Get a copy of the string where the relative url (to the class-dot-function or constructor or local function), as defined by the parts existing in this SplitLinkCode, is appended.

Returns:
The contents of getSOBSB: appendRelUrl(split_linkCode, [UtilString].getSOBSB(s_tr, sUD + "getRelUrlAppended"), jdf_linkSource, jdc_array, b_crashIfBadTarget, b_ignoreIndirectJDLCs))

getRelUrlAppended

public final StringBuffer getRelUrlAppended(SplitLinkCode split_linkCode,
                                            StringBuffer str_buffer,
                                            JDFile jdf_linkSource,
                                            JDCArray jdc_array,
                                            boolean b_crashIfBadTarget,
                                            boolean b_ignoreIndirectJDLCs)

Get a copy of the StringBuffer where the relative url (to the class-dot-function or constructor or local function), as defined by the parts existing in this SplitLinkCode, is appended.

Returns:
The contents of getSOBSB: appendRelUrl(split_linkCode, [UtilStringBuffer].getSOBSB(str_buffer, sUD + "getRelUrlAppended"), jdf_linkSource, jdc_array, b_crashIfBadTarget, b_ignoreIndirectJDLCs))

appendRelUrl

public final void appendRelUrl(SplitLinkCode split_linkCode,
                               StringBuffer str_buffer,
                               JDFile jdf_linkSource,
                               JDCArray jdc_array,
                               boolean b_crashIfBadTarget,
                               boolean b_ignoreIndirectJDLCs)

Append a relative url to the class-dot-function (or constructor or local function) represented by the parts existing in this SplitLinkCode.

Equal to appendRelUrl(split_linkCode, [UtilSOB].getSOBSB(str_orBfr, sUD + "getRelUrlAppended"), jdf_linkSource, jdc_array, b_crashIfBadTarget, b_ignoreIndirectJDLCs))


getRelUrlAppended

public final SOBStringBuffer getRelUrlAppended(SplitLinkCode split_linkCode,
                                               StringOrBuffer str_orBfr,
                                               JDFile jdf_linkSource,
                                               JDCArray jdc_array,
                                               boolean b_crashIfBadTarget,
                                               boolean b_ignoreIndirectJDLCs)

Get a copy of the StringOrBuffer (as an SOBStringBuffer) where the relative url (to the class-dot-function or constructor or local function), as defined by the parts existing in this SplitLinkCode, is appended.

Returns:
The contents of getSOBSB: appendRelUrl(split_linkCode, [UtilSOB].getSOBSB(str_orBfr, sUD + "getRelUrlAppended"), jdf_linkSource, jdc_array, b_crashIfBadTarget, b_ignoreIndirectJDLCs))

appendRelUrl

public final void appendRelUrl(SplitLinkCode split_linkCode,
                               StringOrBuffer str_orBfr,
                               JDFile jdf_linkSource,
                               JDCArray jdc_array,
                               boolean b_crashIfBadTarget,
                               boolean b_ignoreIndirectJDLCs)

Append a relative url to the class-dot-function (or constructor or local function) represented by the parts existing in this SplitLinkCode.

Parameters:
split_linkCode - The SplitLinkCode containing the JavaDoc Link Code.
str_buffer - The StringBuffer to append the link to.
jdf_linkSource - The JDFile representing the html file in which the link will exist.
jdc_array - The JDCArray containing all class abbreviations.
b_crashIfBadTarget - If true, then the link is checked to ensure that it's target truly exists, and crashes if it doesn't (see crashIfBadTarget). If false, then the link is not checked for validity (and b_ignoreIndirectJDLCs is ignored).
b_ignoreIndirectJDLCs - This parameter is only used when b_crashIfBadTarget equals true. If this parameter is true, then links on indirect link pages are not checked for validity. If false, then when links on indirect link pages are invalid, a crash occurs, with a descriptive error message.

Links found on inderict pages are actually the first sentence in your function/class/constructor's JavaDoc block (for example: "Append a relative url to the..." is the first sentence in this function's JavaDoc block). If they have a link to a function/constructor within the same class, then you would usually not put a class prefix in the JavaDoc Link Code (for example: ~JD~crashIfBadTarget(jdf,slc,jdca,b)~EJD~ is the JavaDoc Link Code for the crashIfBadTarget link, right above). However, JavaDoc Link Codes in the first sentence are also displayed in indirect link pages (such as index pages). If no class prefix exists for the JavaDoc Link Code, then, although the link is valid in the class itself, it is not valid in the inderct link page. Therefore, if the crashIfBadTarget were found in the first sentence, it should have the class prefix: ~JD~utiljdlc#crashIfBadTarget(jdf,slc,jdca,b)~EJD~.

Note: No matter what, functions outside of the JavaDoc Link Code are not validated. So although this link (url equals ~JD~utiljdlc~EJD~#nonExistingFunction()) is broken, since the function is outside the JavaDoc Link Code it's not checked for validity.

Remember also, that zero parameter functions are not allowed inside a JavaDoc Link Code, ever. This is validated by crashIfBadTarget but not the SplitLinkCode constructor (SplitLinkCode just checks formatting, so it assumes that a zero-parameter function is actually a zero-parameter constructor. It does not verify that the target exists, and therefore cannot distinguish between constructors and functions).


getOriginalCode

public final String getOriginalCode(SplitLinkCode split_linkCode)

Get the original code, exactly as passed into the SplitLinkCode constructor. See the SplitLinkCode constructor.


reportJDLinkCodeErrors

public final void reportJDLinkCodeErrors(String s_docletClassMapFile,
                                         String s_dirToAnalyze,
                                         boolean b_analyzeJDLCodes,
                                         String s_sourceCodeBaseDir,
                                         String s_relUrlJDToCodeBases,
                                         boolean b_listAllSCLs,
                                         boolean b_cibJDLCTarget,
                                         boolean b_printXOnTheFly,
                                         String s_pkgPrefix,
                                         OWriter ow_output)

This analyzes the source code existing in a directory, verifying all JavaDoc Link Codes, as well as links to source code.

This checks the basic syntax of all JavaDoc Link Codes existing in your code (via the SplitLinkCode constructor), as well as verifying that each abbreviation (class, function/constructor and parameter) within each JavaDoc Link Code actually exists in your class map configuration text file (via SplitLinkCode.getRelUrl).

Also note that this analyzes the JavaDoc existing directly in your java code (and package.html-s), and not the generated JavaDoc files. So if you have "sandbox" and "build" versions of your code, the sandbox code is analyzed, but the targets are expected to exist in the build-version of the source-code directory.

Parameters

Param name Description Notes
s_docletClassMapFile The path to the DocletClassMap  
s_dirToAnalyze All *.java and *.html files in this directory will be analyzed. Must end with a File.separator. For example, say you want to analyze all XBN Java code, and the source code exists in 'C:\xbnjava\xbn'. This should equal 'C:\xbnjava\xbn\' and s_pkgPrefix should equal null. Alternatively, if you only want to analyze xbn.jdlcode, then this should equal 'C:\xbnjava\xbn\jdlcode\' and s_pkgPrefix should equal 'xbn'
b_analyzeJDLCodes If true, then JavaDoc Link Codes are analyzed for syntax errors. If false, JavaDoc link codes are not analyzed. When false, both b_cibJDLCTarget and b_ignoreIndirectJDLCs are ignored. Also note that you must analyze either JavaDoc Link Codes or source code links, or both. So if this is false, s_sourceCodeBaseDir must be non-null. If s_sourceCodeBaseDir is null, this must equal true.
s_sourceCodeBaseDir If non-null, then source code links are analyzed to ensure they point to existing files. If null, source code links are not analyzed. See Notes for b_analyzeJDLCodes. In addition, when this is non-null, s_relUrlJDToCodeBases is required, and b_listAllSCLs is not ignored. When this is null, s_relUrlJDToCodeBases must also be null, and b_listAllSCLs is ignored.
s_relUrlJDToCodeBases The relative directory (including the final url slash) between the JavaDoc and source-code base directories. Say your JavaDoc root directory is C:\\xbnjava\\documentation\\javadoc\\, and the source code root directory is C:\\xbnjava\\CODE\\. In this case, the relative url between these two directories is ../../CODE/.
b_listAllSCLs If true, then all source code links (regardless if they're valid or not) are printed out in the report, before any potential errors (errors in either source code links or JavaDoc Link Codes) are printed. See Notes for s_sourceCodeBaseDirp.
b_cibJDLCTarget Passed directly to getRelUrl, as b_crashIfBadTarget. See Notes for b_analyzeJDLCodes.
b_printXOnTheFly Should exception messages be printed during the analysis? If true, print exception messages both during analysis and in the report. If false, only in the report.  
s_pkgPrefix The package name prefix, when s_dirToAnalyze points to a sub-package directory. See Notes for s_sourceCodeBaseDir.
ow_output The OWriter to print output to. May not be null.



Copyright 1997-2003, Jeff Epstein, All Rights Reserved. See top of source code files for copyright notice.

 

http://sourceforge.net/projects/xbnjava

 

SourceForge.net Logo