ServerValue

public class ServerValue extends Object

Contains placeholder values to use when writing data to the Firebase Database.

Field Summary

public static final Map<StringString> TIMESTAMP A placeholder value for auto-populating the current timestamp (time since the Unix epoch, in milliseconds) by the Firebase Database servers.

Public Constructor Summary

Public Method Summary

final static Object
increment(double delta)
Returns a placeholder value that can be used to atomically increment the current database value by the provided delta.
final static Object
increment(long delta)
Returns a placeholder value that can be used to atomically increment the current database value by the provided delta.

Inherited Method Summary

Fields

public static final Map<StringString> TIMESTAMP

A placeholder value for auto-populating the current timestamp (time since the Unix epoch, in milliseconds) by the Firebase Database servers.

Public Constructors

public ServerValue ()

Public Methods

public static final Object increment (double delta)

Returns a placeholder value that can be used to atomically increment the current database value by the provided delta.

The delta must be an long or a double value. If the current value is not a number, or if the database value does not yet exist, the transformation will set the database value to the delta value. If either the delta value or the existing value are doubles, both values will be interpreted as doubles. Double arithmetic and representation of double values follow IEEE 754 semantics. If there is positive/negative integer overflow, the sum is calculated as a double.

Parameters
delta the amount to modify the current value atomically.
Returns
  • a placeholder value for modifying data atomically server-side.

public static final Object increment (long delta)

The delta must be an long or a double value. If the current value is not a number, or if the database value does not yet exist, the transformation will set the database value to the delta value. If either the delta value or the existing value are doubles, both values will be interpreted as doubles. Double arithmetic and representation of double values follow IEEE 754 semantics. If there is positive/negative integer overflow, the sum is calculated as a double.

Parameters
delta the amount to modify the current value atomically.
Returns
  • a placeholder value for modifying data atomically server-side.