コード例 #1
0
  @Override
  public Metric metric(CanonicalPath metric) {
    Query query = Query.path().with(With.path(metric), With.type(Metric.class)).get();

    Page<Metric> page =
        inventory.execute(query, Metric.class, Pager.unlimited(Order.unspecified()));

    List<Metric> metrics = page.toList();
    return metrics.isEmpty() ? null : metrics.get(0);
  }
コード例 #2
0
  @Override
  public Set<Metric> metricsOfType(CanonicalPath metricType) {
    Query query =
        Query.path()
            .with(With.path(metricType))
            .with(Related.by(Relationships.WellKnown.defines))
            .with(With.type(Metric.class))
            .get();

    Page<Metric> page =
        inventory.execute(query, Metric.class, Pager.unlimited(Order.unspecified()));

    List<Metric> metrics = page.toList();
    return new HashSet<>(metrics);
  }