final class CommonAstSupport extends AbstractPatternWorker
The implementations of variables and user functions are contained within a
number of public, inner classes. They must be public in order for their
members to be accessible via reflection (without policy file changes). They
are registered just after construction with the AstSymbolResolver
provided by the PatternEngine
. They are accessed by instances of
the Rule
class via logical expressions at runtime.
Modifier and Type | Class and Description |
---|---|
class |
CommonAstSupport.Library
Implementation of basic symbol resolution and comparison-type user
function services specific to AST processing.
|
static class |
CommonAstSupport.UserGeneratedException
Indicates a P2J internal error was encountered during pattern engine processing.
|
Modifier and Type | Field and Description |
---|---|
private PatternEngine |
engine
The engine which created this worker.
|
resolver
Constructor and Description |
---|
CommonAstSupport(PatternEngine engine)
Default constructor which defines the symbol libraries to be registered.
|
Modifier and Type | Method and Description |
---|---|
private java.lang.reflect.Constructor |
matchConstructor(java.lang.reflect.Constructor[] candidates,
java.lang.Class[] signature,
boolean strict)
Try to match a constructor from the list of candidates, based upon a
parameter signature.
|
finish, getCopy, getLibrary, getSource, initialize, registerTree, resolveConstant, setLibrary, visitAst
private final PatternEngine engine
CommonAstSupport(PatternEngine engine)
engine
- The engine which created this worker.private java.lang.reflect.Constructor matchConstructor(java.lang.reflect.Constructor[] candidates, java.lang.Class[] signature, boolean strict)
candidates
- An array of constructors from which to select a match.signature
- The parameter signature to be matched among the candidate
constructors.strict
- true
to conduct a strict match of primitive
numeric arguments, else false
. In a strict match,
a primitive, numeric parameter type (or its wrapper class
type) will match only the same primitive, numeric parameter
type (or its wrapper class type). In a non-strict match, any
primitive, numeric parameter type (or its wrapper class type)
will match any other primitive, numeric parameter type (or
its wrapper class type). The assumption in the non-strict case
is that with enough wrapping/unwrapping and casting, any
numeric type can be converted to any other numeric type
(though information may be lost in narrowing conversions).Constructor
instance (if any), or
null
if no match was found.java.lang.IllegalArgumentException
- if more than one suitable matching constructor was detected
(indicating ambiguity).