Package com.influxdb.v3.client
Class Point
java.lang.Object
com.influxdb.v3.client.Point
Point defines the values that will be written to the database.
See Go Implementation.
- Author:
- Jakub Bednar (bednar@github) (11/10/2018 11:40)
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncopy()
Creates a copy of this object.static Point
fromValues
(PointValues values) Create a new Point with given values.getBooleanField
(String name) Gets the boolean field value associated with the specified name.Get field of given name.<T> T
Get field of given name as type.String[]
Gets an array of field names.Class<?>
getFieldType
(String name) Gets the type of field with given name, if it exists.getFloatField
(String name) Gets the float field value associated with the specified name.getIntegerField
(String name) Gets the integer field value associated with the specified name.Get measurement name.getStringField
(String name) Gets the string field value associated with the specified name.Gets value of tag with given name.String[]
Gets an array of tag names.Get timestamp in nanoseconds.boolean
Has point any fields?static Point
measurement
(String measurementName) Create a new Point withe specified a measurement name.removeField
(@NonNull String name) Removes a field with the specified name if it exists; otherwise, it does nothing.Removes a tag with the specified name if it exists; otherwise, it does nothing.setBooleanField
(String name, boolean value) Adds or replaces a boolean field.AddBoolean
field.AddDouble
field.AddLong
field.AddNumber
field.AddObject
field.AddString
field.Adds or replaces fields for this point.setFloatField
(String name, double value) Adds or replaces a float field.setIntegerField
(String name, long value) Adds or replaces a integer field.setMeasurement
(String measurement) Updates the measurement for the point.setStringField
(String name, String value) Adds or replaces a string field.Adds or replaces a tag value for this point.Adds or replaces tags for this point.setTimestamp
(Long time, WritePrecision precision) Updates the timestamp for the point.setTimestamp
(Number time, WritePrecision precision) Updates the timestamp for the point.setTimestamp
(Instant time) Updates the timestamp for the point.Transform to Line Protocol with nanosecond precision.toLineProtocol
(WritePrecision precision) Transform to Line Protocol.
-
Constructor Details
-
Point
Create a new Point.- Parameters:
measurementName
- the measurement name
-
-
Method Details
-
measurement
Create a new Point withe specified a measurement name.- Parameters:
measurementName
- the measurement name- Returns:
- new instance of
Point
-
fromValues
Create a new Point with given values.- Parameters:
values
- the point values- Returns:
- the new Point
- Throws:
Exception
- if measurement is missing
-
getMeasurement
Get measurement name.- Returns:
- Measurement name
-
setMeasurement
Updates the measurement for the point.- Parameters:
measurement
- the measurement- Returns:
- this
-
getTimestamp
Get timestamp in nanoseconds. If the timestamp is not set, returns null.- Returns:
- timestamp or null
-
setTimestamp
Updates the timestamp for the point.- Parameters:
time
- the timestamp- Returns:
- this
-
setTimestamp
Updates the timestamp for the point.- Parameters:
time
- the timestampprecision
- the timestamp precision- Returns:
- this
-
setTimestamp
Updates the timestamp for the point.- Parameters:
time
- the timestampprecision
- the timestamp precision- Returns:
- this
-
getTag
Gets value of tag with given name. Returns null if tag not found.- Parameters:
name
- the tag name- Returns:
- tag value or null
-
setTag
Adds or replaces a tag value for this point.- Parameters:
key
- the tag namevalue
- the tag value- Returns:
- this
-
setTags
Adds or replaces tags for this point.- Parameters:
tagsToAdd
- the Map of tags to add- Returns:
- this
-
removeTag
Removes a tag with the specified name if it exists; otherwise, it does nothing.- Parameters:
name
- the tag name- Returns:
- this
-
getTagNames
Gets an array of tag names.- Returns:
- An array of tag names
-
getFloatField
Gets the float field value associated with the specified name. If the field is not present, returns null.- Parameters:
name
- the field name- Returns:
- The float field value or null
- Throws:
ClassCastException
-
setFloatField
Adds or replaces a float field.- Parameters:
name
- the field namevalue
- the field value- Returns:
- this
-
getIntegerField
Gets the integer field value associated with the specified name. If the field is not present, returns null.- Parameters:
name
- the field name- Returns:
- The integer field value or null
- Throws:
ClassCastException
-
setIntegerField
Adds or replaces a integer field.- Parameters:
name
- the field namevalue
- the field value- Returns:
- this
-
getStringField
Gets the string field value associated with the specified name. If the field is not present, returns null.- Parameters:
name
- the field name- Returns:
- The string field value or null
- Throws:
ClassCastException
-
setStringField
Adds or replaces a string field.- Parameters:
name
- the field namevalue
- the field value- Returns:
- this
-
getBooleanField
Gets the boolean field value associated with the specified name. If the field is not present, returns null.- Parameters:
name
- the field name- Returns:
- The boolean field value or null
- Throws:
ClassCastException
-
setBooleanField
Adds or replaces a boolean field.- Parameters:
name
- the field namevalue
- the field value- Returns:
- this
-
getField
Get field of given name. Can be null if field doesn't exist.- Parameters:
name
- the field name- Returns:
- Field as object
-
getField
Get field of given name as type. Can be null if field doesn't exist.- Type Parameters:
T
- the field type- Parameters:
name
- the field nametype
- the field type Class- Returns:
- Field as given type
- Throws:
ClassCastException
-
getFieldType
Gets the type of field with given name, if it exists. If the field is not present, returns null.- Parameters:
name
- the field name- Returns:
- The field type or null.
-
setField
AddDouble
field.- Parameters:
field
- the field namevalue
- the field value- Returns:
- this
-
setField
AddLong
field.- Parameters:
field
- the field namevalue
- the field value- Returns:
- this
-
setField
AddNumber
field.- Parameters:
field
- the field namevalue
- the field value- Returns:
- this
-
setField
AddString
field.- Parameters:
field
- the field namevalue
- the field value- Returns:
- this
-
setField
AddBoolean
field.- Parameters:
field
- the field namevalue
- the field value- Returns:
- this
-
setField
AddObject
field.- Parameters:
field
- the field namevalue
- the field value- Returns:
- this
-
setFields
Adds or replaces fields for this point.- Parameters:
fieldsToAdd
- the Map of fields to add- Returns:
- this
-
removeField
Removes a field with the specified name if it exists; otherwise, it does nothing.- Parameters:
name
- the field name- Returns:
- this
-
getFieldNames
Gets an array of field names.- Returns:
- An array of field names
-
hasFields
public boolean hasFields()Has point any fields?- Returns:
- true, if the point contains any fields, false otherwise.
-
copy
Creates a copy of this object.- Returns:
- A new instance with same values.
-
toLineProtocol
Transform to Line Protocol with nanosecond precision.- Returns:
- Line Protocol
-
toLineProtocol
Transform to Line Protocol.- Parameters:
precision
- required precision- Returns:
- Line Protocol
-