|
Extension SDK 9.0.5 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
A helper object that exposes Java-specific attributes and operations computed during the course of an Audit traversal but not yet available through the JOT API.
An analyzer can obtain the JavaHelper
at the beginning of an
audit by overriding Analyzer#enter(AuditContext)
as follows:
private JavaHelper helper;
public void enter (AuditContext context)
{
helper = (JavaHelper) context.getAttribute(context.sharedKey(JavaHelper.class));
}
Many of the methods below can only be invoked from an exit method for that construct; each method documents its specific invocation restrictions.
Method Summary | |
JotType |
getArgumentType(JotUnaryExpression expression)
Gets the actual argument type of a unary expression, or null if the argument type is unresolvable. |
JotType[] |
getArgumentTypes(JotClassAllocation expression)
Gets the actual argument types of a class instance creator, one for each argument. |
JotType[] |
getArgumentTypes(JotInfixExpression expression)
Gets the actual argument types of a binary expression, one for each argument. |
JotType[] |
getArgumentTypes(JotMethodCall expression)
Gets the actual argument types of a method call, one for each argument. |
JotType[] |
getArgumentTypes(JotQuestionExpression expression)
Gets the actual argument types of a conditional expression, one for each argument. |
JotConstructor |
getCalledConstructor(JotClassAllocation expression)
Gets the constructor called by a class allocation, or null if the constructor call is unresolvable. |
JotMethod |
getCalledMethod(JotMethodCall expression)
Gets the method called by a method call, or null if the method call is unresolvable. |
JotClass |
getClass(java.lang.String name)
Gets a type by name, or null if not present. |
JotMethod |
getDeclaredMethod(JotClass type,
java.lang.String name,
java.lang.String[] parameterTypes)
Gets the method declared by a type that matches a signature, or null if no matching method is declared in the type. |
JotType[] |
getExpressionTypes(JotForInitializer construct)
Gets the types of the expressions in a for initializer, one for each expression. |
JotCodeElement |
getReferredVariable(JotMethodCall expression)
Gets the field, local variable, or parameter referred to by the primary expression embedded in a method call, or null if none. |
JotCodeElement |
getReferredVariable(JotPrimaryExpression expression)
Gets the field, local variable, or parameter referred to by a primary expression, or null if none. |
java.util.Iterator |
getReferredVariablesOrTypes(JotMethodCall expression)
Gets the fields, local variables, parameters, or types referred to by each element of the primary expression embedded in a method call, in left to right order, or an empty list if none. |
java.util.Iterator |
getReferredVariablesOrTypes(JotPrimaryExpression expression)
Gets the fields, local variables, parameters, or types referred to by each element of a primary expression, in left to right order, or an empty list if none. |
JotType |
getSearchType(JotMethodCall expression)
Gets the type of the context for the search for the called method, or null if the type is unresolvable (in this case, getType(oracle.jdeveloper.jot.JotExpression) will also
return null). |
JotType |
getType(JotExpression expression)
Gets the type of an expression, or null if the type is unresolvable. |
java.util.Set |
getUses(JotField field)
Gets the uses of a field within the constructs audited. |
java.util.Set |
getUses(JotLocalVariable method)
Gets the uses of a local variable within the constructs audited. |
java.util.Set |
getUses(JotMethod method)
Gets the uses of a method within the constructs audited. |
java.util.Set |
getUses(JotParameter method)
Gets the uses of a parameter within the constructs audited. |
boolean |
isAssignableFrom(JotClass target,
JotClass source)
Gets whether a class is assignable from another class. |
boolean |
matches(JotMethod method,
java.lang.String name,
java.lang.String[] parameterTypes)
Gets whether a method matches a signature. |
Method Detail |
public JotClass getClass(java.lang.String name)
name
- The unqualified or qualified name of a class.
java.lang.IllegalStateException
- if invoked on a Workspaces
or Workspace
construct (one without an implicit
project context).public boolean isAssignableFrom(JotClass target, JotClass source)
JotClass.isAssignableFrom
because of
bugs with primitive types and with interfaces.
public JotType getType(JotExpression expression)
java.lang.IllegalArgumentException
- unless invoked from the exit
method for the expression.public JotType[] getExpressionTypes(JotForInitializer construct)
java.lang.IllegalArgumentException
- unless invoked from the exit
method for the for initializer.public JotMethod getCalledMethod(JotMethodCall expression)
java.lang.IllegalArgumentException
- unless invoked from the exit
method for the method call.public JotConstructor getCalledConstructor(JotClassAllocation expression)
java.lang.IllegalArgumentException
- unless invoked from the exit
method for the method call.public JotType getSearchType(JotMethodCall expression)
getType(oracle.jdeveloper.jot.JotExpression)
will also
return null). For an unqualified method call, this is the class immediately
enclosing the method call. For a qualified method call, this is the type
of the expression or type name preceding the last ".". Note that this type
may be different from (for example, be a subclass of) the type which
declares the method actually called
.
java.lang.IllegalArgumentException
- unless invoked from the exit
method for the method call.public JotType[] getArgumentTypes(JotMethodCall expression)
java.lang.IllegalArgumentException
- unless invoked from the exit
method for the method call.public JotType[] getArgumentTypes(JotClassAllocation expression)
java.lang.IllegalArgumentException
- unless invoked from the exit
method for the method call.public JotType[] getArgumentTypes(JotInfixExpression expression)
java.lang.IllegalArgumentException
- unless invoked from the exit
method for the binary expression.public JotType[] getArgumentTypes(JotQuestionExpression expression)
java.lang.IllegalArgumentException
- unless invoked from the exit
method for the conditional expression.public JotType getArgumentType(JotUnaryExpression expression)
java.lang.IllegalArgumentException
- unless invoked from the exit
method for the unary expression.public JotCodeElement getReferredVariable(JotPrimaryExpression expression)
JotField
, JotLocalVariable
, or JotParameter
referred to by the expression, or null.
java.lang.IllegalArgumentException
- unless invoked from the exit
method for the primary expression.public java.util.Iterator getReferredVariablesOrTypes(JotPrimaryExpression expression)
Iterator
yielding the JotField
s,
JotLocalVariable
s, JotParameter
s, and
JotType
s referred to by the embedded expression, or an
empty list if none.
java.lang.IllegalArgumentException
- unless invoked from the exit
method for the primary expression.public JotCodeElement getReferredVariable(JotMethodCall expression)
JotField
, JotLocalVariable
, or JotParameter
referred to by the embedded expression, or null.
java.lang.IllegalArgumentException
- unless invoked from the exit
method for the method call.public java.util.Iterator getReferredVariablesOrTypes(JotMethodCall expression)
Iterator
yielding the JotField
s,
JotLocalVariable
s, JotParameter
s, and
JotType
s referred to by the embedded expression, or an
empty list if none.
java.lang.IllegalArgumentException
- unless invoked from the exit
method for the method call.public java.util.Set getUses(JotMethod method)
Location
of a JotMethodCall that calls this method.
Location
s from which the method is called.public java.util.Set getUses(JotField field)
Location
of a JotPrimaryExpression or a JotMethodCall that uses
this field.
Location
s from which the field is used.public java.util.Set getUses(JotLocalVariable method)
Location
of a JotPrimaryExpression or a JotMethodCall that
uses this local variable.
Location
s from which the local variable is used.
java.lang.IllegalArgumentException
- unless invoked from the enter
(not exit) method for the local variable.public java.util.Set getUses(JotParameter method)
Location
of a JotPrimaryExpression or JotMethodCall that uses
this parameter.
Location
s from which the parameter is used.
java.lang.IllegalArgumentException
- unless invoked from the enter
(not exit) method for the parameter.public boolean matches(JotMethod method, java.lang.String name, java.lang.String[] parameterTypes)
method
- A Jot method.name
- The signature method name.parameterTypes
- The signature parameter types, an array of fully-
qualified names, empty or null if no parameters.public JotMethod getDeclaredMethod(JotClass type, java.lang.String name, java.lang.String[] parameterTypes)
type
- A Jot class.name
- The name of the method.parameterTypes
- An array of fully-qualified parameter type names.
|
Extension SDK | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 1997, 2004, Oracle. All rights reserved.