code: public Rule getRule(Resource resource) {
      for (Rule rule : rules) {
        if (rule.matches(resource)) {
          return rule;
        }
      }
      return null;
    }
docs: Get rule matching for the given GraniteUI resource.
  @param resource GraniteUIR resource
  @return matching rule or null