private List<Pattern<T>> getPatternsByTargetClass(Class<?> klass) {
    List<Pattern<T>> ret = null;
    for (Map.Entry<T, List<Pattern<T>>> entry : reverse.entrySet()) {
      T       key     = entry.getKey();
      boolean matched = false;

      if (key == klass) {
        matched = true;
      } else if (!(key instanceof Class<?>)) {
        Class<?> keyClass = key.getClass();
        if (klass.isAssignableFrom(keyClass)) matched = true;
      }

      if (matched) {
        if (ret == null) ret = new ArrayList<Pattern<T>>();
        ret.addAll(entry.getValue());
      }
    }

    return ret;
  }
private List < Pattern < T > > getPatternsByTargetClass ( Class < ? > klass ) { List < Pattern < T > > ret = null ; for ( Map . Entry < T , List < Pattern < T > > > entry : reverse . entrySet ( ) ) { T key = entry . getKey ( ) ; boolean matched = false ; if ( key == klass ) { matched = true ; } else if ( ! ( key instanceof Class < ? > ) ) { Class < ? > keyClass = key . getClass ( ) ; if ( klass . isAssignableFrom ( keyClass ) ) matched = true ; } if ( matched ) { if ( ret == null ) ret = new ArrayList < Pattern < T > > ( ) ; ret . addAll ( entry . getValue ( ) ) ; } } return ret ; }
@return null if there's no match