@Test void addFields() { HashMap<String, Object> fields = new HashMap<>(); fields.put("level", 2); fields.put("accepted", true); fields.put("power", 2.56); fields.put("clean", null); Point point = Point .measurement("h2o") .addTag("location", "europe") .addFields(fields); Assertions.assertThat(point.toLineProtocol()).isEqualTo("h2o,location=europe accepted=true,level=2i,power=2.56"); }
@Nonnull public Point addFields(@Nonnull final Map<String, Object> fieldsToAdd) { Arguments.checkNotNull(fieldsToAdd, "fieldsToAdd"); fieldsToAdd.forEach(this::putField); return this; }
Point { @Nonnull public Point addFields(@Nonnull final Map<String, Object> fieldsToAdd) { Arguments.checkNotNull(fieldsToAdd, "fieldsToAdd"); fieldsToAdd.forEach(this::putField); return this; } }
Point { @Nonnull public Point addFields(@Nonnull final Map<String, Object> fieldsToAdd) { Arguments.checkNotNull(fieldsToAdd, "fieldsToAdd"); fieldsToAdd.forEach(this::putField); return this; } Point(@Nonnull final String measurementName); }
Point { @Nonnull public Point addFields(@Nonnull final Map<String, Object> fieldsToAdd) { Arguments.checkNotNull(fieldsToAdd, "fieldsToAdd"); fieldsToAdd.forEach(this::putField); return this; } Point(@Nonnull final String measurementName); @Nonnull static Point measurement(@Nonnull final String measurementName); @Nonnull Point addTag(@Nonnull final String key, @Nullable final String value); @Nonnull Point addTags(@Nonnull final Map<String, String> tagsToAdd); @Nonnull Point addField(@Nonnull final String field, final boolean value); Point addField(@Nonnull final String field, final long value); @Nonnull Point addField(@Nonnull final String field, final double value); @Nonnull Point addField(@Nonnull final String field, @Nullable final Number value); @Nonnull Point addField(@Nonnull final String field, @Nullable final String value); @Nonnull Point addFields(@Nonnull final Map<String, Object> fieldsToAdd); @Nonnull Point time(@Nullable final Instant time, @Nonnull final WritePrecision precision); @Nonnull Point time(@Nullable final Number time, @Nonnull final WritePrecision precision); @Nonnull Point time(@Nullable final Long time, @Nonnull final WritePrecision precision); @Nonnull WritePrecision getPrecision(); boolean hasFields(); @Nonnull String toLineProtocol(); @Nonnull String toLineProtocol(@Nullable final PointSettings pointSettings); }
Point { @Nonnull public Point addFields(@Nonnull final Map<String, Object> fieldsToAdd) { Arguments.checkNotNull(fieldsToAdd, "fieldsToAdd"); fieldsToAdd.forEach(this::putField); return this; } Point(@Nonnull final String measurementName); @Nonnull static Point measurement(@Nonnull final String measurementName); @Nonnull Point addTag(@Nonnull final String key, @Nullable final String value); @Nonnull Point addTags(@Nonnull final Map<String, String> tagsToAdd); @Nonnull Point addField(@Nonnull final String field, final boolean value); Point addField(@Nonnull final String field, final long value); @Nonnull Point addField(@Nonnull final String field, final double value); @Nonnull Point addField(@Nonnull final String field, @Nullable final Number value); @Nonnull Point addField(@Nonnull final String field, @Nullable final String value); @Nonnull Point addFields(@Nonnull final Map<String, Object> fieldsToAdd); @Nonnull Point time(@Nullable final Instant time, @Nonnull final WritePrecision precision); @Nonnull Point time(@Nullable final Number time, @Nonnull final WritePrecision precision); @Nonnull Point time(@Nullable final Long time, @Nonnull final WritePrecision precision); @Nonnull WritePrecision getPrecision(); boolean hasFields(); @Nonnull String toLineProtocol(); @Nonnull String toLineProtocol(@Nullable final PointSettings pointSettings);  }