Package com.influxdb.v3.client.write
Class Point
- java.lang.Object
-
- com.influxdb.v3.client.write.Point
-
@NotThreadSafe public final class Point extends Object
Point defines the values that will be written to the database. See Go Implementation.- Author:
- Jakub Bednar (bednar@github) (11/10/2018 11:40)
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Point
addField(String field, boolean value)
AddBoolean
field.Point
addField(String field, double value)
AddDouble
field.Point
addField(String field, long value)
AddLong
field.Point
addField(String field, Number value)
AddNumber
field.Point
addField(String field, String value)
AddString
field.Point
addFields(Map<String,Object> fieldsToAdd)
Adds or replaces fields for this point.Point
addTag(String key, String value)
Adds or replaces a tag value for this point.Point
addTags(Map<String,String> tagsToAdd)
Adds or replaces tags for this point.boolean
hasFields()
Has point any fields?static Point
measurement(String measurementName)
Create a new Point withe specified a measurement name.Point
setTimestamp(Long time, WritePrecision precision)
Updates the timestamp for the point.Point
setTimestamp(Number time, WritePrecision precision)
Updates the timestamp for the point.Point
setTimestamp(Instant time)
Updates the timestamp for the point.String
toLineProtocol()
Transform to Line Protocol with nanosecond precision.String
toLineProtocol(WritePrecision precision)
Transform to Line Protocol.
-
-
-
Constructor Detail
-
Point
public Point(@Nonnull String measurementName)
Create a new Point with specified a measurement name.- Parameters:
measurementName
- the measurement name
-
-
Method Detail
-
measurement
@Nonnull public static Point measurement(@Nonnull String measurementName)
Create a new Point withe specified a measurement name.- Parameters:
measurementName
- the measurement name- Returns:
- new instance of
Point
-
addTag
@Nonnull public Point addTag(@Nonnull String key, @Nullable String value)
Adds or replaces a tag value for this point.- Parameters:
key
- the tag namevalue
- the tag value- Returns:
- this
-
addTags
@Nonnull public Point addTags(@Nonnull Map<String,String> tagsToAdd)
Adds or replaces tags for this point.- Parameters:
tagsToAdd
- the Map of tags to add- Returns:
- this
-
addField
@Nonnull public Point addField(@Nonnull String field, boolean value)
AddBoolean
field.- Parameters:
field
- the field namevalue
- the field value- Returns:
- this
-
addField
public Point addField(@Nonnull String field, long value)
AddLong
field.- Parameters:
field
- the field namevalue
- the field value- Returns:
- this
-
addField
@Nonnull public Point addField(@Nonnull String field, double value)
AddDouble
field.- Parameters:
field
- the field namevalue
- the field value- Returns:
- this
-
addField
@Nonnull public Point addField(@Nonnull String field, @Nullable Number value)
AddNumber
field.- Parameters:
field
- the field namevalue
- the field value- Returns:
- this
-
addField
@Nonnull public Point addField(@Nonnull String field, @Nullable String value)
AddString
field.- Parameters:
field
- the field namevalue
- the field value- Returns:
- this
-
addFields
@Nonnull public Point addFields(@Nonnull Map<String,Object> fieldsToAdd)
Adds or replaces fields for this point.- Parameters:
fieldsToAdd
- the Map of fields to add- Returns:
- this
-
setTimestamp
@Nonnull public Point setTimestamp(@Nullable Instant time)
Updates the timestamp for the point.- Parameters:
time
- the timestamp- Returns:
- this
-
setTimestamp
@Nonnull public Point setTimestamp(@Nullable Number time, @Nonnull WritePrecision precision)
Updates the timestamp for the point.- Parameters:
time
- the timestampprecision
- the timestamp precision- Returns:
- this
-
setTimestamp
@Nonnull public Point setTimestamp(@Nullable Long time, @Nonnull WritePrecision precision)
Updates the timestamp for the point.- Parameters:
time
- the timestampprecision
- the timestamp precision- Returns:
- this
-
hasFields
public boolean hasFields()
Has point any fields?- Returns:
- true, if the point contains any fields, false otherwise.
-
toLineProtocol
@Nonnull public String toLineProtocol()
Transform to Line Protocol with nanosecond precision.- Returns:
- Line Protocol
-
toLineProtocol
@Nonnull public String toLineProtocol(@Nullable WritePrecision precision)
Transform to Line Protocol.- Parameters:
precision
- required precision- Returns:
- Line Protocol
-
-