Class PArray.ArrayBasedValue

java.lang.Object
org.praxislive.core.Value
org.praxislive.core.types.PArray.ArrayBasedValue
Direct Known Subclasses:
Connection
Enclosing class:
PArray

public abstract static class PArray.ArrayBasedValue extends Value
An abstract superclass for values that are backed solely by a PArray. Subclassing this type can help with efficient serialization of the underlying representation. The concrete value type must be able to construct an equivalent value entirely from the PArray returned from dataArray().

The toString, equals, equivalent and hashCode methods are all implemented based solely on the array data.

  • Nested Class Summary

    Nested classes/interfaces inherited from class org.praxislive.core.Value

    Value.Type<T extends Value>
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Construct a MapBasedValue using the provided data map.
  • Method Summary

    Modifier and Type
    Method
    Description
    final PArray
    Access the backing PArray data.
    final boolean
    Values must override the default equals method.
    final boolean
    Indicates whether some other Value is equivalent to this one.
    final int
    Values must override the default hashcode method.
    final String
    Values must override the default method to return a string representation that is immutable.

    Methods inherited from class org.praxislive.core.Value

    info, isEmpty, ofObject, type

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • ArrayBasedValue

      protected ArrayBasedValue(PArray data)
      Construct a MapBasedValue using the provided data map.
      Parameters:
      data - data map
  • Method Details

    • dataArray

      public final PArray dataArray()
      Access the backing PArray data.
      Returns:
      backing array
    • toString

      public final String toString()
      Description copied from class: Value
      Values must override the default method to return a string representation that is immutable.
      Specified by:
      toString in class Value
      Returns:
      String representation
    • hashCode

      public final int hashCode()
      Description copied from class: Value
      Values must override the default hashcode method.
      Specified by:
      hashCode in class Value
      Returns:
      int hashcode
    • equals

      public final boolean equals(Object obj)
      Description copied from class: Value
      Values must override the default equals method. This method should only return true if the supplied Object is of the same type as the implementing Value. Values of an unknown type should be coerced before calling this method. This method does not have to guarantee that this.equals(that) == this.toString().equals(that.toString())
      Specified by:
      equals in class Value
      Parameters:
      obj -
      Returns:
      boolean
    • equivalent

      public final boolean equivalent(Value value)
      Description copied from class: Value
      Indicates whether some other Value is equivalent to this one. Unlike Value.equals(java.lang.Object) this method is not symmetric - a value of a different type might be equivalent to this without the other type considering the reverse to be true.

      The default implementation uses identity or String equality.

      Overrides:
      equivalent in class Value
      Parameters:
      value - value to test for equivalence
      Returns:
      true if value is equivalent to this