java.lang.Object
java.lang.Record
org.eclipse.milo.opcua.stack.core.types.builtin.DataValue

@NullMarked public record DataValue(Variant value, StatusCode statusCode, @Nullable DateTime sourceTime, @Nullable UShort sourcePicoseconds, @Nullable DateTime serverTime, @Nullable UShort serverPicoseconds) extends Record
  • Constructor Details

    • DataValue

      public DataValue(long statusCode)
    • DataValue

      public DataValue(StatusCode statusCode)
    • DataValue

      public DataValue(Variant value)
    • DataValue

      public DataValue(Variant value, StatusCode status)
    • DataValue

      public DataValue(Variant value, StatusCode status, @Nullable DateTime time)
    • DataValue

      public DataValue(Variant value, StatusCode status, @Nullable DateTime sourceTime, @Nullable DateTime serverTime)
    • DataValue

      public DataValue(Variant value, StatusCode statusCode, @Nullable DateTime sourceTime, @Nullable UShort sourcePicoseconds, @Nullable DateTime serverTime, @Nullable UShort serverPicoseconds)
      Creates an instance of a DataValue record class.
      Parameters:
      value - the value for the value record component
      statusCode - the value for the statusCode record component
      sourceTime - the value for the sourceTime record component
      sourcePicoseconds - the value for the sourcePicoseconds record component
      serverTime - the value for the serverTime record component
      serverPicoseconds - the value for the serverPicoseconds record component
  • Method Details

    • getValue

      public Variant getValue()
    • getStatusCode

      public StatusCode getStatusCode()
    • getSourceTime

      public @Nullable DateTime getSourceTime()
    • getSourcePicoseconds

      public @Nullable UShort getSourcePicoseconds()
    • getServerTime

      public @Nullable DateTime getServerTime()
    • getServerPicoseconds

      public @Nullable UShort getServerPicoseconds()
    • withStatus

      public DataValue withStatus(StatusCode status)
    • withSourceTime

      public DataValue withSourceTime(@Nullable DateTime sourceTime)
    • withServerTime

      public DataValue withServerTime(@Nullable DateTime serverTime)
    • copy

      public DataValue.Builder copy()
    • copy

    • newValue

      public static DataValue.Builder newValue()
    • derivedValue

      public static DataValue derivedValue(DataValue from, TimestampsToReturn timestamps)
      Derive a new DataValue from a given DataValue with a current server timestamp, if applicable.
      Parameters:
      from - the DataValue to derive from.
      timestamps - the timestamps to return in the derived value.
      Returns:
      a derived DataValue.
    • derivedNonValue

      public static DataValue derivedNonValue(DataValue from, TimestampsToReturn timestamps)
      Derive a new DataValue from a given DataValue with a current server timestamp, if applicable.

      The value is assumed to be for a non-value Node attribute, and therefore the source timestamp is not returned.

      Parameters:
      from - the DataValue to derive from.
      timestamps - the timestamps to return in the derived value.
      Returns:
      a derived DataValue.
    • valueOnly

      public static DataValue valueOnly(Variant v)
      Create a DataValue containing only a value.

      StatusCode.GOOD is implied, and other fields will be null.

      Parameters:
      v - the value Variant.
      Returns:
      a DataValue containing only the value.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • value

      public Variant value()
      Returns the value of the value record component.
      Returns:
      the value of the value record component
    • statusCode

      public StatusCode statusCode()
      Returns the value of the statusCode record component.
      Returns:
      the value of the statusCode record component
    • sourceTime

      public @Nullable DateTime sourceTime()
      Returns the value of the sourceTime record component.
      Returns:
      the value of the sourceTime record component
    • sourcePicoseconds

      public @Nullable UShort sourcePicoseconds()
      Returns the value of the sourcePicoseconds record component.
      Returns:
      the value of the sourcePicoseconds record component
    • serverTime

      public @Nullable DateTime serverTime()
      Returns the value of the serverTime record component.
      Returns:
      the value of the serverTime record component
    • serverPicoseconds

      public @Nullable UShort serverPicoseconds()
      Returns the value of the serverPicoseconds record component.
      Returns:
      the value of the serverPicoseconds record component