Package csw.params.core.generics
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:
 java.io.Serializable,scala.Equals,scala.Product
public class Parameter<S> extends java.lang.Object implements scala.Product, java.io.SerializableParameter 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:
 - Serialized Form
 
 
- 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Sapply(int index)Returns the value at the given index, throwing an exception if the index is out of rangescala.Option<S>get(int index)Get method returns an option of value if present at the given index else noneShead()Returns the first value as a convenience when storing a single valuescala.collection.mutable.ArraySeq<S>items()java.util.Optional<S>jGet(int index)A Java helper that returns an option of value if present at the given index else emptyjava.util.List<S>jValues()A Java helper that returns a List of values this parameter holdsjava.lang.StringkeyName()KeyType<S>keyType()intsize()The number of values in this parameter (values.size)java.lang.StringtoString()Returns a formatted string representation with a KeyNameUnitsunits()Svalue(int index)Returns the value at the given index, throwing an exception if the index is out of range This is a Scala convenience methodjava.lang.Objectvalues()An Array of values this parameter holdsjava.lang.StringvaluesToString()A comma separated string representation of all values this parameter holdsParameter<S>withUnits(Units unitsIn)Sets the units for the values 
 - 
 
- 
- 
Method Detail
- 
keyName
public java.lang.String keyName()
 
- 
items
public scala.collection.mutable.ArraySeq<S> items()
 
- 
units
public Units units()
 
- 
values
public java.lang.Object values()
An Array of values this parameter holds- Returns:
 - (undocumented)
 
 
- 
jValues
public java.util.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 java.util.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 java.lang.String toString()
Returns a formatted string representation with a KeyName- Overrides:
 toStringin classjava.lang.Object- Returns:
 - (undocumented)
 
 
- 
valuesToString
public java.lang.String valuesToString()
A comma separated string representation of all values this parameter holds- Returns:
 - (undocumented)
 
 
 - 
 
 -