Jagger
 All Classes Namespaces Files Functions Variables Enumerator Groups Pages
JLimitVsRefValue.java
Go to the documentation of this file.
1 package com.griddynamics.jagger.user.test.configurations.limits;
2 
3 import com.griddynamics.jagger.user.test.configurations.limits.auxiliary.JMetricName;
4 import com.griddynamics.jagger.user.test.configurations.limits.auxiliary.RefValue;
5 import com.griddynamics.jagger.util.StandardMetricsNamesUtil;
6 
7 import java.util.Objects;
8 
12 public class JLimitVsRefValue extends JLimit {
13 
14  private Double refValue;
15 
16 
18  super(builder);
19  this.refValue = builder.refValue.value();
20  }
21 
29  public static Builder builder(String metricId, RefValue refValue) {
30  return new Builder(metricId, refValue);
31  }
32 
43  public static JLimitVsRefValue.Builder builder(String scenarioId, String stepId, String metricId, RefValue refValue) {
44  return new Builder(StandardMetricsNamesUtil.generateScenarioStepMetricRegexp(scenarioId, stepId, metricId), refValue);
45  }
46 
54  public static Builder builder(JMetricName metricId, RefValue refValue) {
55  return new Builder(metricId.transformToString(), refValue);
56  }
57 
68  public static JLimitVsRefValue.Builder builder(String scenarioId, String stepId, JMetricName metricId, RefValue refValue) {
69  return new Builder(StandardMetricsNamesUtil.generateScenarioStepMetricRegexp(scenarioId, stepId, metricId.transformToString()), refValue);
70  }
71 
72  public static class Builder extends JLimit.Builder {
73  private RefValue refValue;
74 
75  private Builder(String metricId, RefValue refValue) {
76  Objects.requireNonNull(metricId);
77  Objects.requireNonNull(refValue);
78 
79  this.metricId = metricId;
80  this.refValue = refValue;
81  }
82 
83  @Override
84  public JLimit build() {
85  return new JLimitVsRefValue(this);
86  }
87  }
88 
89  public Double getRefValue() {
90  return refValue;
91  }
92 }