Beispiel #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;
  }
Beispiel #2
0
 public MetricNameFormat getMetricNameFormat(
     ClassMethodSignature sig, Object object, Object[] args) {
   if (Strings.isEmpty(prefix)) {
     return new ClassMethodMetricNameFormat(sig, object);
   }
   return new ClassMethodMetricNameFormat(sig, object, prefix);
 }