Exemplo n.º 1
0
  static MethodMatcher getMethodMatcher(Object yaml) {
    MethodMatcher matcher = null;
    if ((yaml instanceof MethodMatcher)) {
      matcher = (MethodMatcher) yaml;
    } else {
      if ((yaml instanceof List)) {
        List list = (List) yaml;
        if ((!list.isEmpty())
            && ((list.get(0) instanceof String))
            && (list.get(0).toString().indexOf('(') < 0)) {
          return createExactMethodMatcher(
              list.get(0).toString().trim(), Strings.trim(list.subList(1, list.size())));
        }

        return OrMethodMatcher.getMethodMatcher(getMethodMatchers(list));
      }
      if ((yaml instanceof String)) {
        String text = yaml.toString().trim();
        int index = text.indexOf('(');
        if (index > 0) {
          String methodName = text.substring(0, index);
          String methodDesc = text.substring(index);
          return createExactMethodMatcher(methodName, methodDesc);
        }
        return new ExactMethodMatcher(text, new String[0]);
      }
    }
    return matcher;
  }
Exemplo n.º 2
0
 public LifecyclePointCut(final ClassTransformer classTransformer) {
   super(
       new PointCutConfiguration(LifecyclePointCut.class),
       OrClassMatcher.getClassMatcher(
           new ExactClassMatcher("com/sun/faces/lifecycle/LifecycleImpl"),
           new ExactClassMatcher("com/sun/faces/mock/MockLifecycle"),
           new ChildClassMatcher("javax/faces/lifecycle/Lifecycle")),
       OrMethodMatcher.getMethodMatcher(
           new ExactMethodMatcher("execute", "(Ljavax/faces/context/FacesContext;)V"),
           new ExactMethodMatcher("render", "(Ljavax/faces/context/FacesContext;)V")));
   classTransformer.getClassNameFilter().addIncludeRegex("^(com/sun/faces/|javax/faces/)(.*)");
 }
Exemplo n.º 3
0
 public SearchComponentPointCut(ClassTransformer classTransformer) {
   super(
       SearchComponentPointCut.class,
       new ChildClassMatcher("org/apache/solr/handler/component/SearchComponent"),
       OrMethodMatcher.getMethodMatcher(
           new MethodMatcher[] {
             new ExactMethodMatcher(
                 "handleResponses",
                 "(Lorg/apache/solr/handler/component/ResponseBuilder;Lorg/apache/solr/handler/component/ShardRequest;)V"),
             new ExactMethodMatcher(
                 "prepare", "(Lorg/apache/solr/handler/component/ResponseBuilder;)V"),
             new ExactMethodMatcher(
                 "process", "(Lorg/apache/solr/handler/component/ResponseBuilder;)V")
           }));
 }