Convert class for metric field to AutoValue

This reduces the number of static methods for creating fields and allows
us to extend the Field class in future.

Change-Id: Ieaaacddd03b1e04e4e91f000eff950ecb292ec25
Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
Edwin Kempin
2019-06-26 11:12:14 +02:00
parent 9ded2760b0
commit 441ac9783d
22 changed files with 144 additions and 175 deletions

View File

@@ -189,10 +189,10 @@ class MetricJson {
String description;
FieldJson(Field<?> field) {
this.name = field.getName();
this.description = field.getDescription();
this.name = field.name();
this.description = field.description().orElse(null);
this.type =
Enum.class.isAssignableFrom(field.getType()) ? field.getType().getSimpleName() : null;
Enum.class.isAssignableFrom(field.valueType()) ? field.valueType().getSimpleName() : null;
}
}
}