/**
* 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)) {
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)) {
tuple = PatternFactory.createCallPatternTuple(m_expression, m_package);
m_memberPattern = Pattern.compileCallerSidePattern(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.THROWS)) {
tuple = PatternFactory.createThrowsPatternTuple(m_expression, m_package);
m_memberPattern = Pattern.compileThrowsPattern(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
tuple = PatternFactory.createCallPatternTuple(m_expression, m_package);
m_memberPattern = Pattern.compileCallerSidePattern(tuple.getMemberPattern());
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());
}
}