Class 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)
    • 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 name
        value - 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)
        Add Boolean field.
        Parameters:
        field - the field name
        value - the field value
        Returns:
        this
      • addField

        public Point addField​(@Nonnull
                              String field,
                              long value)
        Add Long field.
        Parameters:
        field - the field name
        value - the field value
        Returns:
        this
      • addField

        @Nonnull
        public Point addField​(@Nonnull
                              String field,
                              double value)
        Add Double field.
        Parameters:
        field - the field name
        value - the field value
        Returns:
        this
      • addField

        @Nonnull
        public Point addField​(@Nonnull
                              String field,
                              @Nullable
                              Number value)
        Add Number field.
        Parameters:
        field - the field name
        value - the field value
        Returns:
        this
      • addField

        @Nonnull
        public Point addField​(@Nonnull
                              String field,
                              @Nullable
                              String value)
        Add String field.
        Parameters:
        field - the field name
        value - 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 timestamp
        precision - 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 timestamp
        precision - 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