org.fife.rsta.ac.java
Class Util

java.lang.Object
  extended by org.fife.rsta.ac.java.Util

public class Util
extends Object

Utility methods for Java completion.

Version:
1.0
Author:
Robert Futrell

Method Summary
static String docCommentToHtml(String dc)
          Converts a Java documentation comment to HTML.
static CompilationUnit getCompilationUnitFromDisk(File loc, ClassFile cf)
          Used by MemberCompletion.Data implementations to get an AST from a source file in a directory or zip/jar file.
static String getUnqualified(String clazz)
          Returns the "unqualified" version of a (possibly) fully-qualified class name.
static boolean isFullyQualified(String str)
          Returns whether the specified string is "fully qualified," that is, whether it contains a '.' character.
static String replaceChar(String str, char oldCh, char newCh)
          Does a fast replacement of all instances of one char with another.
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).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

docCommentToHtml

public static final String docCommentToHtml(String dc)
Converts a Java documentation comment to HTML.

Parameters:
dc - The documentation comment.
Returns:
An HTML version of the comment.

getCompilationUnitFromDisk

public static CompilationUnit getCompilationUnitFromDisk(File loc,
                                                         ClassFile cf)
Used by MemberCompletion.Data implementations to get an AST from a source file in a directory or zip/jar file.

Parameters:
loc - A directory or zip/jar file.
cf - The ClassFile representing the source grab from the location.
Returns:
The compilation unit, or null if it is not found or an IO error occurs.

getUnqualified

public static final String getUnqualified(String clazz)
Returns the "unqualified" version of a (possibly) fully-qualified class name.

Parameters:
clazz - The class name.
Returns:
The unqualified version of the name.

isFullyQualified

public static final boolean isFullyQualified(String str)
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.

replaceChar

public static final String replaceChar(String str,
                                       char oldCh,
                                       char newCh)
Does a fast replacement of all instances of one char with another.

Parameters:
str - The string to do the replacements in.
oldCh - The character to look for.
newCh - The character to replace with.
Returns:
The string, possibly with the char replaced.

splitOnChar

public static final 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). This is also fundamentally different than String.split(String)), in the case where str ends with ch - 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 '.').


Copyright © 2003-2011. All Rights Reserved.