Class DataPointFactory

java.lang.Object
com.inductiveautomation.historian.common.model.data.DataPointFactory

public class DataPointFactory extends Object
Static factory for AtomicPoint, AggregatedDataPoint and null points.

Supported value types are Boolean, Byte, Short, Integer, Long, Float, Double, String and Date. Overloads that omit the quality default to QualityCode.Good, and those that omit the timestamp default to the current time.

  • Method Details

    • createAtomicPoint

      public static <V> AtomicPoint<V> createAtomicPoint(QualifiedValue value, QualifiedPath source)
      Creates an atomic point from a qualified value, taking its value, quality and timestamp.
      Type Parameters:
      V - the value type.
      Parameters:
      value - the qualified value to convert.
      source - the path of the point's source.
      Returns:
      the new point.
      Throws:
      IllegalArgumentException - if the value type is unsupported.
    • createAtomicPoint

      public static <V> AtomicPoint<V> createAtomicPoint(V value, QualifiedPath source)
      Creates a good-quality atomic point timestamped now.
      Type Parameters:
      V - the value type.
      Parameters:
      value - the point value.
      source - the path of the point's source.
      Returns:
      the new point.
      Throws:
      IllegalArgumentException - if the value type is unsupported.
    • createAtomicPoint

      public static <V> AtomicPoint<V> createAtomicPoint(V value, QualityCode quality, QualifiedPath source)
      Creates an atomic point timestamped now.
      Type Parameters:
      V - the value type.
      Parameters:
      value - the point value.
      quality - the point quality.
      source - the path of the point's source.
      Returns:
      the new point.
      Throws:
      IllegalArgumentException - if the value type is unsupported.
    • createAtomicPoint

      public static <V> AtomicPoint<V> createAtomicPoint(V value, QualityCode quality, Instant timestamp, QualifiedPath source)
      Creates an atomic point.
      Type Parameters:
      V - the value type.
      Parameters:
      value - the point value.
      quality - the point quality.
      timestamp - the point timestamp.
      source - the path of the point's source.
      Returns:
      the new point.
      Throws:
      IllegalArgumentException - if the value type is unsupported.
    • createAtomicPoint

      public static <V> AtomicPoint<V> createAtomicPoint(V value, QualityCode quality, Instant timestamp, QualifiedPath source, @Nullable Instant snapshotTimestamp)
      Creates an atomic point with a snapshot timestamp. A null value yields a null point, and a Date subclass such as java.sql.Timestamp is stored as a plain Date.
      Type Parameters:
      V - the value type.
      Parameters:
      value - the point value; may be null.
      quality - the point quality.
      timestamp - the point timestamp.
      source - the path of the point's source.
      snapshotTimestamp - when the value was snapshotted, or null if not applicable.
      Returns:
      the new point.
      Throws:
      IllegalArgumentException - if the value type is unsupported.
    • createNullPoint

      public static <V> AtomicPoint<V> createNullPoint(QualifiedPath source)
      Creates a good-quality null point timestamped now.
      Type Parameters:
      V - the value type.
      Parameters:
      source - the path of the point's source.
      Returns:
      the new point.
    • createNullPoint

      public static <V> AtomicPoint<V> createNullPoint(QualifiedPath source, QualityCode quality)
      Creates a null point timestamped now.
      Type Parameters:
      V - the value type.
      Parameters:
      source - the path of the point's source.
      quality - the point quality.
      Returns:
      the new point.
    • createNullPoint

      public static <V> AtomicPoint<V> createNullPoint(QualifiedPath source, QualityCode quality, Instant timestamp)
      Creates a null point.
      Type Parameters:
      V - the value type.
      Parameters:
      source - the path of the point's source.
      quality - the point quality.
      timestamp - the point timestamp.
      Returns:
      the new point.
    • createNullPoint

      public static <V> AtomicPoint<V> createNullPoint(Class<V> valueClass, QualityCode quality, QualifiedPath source)
      Creates a null point that remembers its intended value type, timestamped now.
      Type Parameters:
      V - the value type.
      Parameters:
      valueClass - the intended value type.
      quality - the point quality.
      source - the path of the point's source.
      Returns:
      the new point.
    • createNullPoint

      public static <V> AtomicPoint<V> createNullPoint(Class<V> valueClass, QualityCode quality, Instant timestamp, QualifiedPath source)
      Creates a null point that remembers its intended value type.
      Type Parameters:
      V - the value type.
      Parameters:
      valueClass - the intended value type.
      quality - the point quality.
      timestamp - the point timestamp.
      source - the path of the point's source.
      Returns:
      the new point.
    • createAggregatedPoint

      public static <V, A extends AggregationType> AggregatedDataPoint<V,A> createAggregatedPoint(AtomicPoint<V> dataPoint, A aggregationType)
      Wraps an atomic point as an aggregated point.
      Type Parameters:
      V - the value type.
      A - the aggregation type.
      Parameters:
      dataPoint - the point carrying the aggregate value.
      aggregationType - the aggregation that produced it.
      Returns:
      the aggregated point.
    • createAggregatedPoint

      public static <V, A extends AggregationType> AggregatedDataPoint<V,A> createAggregatedPoint(V value, QualityCode quality, Instant timestamp, QualifiedPath source, A aggregationType)
      Creates an aggregated point.
      Type Parameters:
      V - the value type.
      A - the aggregation type.
      Parameters:
      value - the aggregate value.
      quality - the aggregate quality.
      timestamp - the aggregate timestamp.
      source - the path of the point's source.
      aggregationType - the aggregation that produced it.
      Returns:
      the aggregated point.
    • convertToAtomicPoint

      public static <V> AtomicPoint<V> convertToAtomicPoint(DataPoint<V> dataPoint)
      Converts a data point to an AtomicPoint, returning it unchanged if it already is one.
      Type Parameters:
      V - the value type.
      Parameters:
      dataPoint - the point to convert.
      Returns:
      an atomic point with the same value, quality, timestamp, source and snapshot timestamp.