private static void addAdviceToMatchedCube(Advice advice, String regex, NCube ncube, Axis axis) { if (axis != null) { // Controller methods for (Column column : axis.getColumnsWithoutDefault()) { String method = column.getValue().toString(); String classMethod = ncube.getName() + '.' + method + "()"; if (classMethod.matches(regex)) { ncube.addAdvice(advice, method); } } } else { // Expressions String classMethod = ncube.getName() + ".run()"; if (classMethod.matches(regex)) { ncube.addAdvice(advice, "run"); } } }