public class Point extends Object implements AutoCloseable
InfluxDB.write(Point)
method.Modifier and Type | Method and Description |
---|---|
Boolean |
booleanField(int index)
Get the value of the specified boolean field, by internal index (see
getBooleanFieldIndex(String) ),
as an auto-boxed Boolean . |
Boolean |
booleanField(String field)
Get the value of the specified boolean field as an auto-boxed
Boolean . |
void |
close()
This method is used in conjunction with the
retain() method to return a Point
back to the pool of points maintained by the PointFactory . |
Point |
copy()
Create a copy of this
Point , including its measurement name, tags, and timestamp, but
excluding any fields. |
Point |
copy(String measurement)
Create a copy of this
Point , including its tags and timestamp, but excluding any
fields and using the measurement name specified here. |
Double |
doubleField(int index)
Get the value of the specified double field, by internal index (see
getDoubleFieldIndex(String) ),
as an auto-boxed Double . |
Double |
doubleField(String field)
Get the value of the specified floating point double field as an auto-boxed
Double . |
Point |
field(String field,
boolean value)
Add a boolean field to the
Point with the specified value. |
Point |
field(String field,
double value)
Add a floating point double field to the
Point with the specified value. |
Point |
field(String field,
long value)
Add a long integer field to the
Point with the specified value. |
Point |
field(String field,
String value)
Add a string field to the
Point with the specified value. |
int |
getBooleanFieldIndex(String field)
Get the internal index of the specified boolean field.
|
int |
getDoubleFieldIndex(String field)
Get the internal index of the specified double field.
|
int |
getFieldCount()
Get the number of fields currently set on this
Point . |
Class<?> |
getFieldType(String field)
Get the type of the specified field.
|
int |
getLongFieldIndex(String field)
Get the internal index of the specified long field.
|
int |
getStringFieldIndex(String field)
Get the internal index of the specified String field.
|
int |
getTagCount()
Get the number of tags currently set on this
Point . |
long |
getTimestamp()
Get the timestamp of this
Point in milliseconds. |
Long |
longField(int index)
Get the value of the specified long integer field, by internal index (see
getLongFieldIndex(String) ),
as an auto-boxed Long . |
Long |
longField(String field)
Get the value of the specified long integer field as an auto-boxed
Long . |
String |
measurement()
Get the measurement name of this
Point . |
Point |
measurement(String measurement)
Set the measurement name of this
Point . |
Point |
removeTag(String tag)
Remove a tag from this
Point . |
void |
retain()
Calling this method will prevent the
Point from returning to the pool of points
maintained by the PointFactory until the close() method is called. |
String |
stringField(int index)
Get the value of the specified String field, by internal index (see
getStringFieldIndex(String) ). |
String |
stringField(String field)
Get the value of the specified string field.
|
String |
tag(String tag)
Get the value of the specified tag.
|
Point |
tag(String tag,
String value)
Tag the
Point with the specified string value. |
Point |
timestamp()
Timestamp the
Point with the millisecond resolution time value returned
by System.currentTimeMillis() . |
Point |
timestamp(long timestamp,
TimeUnit timeUnit)
|
String |
toJson() |
String |
toString() |
public Point tag(String tag, String value)
Point
with the specified string value.tag
- the name of the tagvalue
- the string value associated with the tagPoint
public Point field(String field, String value)
Point
with the specified value.field
- the name of the fieldvalue
- the string value associated with the fieldPoint
public Point field(String field, long value)
Point
with the specified value.field
- the name of the fieldvalue
- the long value associated with the fieldPoint
public Point field(String field, double value)
Point
with the specified value.field
- the name of the fieldvalue
- the double value associated with the fieldPoint
public Point field(String field, boolean value)
Point
with the specified value.field
- the name of the fieldvalue
- the boolean value associated with the fieldPoint
public Point timestamp()
Point
with the millisecond resolution time value returned
by System.currentTimeMillis()
.Point
public Point timestamp(long timestamp, TimeUnit timeUnit)
timestamp
- the time valuetimeUnit
- the resolution of the time valuePoint
public long getTimestamp()
Point
in milliseconds.Point
timestamp in millisecondspublic Point measurement(String measurement)
Point
.measurement
- the new measurement namePoint
public String measurement()
Point
.public Point removeTag(String tag)
Point
.tag
- the name of the tag to removePoint
public Long longField(String field)
Long
. If no
long integer field was set on this Point
, the return value will be null
.field
- the name of the long integer fieldnull
public Long longField(int index)
getLongFieldIndex(String)
),
as an auto-boxed Long
. If no such long integer field was set on this Point
, the return value
will be null
.index
- the internal index of the long integer fieldnull
public Double doubleField(String field)
Double
.
If no double field was set on this Point
, the return value will be null
.field
- the name of the double fieldnull
public Double doubleField(int index)
getDoubleFieldIndex(String)
),
as an auto-boxed Double
. If no such double field was set on this Point
, the return value
will be null
.index
- the internal index of the double fieldnull
public Boolean booleanField(String field)
Boolean
. If no
boolean field was set on this Point
, the return value will be null
.field
- the name of the boolean fieldnull
public Boolean booleanField(int index)
getBooleanFieldIndex(String)
),
as an auto-boxed Boolean
. If no such boolean field was set on this Point
, the return value
will be null
.index
- the internal index of the boolean fieldnull
public String stringField(String field)
Point
, the return value will be null
.field
- the name of the string fieldnull
public String stringField(int index)
getStringFieldIndex(String)
).
If no such String field was set on this Point
, the return value will be null
.index
- the internal index of the String fieldnull
public String tag(String tag)
Point
,
the return value will be null
.tag
- the name of the tagnull
public Class<?> getFieldType(String field)
field
- the name of the fieldnull
public int getTagCount()
Point
.public int getFieldCount()
Point
.public int getLongFieldIndex(String field)
longField(String)
.field
- the name of the long integer fieldpublic int getDoubleFieldIndex(String field)
doubleField(String)
.field
- the name of the double fieldpublic int getStringFieldIndex(String field)
stringField(String)
.field
- the name of the String fieldpublic int getBooleanFieldIndex(String field)
booleanField(String)
.field
- the name of the boolean fieldpublic void retain()
Point
from returning to the pool of points
maintained by the PointFactory
until the close()
method is called.
Each invocation of this method effectively increases an internal "retention count" by one (1).
Calling the close()
method effectively reduces the "retention count" by one (1). When
close()
is called, and the "retention count" reaches zero (0), the pool will be
returned back to the pool of points in the PointFactory
.
Every Point
obtained by the PointFactory
has an initial retention count of
one (1). When a point is queued for write by calling InfluxDB.write(Point)
, the
InfluxDB
class will automatically call close()
after the Point
is
written. This method can thus be used to prevent the Point
from being returned to the
pool, making the caller of this method responsible for explicitly calling close()
.
public void close()
retain()
method to return a Point
back to the pool of points maintained by the PointFactory
.
Neither this method, nor the retain()
method, are needed in typical use scenarios.
Only invoke this method if a matching retain()
call has been made, or if you wish
to return the point to the pool without writing it to InfluxDB.
close
in interface AutoCloseable
for more details.
public Point copy()
Point
, including its measurement name, tags, and timestamp, but
excluding any fields.Point
, excluding any fieldspublic Point copy(String measurement)
Point
, including its tags and timestamp, but excluding any
fields and using the measurement name specified here.public String toJson()
Copyright © 2018 Brett Wooldridge. All rights reserved.