Class Util
java.lang.Object
org.fife.rsta.ac.java.Util
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final PatternOptional leading text for doc comment lines (except the first line) that should be removed if it exists.private static ClassFileprivate static SourceLocationprivate static CompilationUnitA cache of the lastCompilationUnitread from some attached source on disk.(package private) static final PatternPattern matching a link in a "@link" tag. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static voidappendDocCommentTail(StringBuilder sb, StringBuilder tail) private static voidappendLinkTagText(StringBuilder appendTo, String linkContent) Appends HTML representing a "link" or "linkplain" Javadoc element to a string buffer.static StringConverts a Java documentation comment to HTML.private static StringBuilderfixDocComment(StringBuilder text) private static StringfixLinkText(String text) Tidies up a link's display text for use in a <a> tag.private static Stringstatic CompilationUnitUsed byMemberCompletion.Dataimplementations to get an AST from a source file in aSourceLocation.static StringgetUnqualified(String clazz) Returns the "unqualified" version of a (possibly) fully-qualified class name.private static intindexOf(char ch, CharSequence sb, int offs) Returns the next location of a single character in a character sequence.static booleanisFullyQualified(String str) Returns whether the specified string is "fully qualified," that is, whether it contains a '.' character.private static booleanisInPreBlock(String line, boolean prevValue) Returns whether this line ends in the middle of a pre-block.private static StringRemoves the tail end of a documentation comment from a string, if it exists.static String[]splitOnChar(String str, int ch) A faster way to split on a single char than String#split(), since we'll be doing this in a tight loop possibly thousands of times (rt.jar).
-
Field Details
-
DOC_COMMENT_LINE_HEADER
Optional leading text for doc comment lines (except the first line) that should be removed if it exists. -
LINK_TAG_MEMBER_PATTERN
Pattern matching a link in a "@link" tag. This should match the following:- ClassName
- fully.qualified.ClassName
- #method
- #method(int, int)
- String#method
- String#method(params)
- fully.qualified.ClassName#method
- fully.qualified.ClassName#method(params)
"<a href=...") are not matched and should be handled separately. -
lastCUFromDisk
A cache of the lastCompilationUnitread from some attached source on disk. This is cached because, in some scenarios, the methodgetCompilationUnitFromDisk(SourceLocation, ClassFile)will be called for the same class many times in a row (such as to get method parameter info for all methods in a single class). -
lastCUFileParam
-
lastCUClassFileParam
-
-
Constructor Details
-
Util
private Util()Private constructor to prevent instantiation.
-
-
Method Details
-
appendDocCommentTail
-
appendLinkTagText
Appends HTML representing a "link" or "linkplain" Javadoc element to a string buffer.For some information on this format, see http://docs.oracle.com/javase/7/docs/technotes/tools/windows/javadoc.html#see.
- Parameters:
appendTo- The buffer to append to.linkContent- The content of a "link", "linkplain" or "see" item.
-
docCommentToHtml
-
forXML
-
fixDocComment
-
fixLinkText
-
getCompilationUnitFromDisk
Used byMemberCompletion.Dataimplementations to get an AST from a source file in aSourceLocation. Classes should prefer this method over calling into the location directly since this method caches the most recent result for performance.- Parameters:
loc- A directory or zip/jar file.cf- TheClassFilerepresenting the source grab from the location.- Returns:
- The compilation unit, or
nullif it is not found or an IO error occurs.
-
getUnqualified
-
indexOf
Returns the next location of a single character in a character sequence. This method is here because StringBuilder doesn't get this method added to it until Java 1.5.- Parameters:
ch- The character to look for.sb- The character sequence.offs- The offset at which to start looking.- Returns:
- The next location of the character, or -1 if it is not found.
-
isFullyQualified
Returns whether the specified string is "fully qualified," that is, whether it contains a '.' character.- Parameters:
str- The string to check.- Returns:
- Whether the string is fully qualified.
- See Also:
-
isInPreBlock
Returns whether this line ends in the middle of a pre-block.- Parameters:
line- The line's contents.prevValue- Whether this line started in a pre-block.- Returns:
- Whether the line ends in a pre-block.
-
possiblyStripDocCommentTail
-
splitOnChar
A faster way to split on a single char than String#split(), since we'll be doing this in a tight loop possibly thousands of times (rt.jar). This is also fundamentally different fromString.split(String)), in the case wherestrends withch- this method will return an empty item at the end of the returned array, while String#split() will not.- Parameters:
str- The string to split.ch- The char to split on.- Returns:
- The string, split on the character (e.g. '/' or '.').
-