|
Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference 11g Release 1 (11.1.1.1.0) E13403-02 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectoracle.javatools.parser.java.v1.JavaUtilities
public final class JavaUtilities
The JavaUtilities
class provides utility routines for
parsing a Java file (buffer) using the Java Parser. All public
routines in this class are declared static. To use this class,
first get a parsed representation of your buffer by calling
getParseTree()
.
Once you have the parsed representation, you can get other information, such as package name, import names, and so on from the parse tree using the other utility routines in this class.
Method Summary | |
---|---|
static java.lang.String[] |
breakUpQualifiedName(java.lang.String name)
Breaks up the name along '.' boundaries. |
static java.lang.String[] |
convertListToArray(java.util.List list)
Private utility routine which takes a List of Strings, and produces an array of Strings out of it. |
static java.lang.String[] |
getAllImports(RootSymbol rootSymbol)
Utility routine which gets all the import names from the parse tree, including both explicit imports (i.e., java.io.IOException) and multi imports (i.e., java.io.*). |
static int |
getArrayDimension(TypeSymbol typeSymbol)
Utility routine which gets the array dimension of the type represented by the given TypeSymbol structure. |
static java.lang.String |
getClassName(ClassSymbol classSymbol)
Utility routine which gets the class name of the class represented by the given ClassSymbol structure. |
static java.lang.String[] |
getExplicitImports(RootSymbol rootSymbol)
Utility routine which gets the explicit import names from the parse tree (i.e., java.io.IOException). |
static RootSymbol |
getImportsParseTree(TextBuffer textBuffer)
|
static java.lang.String |
getMethodName(MethodSymbol methodSymbol)
Utility routine which gets the method name of the method represented by the given MethodSymbol structure. |
static java.lang.String[] |
getMultiImportPackages(RootSymbol rootSymbol)
Utility routine which gets the multi-import package names from the parse tree (i.e., java.io). |
static java.lang.String[] |
getMultiImports(RootSymbol rootSymbol)
Utility routine which gets the multi-import names from the parse tree (i.e., java.io.*). |
static java.lang.String |
getPackageName(RootSymbol rootSymbol)
Utility routine which gets the package name of the buffer represented by the given parse tree generated by getParseTree(). |
static RootSymbol |
getParseTree(ReadTextBuffer textBuffer)
Utility routine which gets a full parse tree for the given text buffer. |
static RootSymbol |
getParseTree(ReadTextBuffer textBuffer,
boolean fullDepth)
Utility routine which gets a full parse tree for the given text buffer. |
static java.lang.String |
getSymbolName(Nameable nameableSymbol)
Utility routine which gets the name of the NameableSymbol represented by the given parsed structure. |
static java.lang.String |
getSymbolName(NameSymbol nameSymbol)
Utility routine which gets the name contained in a NameSymbol. |
static int |
getSymbolNameLength(Nameable nameableSymbol)
|
static int |
getSymbolNameOffset(Nameable nameableSymbol)
|
static java.lang.String |
getTypeName(TypeSymbol typeSymbol)
Utility routine which gets the type name of the type represented by the given TypeSymbol structure. |
static java.lang.String |
getVariableName(VariableSymbol variableSymbol)
Utility routine which gets the variable name of the variable represented by the given VariableSymbol structure. |
static boolean |
inJavaSymbol(int offset,
JavaSymbol javaSymbol)
Private utility which checks whether the given offset is located in the given JavaSymbol. |
static ExpressionSymbol |
parseExpression(ReadTextBuffer wholeBuffer,
int startOffset,
int endOffset,
Scope scope)
Same as above except that it copies the relevant part of the original buffer so that the ExpressionSymbol can have offsets into the original buffer. |
static ExpressionSymbol |
parseExpression(java.lang.String target)
Convenience routine for parsing an expression. |
static MethodSymbol |
parseMethodDeclaration(java.lang.String target)
Takes a string of the form "void method( int a, Object o )" and generates a MethodSymbol for it. |
static java.lang.String |
trimWhitespace(java.lang.String name)
Returns a new String with leading and trailing whitespace removed. |
static java.lang.String |
trimWhitespace(java.lang.String name,
int start)
Given the following substring, returns a new String that has leading and trailing whitespace removed. |
static java.lang.String |
trimWhitespace(java.lang.String name,
int start,
int end)
Given the following substring, returns a new String that has leading and trailing whitespace removed. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static RootSymbol getParseTree(ReadTextBuffer textBuffer)
textBuffer
- the text buffer to parse
public static RootSymbol getParseTree(ReadTextBuffer textBuffer, boolean fullDepth)
textBuffer
- the text buffer to parsefullDepth
- whether to do a full depth parse (vs. members only)
public static RootSymbol getImportsParseTree(TextBuffer textBuffer)
public static ExpressionSymbol parseExpression(java.lang.String target)
public static ExpressionSymbol parseExpression(ReadTextBuffer wholeBuffer, int startOffset, int endOffset, Scope scope)
public static MethodSymbol parseMethodDeclaration(java.lang.String target)
public static java.lang.String[] getExplicitImports(RootSymbol rootSymbol)
rootSymbol
- the parse tree generated by getParseTree()
public static java.lang.String[] getMultiImports(RootSymbol rootSymbol)
rootSymbol
- the parse tree generated by getParseTree()
public static java.lang.String[] getMultiImportPackages(RootSymbol rootSymbol)
rootSymbol
- the parse tree generated by getParseTree()
public static java.lang.String[] getAllImports(RootSymbol rootSymbol)
rootSymbol
- the parse tree generated by getParseTree()
public static java.lang.String getPackageName(RootSymbol rootSymbol)
rootSymbol
- the parse tree generated by getParseTree()
public static java.lang.String getClassName(ClassSymbol classSymbol)
classSymbol
- the class structure in the parse tree representing
the class in question
public static java.lang.String getMethodName(MethodSymbol methodSymbol)
methodSymbol
- the method structure in the parse tree representing
the method in question
public static java.lang.String getVariableName(VariableSymbol variableSymbol)
variableSymbol
- the variable structure in the parse
tree representing the variable in question
public static java.lang.String getTypeName(TypeSymbol typeSymbol)
typeSymbol
- the type structure in the parse tree representing
the type in question
public static int getSymbolNameOffset(Nameable nameableSymbol)
public static int getSymbolNameLength(Nameable nameableSymbol)
public static java.lang.String getSymbolName(Nameable nameableSymbol)
nameableSymbol
- an instance of a JavaSymbol that is a Nameable,
such as a ClassSymbol or MethodSymbol
public static java.lang.String getSymbolName(NameSymbol nameSymbol)
nameSymbol
- an instance of a NameSymbol
public static int getArrayDimension(TypeSymbol typeSymbol)
typeSymbol
- the type structure in the parse tree representing
the type in question
public static java.lang.String[] convertListToArray(java.util.List list)
list
- the input list of Strings
public static boolean inJavaSymbol(int offset, JavaSymbol javaSymbol)
offset
- the offset to checkjavaSymbol
- the javaSymbol to check
public static java.lang.String trimWhitespace(java.lang.String name, int start, int end)
public static java.lang.String trimWhitespace(java.lang.String name, int start)
public static java.lang.String trimWhitespace(java.lang.String name)
public static java.lang.String[] breakUpQualifiedName(java.lang.String name)
|
Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference 11g Release 1 (11.1.1.1.0) E13403-02 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |