/**
* Compiles the pattern for the expression.
*/
protected void compilePattern() {
PatternTuple tuple = null;
if (m_type == null) {
throw new ExpressionException("pointcut type in context can not be null");
}
if (m_type.equals(PointcutType.EXECUTION)) {
if (Pattern.isConstructor(m_expression)) {
tuple = PatternFactory.createConstructorPatternTuple(m_expression, m_package);
m_memberPattern = Pattern.compileConstructorPattern(tuple.getMemberPattern());
}
else {
tuple = PatternFactory.createMethodPatternTuple(m_expression, m_package);
m_memberPattern = Pattern.compileMethodPattern(tuple.getMemberPattern());
}
m_isHierarchical = tuple.isHierarchical();
m_classPattern = Pattern.compileClassPattern(tuple.getCalleeClassPattern());
}
else if (m_type.equals(PointcutType.CALL)) {
if (Pattern.isConstructor(m_expression)) {
tuple = PatternFactory.createCallPatternTuple(Pattern.CONSTRUCTOR, m_expression, m_package);
m_memberPattern = Pattern.compileCallerSidePattern(Pattern.CONSTRUCTOR, tuple.getMemberPattern());
}
else {
tuple = PatternFactory.createCallPatternTuple(Pattern.METHOD, m_expression, m_package);
m_memberPattern = Pattern.compileCallerSidePattern(Pattern.METHOD, tuple.getMemberPattern());
}
m_isHierarchical = tuple.isHierarchical();
m_isHierarchicalCallee = tuple.isHierarchicalCallee();
m_classPattern = Pattern.compileClassPattern(tuple.getCallerClassPattern());
}
else if (m_type.equals(PointcutType.SET) || m_type.equals(PointcutType.GET)) {
tuple = PatternFactory.createFieldPatternTuple(m_expression, m_package);
m_memberPattern = Pattern.compileFieldPattern(tuple.getMemberPattern());
m_isHierarchical = tuple.isHierarchical();
m_classPattern = Pattern.compileClassPattern(tuple.getCalleeClassPattern());
}
else if (m_type.equals(PointcutType.CFLOW)) {
// cflow compiled as caller side pattern
if (Pattern.isConstructor(m_expression)) {
tuple = PatternFactory.createCallPatternTuple(Pattern.CONSTRUCTOR, m_expression, m_package);
m_memberPattern = Pattern.compileCallerSidePattern(Pattern.CONSTRUCTOR, tuple.getMemberPattern());
}
else {
tuple = PatternFactory.createCallPatternTuple(Pattern.METHOD, m_expression, m_package);
m_memberPattern = Pattern.compileCallerSidePattern(Pattern.METHOD, tuple.getMemberPattern());
}
m_isHierarchical = tuple.isHierarchical();
m_classPattern = Pattern.compileClassPattern(tuple.getCalleeClassPattern());
}
else if (m_type.equals(PointcutType.HANDLER)) {
tuple = PatternFactory.createClassPatternTuple(m_expression, m_package);
m_isHierarchical = tuple.isHierarchical();
m_classPattern = Pattern.compileClassPattern(tuple.getCalleeClassPattern());
}
else if (m_type.equals(PointcutType.CLASS)) {
tuple = PatternFactory.createClassPatternTuple(m_expression, m_package);
m_isHierarchical = tuple.isHierarchical();
m_classPattern = Pattern.compileClassPattern(tuple.getCalleeClassPattern());
}
}