Class Tunable.TunableStructArray<T>

java.lang.Object
org.wpilib.tunable.TunableBase
org.wpilib.tunable.Tunable<T[]>
org.wpilib.tunable.Tunable.TunableStructArray<T>
Type Parameters:
T - array element type
All Implemented Interfaces:
Consumer<T[]>, Supplier<T[]>
Enclosing class:
Tunable<T>

public static class Tunable.TunableStructArray<T> extends Tunable<T[]>
A tunable array of values serialized with a Struct.
  • Method Details

    • set

      public void set(T[] value)
      Description copied from class: Tunable
      Sets the value.

      Implementations must not throw.

      Specified by:
      set in class Tunable<T[]>
      Parameters:
      value - value
    • get

      public T[] get()
      Description copied from class: Tunable
      Gets the value.

      Implementations must not throw.

      Specified by:
      get in interface Supplier<T>
      Specified by:
      get in class Tunable<T[]>
      Returns:
      value
    • mutate

      public T[] mutate()
      Description copied from class: Tunable
      Gets the value for in-place mutation and marks this tunable changed.

      This is useful for mutable structured/protobuf values where modifying the object returned by Tunable.get() would otherwise bypass Tunable.set(Object) and not notify backends. For immutable values, prefer Tunable.set(Object). For variable-length arrays, use Tunable.set(Object) with a new array to change the length.

      Overrides:
      mutate in class Tunable<T[]>
      Returns:
      mutable value
    • getTypeClass

      public Class<T[]> getTypeClass()
      Description copied from class: Tunable
      Gets the class of the tunable type. This is used for determining which type handler to use.
      Specified by:
      getTypeClass in class Tunable<T[]>
      Returns:
      class of the tunable type
    • getStruct

      public Struct<T> getStruct()
      Gets the struct serializer.
      Returns:
      struct serializer