001package io.ebean.meta;
002
003/**
004 * An abstract MetricVisitor that handles the boolean flags - reset, collectTransactionMetrics and collectQueryMetrics.
005 */
006public abstract class AbstractMetricVisitor implements MetricVisitor {
007
008  private final boolean reset;
009  private final boolean collectTransactionMetrics;
010  private final boolean collectQueryMetrics;
011  private final boolean collectL2Metrics;
012
013  public AbstractMetricVisitor(boolean reset, boolean collectTransactionMetrics, boolean collectQueryMetrics, boolean collectL2Metrics) {
014    this.reset = reset;
015    this.collectTransactionMetrics = collectTransactionMetrics;
016    this.collectQueryMetrics = collectQueryMetrics;
017    this.collectL2Metrics = collectL2Metrics;
018  }
019
020  @Override
021  public boolean isReset() {
022    return reset;
023  }
024
025  @Override
026  public boolean isCollectTransactionMetrics() {
027    return collectTransactionMetrics;
028  }
029
030  @Override
031  public boolean isCollectQueryMetrics() {
032    return collectQueryMetrics;
033  }
034
035  @Override
036  public boolean isCollectL2Metrics() {
037    return collectL2Metrics;
038  }
039
040  @Override
041  public void visitStart() {
042    // do nothing by default
043  }
044
045  @Override
046  public void visitEnd() {
047    // do nothing by default
048  }
049}
050