Class Parameter<S>

java.lang.Object
csw.params.core.generics.Parameter<S>
Type Parameters:
S - the type of items this parameter holds
All Implemented Interfaces:
Serializable, scala.Equals, scala.Product

public class Parameter<S> extends Object implements scala.Product, Serializable
Parameter represents a KeyName, KeyType, array of values and units applicable to values. Parameter sits as payload for sending commands and events between components.

param: keyName the name of the key param: keyType reference to an object of type KeyType[S] param: items an Array of values of type S param: units applicable units

See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Parameter(String keyName, KeyType<S> keyType, scala.collection.mutable.ArraySeq<S> items, Units units)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    apply(int index)
    Returns the value at the given index, throwing an exception if the index is out of range
    scala.Option<S>
    get(int index)
    Get method returns an option of value if present at the given index else none
    Returns the first value as a convenience when storing a single value
    scala.collection.mutable.ArraySeq<S>
     
    jGet(int index)
    A Java helper that returns an option of value if present at the given index else empty
    A Java helper that returns a List of values this parameter holds
     
     
    int
    The number of values in this parameter (values.size)
    Returns a formatted string representation with a KeyName
     
    value(int index)
    Returns the value at the given index, throwing an exception if the index is out of range This is a Scala convenience method
    An Array of values this parameter holds
    A comma separated string representation of all values this parameter holds
    withUnits(Units unitsIn)
    Sets the units for the values

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface scala.Equals

    canEqual, equals

    Methods inherited from interface scala.Product

    productArity, productElement, productElementName, productElementNames, productIterator, productPrefix
  • Constructor Details

    • Parameter

      public Parameter(String keyName, KeyType<S> keyType, scala.collection.mutable.ArraySeq<S> items, Units units)
  • Method Details

    • keyName

      public String keyName()
    • keyType

      public KeyType<S> keyType()
    • items

      public scala.collection.mutable.ArraySeq<S> items()
    • units

      public Units units()
    • values

      public Object values()
      An Array of values this parameter holds
      Returns:
      (undocumented)
    • jValues

      public List<S> jValues()
      A Java helper that returns a List of values this parameter holds
      Returns:
      (undocumented)
    • size

      public int size()
      The number of values in this parameter (values.size)

      Returns:
      length of the array of items
    • apply

      public S apply(int index)
      Returns the value at the given index, throwing an exception if the index is out of range

      Parameters:
      index - the index of a value
      Returns:
      the value at the given index (may throw an exception if the index is out of range)
    • value

      public S value(int index)
      Returns the value at the given index, throwing an exception if the index is out of range This is a Scala convenience method

      Parameters:
      index - the index of a value
      Returns:
      the value at the given index (may throw an exception if the index is out of range)
    • get

      public scala.Option<S> get(int index)
      Get method returns an option of value if present at the given index else none

      Parameters:
      index - the index of a value
      Returns:
      some value at the given index as an Option, if the index is in range, otherwise None
    • jGet

      public Optional<S> jGet(int index)
      A Java helper that returns an option of value if present at the given index else empty

      Parameters:
      index - the index of a value
      Returns:
      value at the given index as an Optional, if the index is in range, otherwise empty
    • head

      public S head()
      Returns the first value as a convenience when storing a single value

      Returns:
      the first or default value (Use this if you know there is only a single value)
    • withUnits

      public Parameter<S> withUnits(Units unitsIn)
      Sets the units for the values

      Parameters:
      unitsIn - the units for the values
      Returns:
      a new instance of this parameter with the units set
    • toString

      public String toString()
      Returns a formatted string representation with a KeyName
      Overrides:
      toString in class Object
      Returns:
      (undocumented)
    • valuesToString

      public String valuesToString()
      A comma separated string representation of all values this parameter holds
      Returns:
      (undocumented)