class JMXMetricHolder {

  public Optional<Object> find(String pattern) {
    JmxPattern jmxPattern = JmxPattern.parse(pattern);
    return beans.stream()
      .map(jmxPattern::extract)
      .filter(Optional::isPresent)
      .map(Optional::get)
      .findFirst();
  }

}