edu.wpi.first.networktables

## Class NetworkTableEntry

- java.lang.Object
- - edu.wpi.first.networktables.NetworkTableEntry

-     public final class NetworkTableEntry
      extends java.lang.Object

  NetworkTables Entry

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `kPersistent` Flag values (as returned by `getFlags()`).

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `NetworkTableEntry(NetworkTableInstance inst, int handle)` Construct from native handle.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `addListener(java.util.function.Consumer<EntryNotification> listener, int flags)` Add a listener for changes to the entry
    `void` | `clearFlags(int flags)` Clears flags.
    `void` | `clearPersistent()` Stop making value persistent through program restarts.
    `void` | `delete()` Deletes the entry.
    `boolean` | `equals(java.lang.Object o)`
    `boolean` | `exists()` Determines if the entry currently exists.
    `void` | `forceSetBoolean(boolean value)` Sets the entry's value.
    `void` | `forceSetBooleanArray(boolean[] value)` Sets the entry's value.
    `void` | `forceSetBooleanArray(java.lang.Boolean[] value)` Sets the entry's value.
    `void` | `forceSetDouble(double value)` Sets the entry's value.
    `void` | `forceSetDoubleArray(double[] value)` Sets the entry's value.
    `void` | `forceSetNumber(java.lang.Number value)` Sets the entry's value.
    `void` | `forceSetNumberArray(java.lang.Number[] value)` Sets the entry's value.
    `void` | `forceSetRaw(byte[] value)` Sets the entry's value.
    `void` | `forceSetString(java.lang.String value)` Sets the entry's value.
    `void` | `forceSetStringArray(java.lang.String[] value)` Sets the entry's value.
    `void` | `forceSetValue(NetworkTableValue value)` Sets the entry's value.
    `boolean` | `getBoolean(boolean defaultValue)` Gets the entry's value as a boolean.
    `boolean[]` | `getBooleanArray(boolean[] defaultValue)` Gets the entry's value as a boolean array.
    `java.lang.Boolean[]` | `getBooleanArray(java.lang.Boolean[] defaultValue)` Gets the entry's value as a boolean array.
    `double` | `getDouble(double defaultValue)` Gets the entry's value as a double.
    `double[]` | `getDoubleArray(double[] defaultValue)` Gets the entry's value as a double array.
    `java.lang.Double[]` | `getDoubleArray(java.lang.Double[] defaultValue)` Gets the entry's value as a double array.
    `int` | `getFlags()` Returns the flags.
    `int` | `getHandle()` Gets the native handle for the entry.
    `EntryInfo` | `getInfo()` Gets combined information about the entry.
    `NetworkTableInstance` | `getInstance()` Gets the instance for the entry.
    `long` | `getLastChange()` Gets the last time the entry's value was changed.
    `java.lang.String` | `getName()` Gets the name of the entry (the key).
    `java.lang.Number` | `getNumber(java.lang.Number defaultValue)` Gets the entry's value as a double.
    `java.lang.Number[]` | `getNumberArray(java.lang.Number[] defaultValue)` Gets the entry's value as a double array.
    `byte[]` | `getRaw(byte[] defaultValue)` Gets the entry's value as a raw value (byte array).
    `java.lang.String` | `getString(java.lang.String defaultValue)` Gets the entry's value as a string.
    `java.lang.String[]` | `getStringArray(java.lang.String[] defaultValue)` Gets the entry's value as a string array.
    `NetworkTableType` | `getType()` Gets the type of the entry.
    `NetworkTableValue` | `getValue()` Gets the entry's value.
    `int` | `hashCode()`
    `boolean` | `isPersistent()` Returns whether the value is persistent through program restarts.
    `boolean` | `isValid()` Determines if the native handle is valid.
    `void` | `removeListener(int listener)` Remove a listener from receiving entry events
    `boolean` | `setBoolean(boolean value)` Sets the entry's value.
    `boolean` | `setBooleanArray(boolean[] value)` Sets the entry's value.
    `boolean` | `setBooleanArray(java.lang.Boolean[] value)` Sets the entry's value.
    `boolean` | `setDefaultBoolean(boolean defaultValue)` Sets the entry's value if it does not exist.
    `boolean` | `setDefaultBooleanArray(boolean[] defaultValue)` Sets the entry's value if it does not exist.
    `boolean` | `setDefaultBooleanArray(java.lang.Boolean[] defaultValue)` Sets the entry's value if it does not exist.
    `boolean` | `setDefaultDouble(double defaultValue)` Sets the entry's value if it does not exist.
    `boolean` | `setDefaultDoubleArray(double[] defaultValue)` Sets the entry's value if it does not exist.
    `boolean` | `setDefaultNumber(java.lang.Number defaultValue)` Sets the entry's value if it does not exist.
    `boolean` | `setDefaultNumberArray(java.lang.Number[] defaultValue)` Sets the entry's value if it does not exist.
    `boolean` | `setDefaultRaw(byte[] defaultValue)` Sets the entry's value if it does not exist.
    `boolean` | `setDefaultString(java.lang.String defaultValue)` Sets the entry's value if it does not exist.
    `boolean` | `setDefaultStringArray(java.lang.String[] defaultValue)` Sets the entry's value if it does not exist.
    `boolean` | `setDefaultValue(NetworkTableValue defaultValue)` Sets the entry's value if it does not exist.
    `boolean` | `setDouble(double value)` Sets the entry's value.
    `boolean` | `setDoubleArray(double[] value)` Sets the entry's value.
    `void` | `setFlags(int flags)` Sets flags.
    `boolean` | `setNumber(java.lang.Number value)` Sets the entry's value.
    `boolean` | `setNumberArray(java.lang.Number[] value)` Sets the entry's value.
    `void` | `setPersistent()` Make value persistent through program restarts.
    `boolean` | `setRaw(byte[] value)` Sets the entry's value.
    `boolean` | `setRaw(java.nio.ByteBuffer value, int len)` Sets the entry's value.
    `boolean` | `setString(java.lang.String value)` Sets the entry's value.
    `boolean` | `setStringArray(java.lang.String[] value)` Sets the entry's value.
    `boolean` | `setValue(NetworkTableValue value)` Sets the entry's value

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### kPersistent

          public static final int kPersistent

      Flag values (as returned by `getFlags()`).
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### NetworkTableEntry

          public NetworkTableEntry(NetworkTableInstance inst,
                                   int handle)

      Construct from native handle.
      Parameters:
        `inst` - Instance
        `handle` - Native handle

  - ### Method Detail

    - #### isValid

          public boolean isValid()

      Determines if the native handle is valid.
      Returns:
        True if the native handle is valid, false otherwise.

    - #### getHandle

          public int getHandle()

      Gets the native handle for the entry.
      Returns:
        Native handle

    - #### getInstance

          public NetworkTableInstance getInstance()

      Gets the instance for the entry.
      Returns:
        Instance

    - #### exists

          public boolean exists()

      Determines if the entry currently exists.
      Returns:
        True if the entry exists, false otherwise.

    - #### getName

          public java.lang.String getName()

      Gets the name of the entry (the key).
      Returns:
        the entry's name

    - #### getType

          public NetworkTableType getType()

      Gets the type of the entry.
      Returns:
        the entry's type

    - #### getFlags

          public int getFlags()

      Returns the flags.
      Returns:
        the flags (bitmask)

    - #### getLastChange

          public long getLastChange()

      Gets the last time the entry's value was changed.
      Returns:
        Entry last change time

    - #### getInfo

          public EntryInfo getInfo()

      Gets combined information about the entry.
      Returns:
        Entry information

    - #### getValue

          public NetworkTableValue getValue()

      Gets the entry's value. Returns a value with type NetworkTableType.kUnassigned if the value does not exist.
      Returns:
        the entry's value

    - #### getBoolean

          public boolean getBoolean(boolean defaultValue)

      Gets the entry's value as a boolean. If the entry does not exist or is of different type, it will return the default value.
      Parameters:
        `defaultValue` - the value to be returned if no value is found
      Returns:
        the entry's value or the given default value

    - #### getDouble

          public double getDouble(double defaultValue)

      Gets the entry's value as a double. If the entry does not exist or is of different type, it will return the default value.
      Parameters:
        `defaultValue` - the value to be returned if no value is found
      Returns:
        the entry's value or the given default value

    - #### getNumber

          public java.lang.Number getNumber(java.lang.Number defaultValue)

      Gets the entry's value as a double. If the entry does not exist or is of different type, it will return the default value.
      Parameters:
        `defaultValue` - the value to be returned if no value is found
      Returns:
        the entry's value or the given default value

    - #### getString

          public java.lang.String getString(java.lang.String defaultValue)

      Gets the entry's value as a string. If the entry does not exist or is of different type, it will return the default value.
      Parameters:
        `defaultValue` - the value to be returned if no value is found
      Returns:
        the entry's value or the given default value

    - #### getRaw

          public byte[] getRaw(byte[] defaultValue)

      Gets the entry's value as a raw value (byte array). If the entry does not exist or is of different type, it will return the default value.
      Parameters:
        `defaultValue` - the value to be returned if no value is found
      Returns:
        the entry's value or the given default value

    - #### getBooleanArray

          public boolean[] getBooleanArray(boolean[] defaultValue)

      Gets the entry's value as a boolean array. If the entry does not exist or is of different type, it will return the default value.
      Parameters:
        `defaultValue` - the value to be returned if no value is found
      Returns:
        the entry's value or the given default value

    - #### getBooleanArray

          public java.lang.Boolean[] getBooleanArray(java.lang.Boolean[] defaultValue)

      Gets the entry's value as a boolean array. If the entry does not exist or is of different type, it will return the default value.
      Parameters:
        `defaultValue` - the value to be returned if no value is found
      Returns:
        the entry's value or the given default value

    - #### getDoubleArray

          public double[] getDoubleArray(double[] defaultValue)

      Gets the entry's value as a double array. If the entry does not exist or is of different type, it will return the default value.
      Parameters:
        `defaultValue` - the value to be returned if no value is found
      Returns:
        the entry's value or the given default value

    - #### getDoubleArray

          public java.lang.Double[] getDoubleArray(java.lang.Double[] defaultValue)

      Gets the entry's value as a double array. If the entry does not exist or is of different type, it will return the default value.
      Parameters:
        `defaultValue` - the value to be returned if no value is found
      Returns:
        the entry's value or the given default value

    - #### getNumberArray

          public java.lang.Number[] getNumberArray(java.lang.Number[] defaultValue)

      Gets the entry's value as a double array. If the entry does not exist or is of different type, it will return the default value.
      Parameters:
        `defaultValue` - the value to be returned if no value is found
      Returns:
        the entry's value or the given default value

    - #### getStringArray

          public java.lang.String[] getStringArray(java.lang.String[] defaultValue)

      Gets the entry's value as a string array. If the entry does not exist or is of different type, it will return the default value.
      Parameters:
        `defaultValue` - the value to be returned if no value is found
      Returns:
        the entry's value or the given default value

    - #### setDefaultValue

          public boolean setDefaultValue(NetworkTableValue defaultValue)

      Sets the entry's value if it does not exist.
      Parameters:
        `defaultValue` - the default value to set
      Returns:
        False if the entry exists with a different type

    - #### setDefaultBoolean

          public boolean setDefaultBoolean(boolean defaultValue)

      Sets the entry's value if it does not exist.
      Parameters:
        `defaultValue` - the default value to set
      Returns:
        False if the entry exists with a different type

    - #### setDefaultDouble

          public boolean setDefaultDouble(double defaultValue)

      Sets the entry's value if it does not exist.
      Parameters:
        `defaultValue` - the default value to set
      Returns:
        False if the entry exists with a different type

    - #### setDefaultNumber

          public boolean setDefaultNumber(java.lang.Number defaultValue)

      Sets the entry's value if it does not exist.
      Parameters:
        `defaultValue` - the default value to set
      Returns:
        False if the entry exists with a different type

    - #### setDefaultString

          public boolean setDefaultString(java.lang.String defaultValue)

      Sets the entry's value if it does not exist.
      Parameters:
        `defaultValue` - the default value to set
      Returns:
        False if the entry exists with a different type

    - #### setDefaultRaw

          public boolean setDefaultRaw(byte[] defaultValue)

      Sets the entry's value if it does not exist.
      Parameters:
        `defaultValue` - the default value to set
      Returns:
        False if the entry exists with a different type

    - #### setDefaultBooleanArray

          public boolean setDefaultBooleanArray(boolean[] defaultValue)

      Sets the entry's value if it does not exist.
      Parameters:
        `defaultValue` - the default value to set
      Returns:
        False if the entry exists with a different type

    - #### setDefaultBooleanArray

          public boolean setDefaultBooleanArray(java.lang.Boolean[] defaultValue)

      Sets the entry's value if it does not exist.
      Parameters:
        `defaultValue` - the default value to set
      Returns:
        False if the entry exists with a different type

    - #### setDefaultDoubleArray

          public boolean setDefaultDoubleArray(double[] defaultValue)

      Sets the entry's value if it does not exist.
      Parameters:
        `defaultValue` - the default value to set
      Returns:
        False if the entry exists with a different type

    - #### setDefaultNumberArray

          public boolean setDefaultNumberArray(java.lang.Number[] defaultValue)

      Sets the entry's value if it does not exist.
      Parameters:
        `defaultValue` - the default value to set
      Returns:
        False if the entry exists with a different type

    - #### setDefaultStringArray

          public boolean setDefaultStringArray(java.lang.String[] defaultValue)

      Sets the entry's value if it does not exist.
      Parameters:
        `defaultValue` - the default value to set
      Returns:
        False if the entry exists with a different type

    - #### setValue

          public boolean setValue(NetworkTableValue value)

      Sets the entry's value
      Parameters:
        `value` - the value that will be assigned
      Returns:
        False if the table key already exists with a different type

    - #### setBoolean

          public boolean setBoolean(boolean value)

      Sets the entry's value.
      Parameters:
        `value` - the value to set
      Returns:
        False if the entry exists with a different type

    - #### setDouble

          public boolean setDouble(double value)

      Sets the entry's value.
      Parameters:
        `value` - the value to set
      Returns:
        False if the entry exists with a different type

    - #### setNumber

          public boolean setNumber(java.lang.Number value)

      Sets the entry's value.
      Parameters:
        `value` - the value to set
      Returns:
        False if the entry exists with a different type

    - #### setString

          public boolean setString(java.lang.String value)

      Sets the entry's value.
      Parameters:
        `value` - the value to set
      Returns:
        False if the entry exists with a different type

    - #### setRaw

          public boolean setRaw(byte[] value)

      Sets the entry's value.
      Parameters:
        `value` - the value to set
      Returns:
        False if the entry exists with a different type

    - #### setRaw

          public boolean setRaw(java.nio.ByteBuffer value,
                                int len)

      Sets the entry's value.
      Parameters:
        `value` - the value to set
        `len` - the length of the value
      Returns:
        False if the entry exists with a different type

    - #### setBooleanArray

          public boolean setBooleanArray(boolean[] value)

      Sets the entry's value.
      Parameters:
        `value` - the value to set
      Returns:
        False if the entry exists with a different type

    - #### setBooleanArray

          public boolean setBooleanArray(java.lang.Boolean[] value)

      Sets the entry's value.
      Parameters:
        `value` - the value to set
      Returns:
        False if the entry exists with a different type

    - #### setDoubleArray

          public boolean setDoubleArray(double[] value)

      Sets the entry's value.
      Parameters:
        `value` - the value to set
      Returns:
        False if the entry exists with a different type

    - #### setNumberArray

          public boolean setNumberArray(java.lang.Number[] value)

      Sets the entry's value.
      Parameters:
        `value` - the value to set
      Returns:
        False if the entry exists with a different type

    - #### setStringArray

          public boolean setStringArray(java.lang.String[] value)

      Sets the entry's value.
      Parameters:
        `value` - the value to set
      Returns:
        False if the entry exists with a different type

    - #### forceSetValue

          public void forceSetValue(NetworkTableValue value)

      Sets the entry's value. If the value is of different type, the type is changed to match the new value.
      Parameters:
        `value` - the value to set

    - #### forceSetBoolean

          public void forceSetBoolean(boolean value)

      Sets the entry's value. If the value is of different type, the type is changed to match the new value.
      Parameters:
        `value` - the value to set

    - #### forceSetDouble

          public void forceSetDouble(double value)

      Sets the entry's value. If the value is of different type, the type is changed to match the new value.
      Parameters:
        `value` - the value to set

    - #### forceSetNumber

          public void forceSetNumber(java.lang.Number value)

      Sets the entry's value. If the value is of different type, the type is changed to match the new value.
      Parameters:
        `value` - the value to set

    - #### forceSetString

          public void forceSetString(java.lang.String value)

      Sets the entry's value. If the value is of different type, the type is changed to match the new value.
      Parameters:
        `value` - the value to set

    - #### forceSetRaw

          public void forceSetRaw(byte[] value)

      Sets the entry's value. If the value is of different type, the type is changed to match the new value.
      Parameters:
        `value` - the value to set

    - #### forceSetBooleanArray

          public void forceSetBooleanArray(boolean[] value)

      Sets the entry's value. If the value is of different type, the type is changed to match the new value.
      Parameters:
        `value` - the value to set

    - #### forceSetBooleanArray

          public void forceSetBooleanArray(java.lang.Boolean[] value)

      Sets the entry's value. If the value is of different type, the type is changed to match the new value.
      Parameters:
        `value` - the value to set

    - #### forceSetDoubleArray

          public void forceSetDoubleArray(double[] value)

      Sets the entry's value. If the value is of different type, the type is changed to match the new value.
      Parameters:
        `value` - the value to set

    - #### forceSetNumberArray

          public void forceSetNumberArray(java.lang.Number[] value)

      Sets the entry's value. If the value is of different type, the type is changed to match the new value.
      Parameters:
        `value` - the value to set

    - #### forceSetStringArray

          public void forceSetStringArray(java.lang.String[] value)

      Sets the entry's value. If the value is of different type, the type is changed to match the new value.
      Parameters:
        `value` - the value to set

    - #### setFlags

          public void setFlags(int flags)

      Sets flags.
      Parameters:
        `flags` - the flags to set (bitmask)

    - #### clearFlags

          public void clearFlags(int flags)

      Clears flags.
      Parameters:
        `flags` - the flags to clear (bitmask)

    - #### setPersistent

          public void setPersistent()

      Make value persistent through program restarts.

    - #### clearPersistent

          public void clearPersistent()

      Stop making value persistent through program restarts.

    - #### isPersistent

          public boolean isPersistent()

      Returns whether the value is persistent through program restarts.
      Returns:
        True if the value is persistent.

    - #### delete

          public void delete()

      Deletes the entry.

    - #### addListener

          public int addListener(java.util.function.Consumer<EntryNotification> listener,
                                 int flags)

      Add a listener for changes to the entry
      Parameters:
        `listener` - the listener to add
        `flags` - bitmask specifying desired notifications
      Returns:
        listener handle

    - #### removeListener

          public void removeListener(int listener)

      Remove a listener from receiving entry events
      Parameters:
        `listener` - the listener to be removed

    - #### equals

          public boolean equals(java.lang.Object o)

      Overrides:
        `equals` in class `java.lang.Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `java.lang.Object`