Package uk.ac.starlink.ttools.jel
Class FixedConstant<T>
java.lang.Object
uk.ac.starlink.ttools.jel.FixedConstant<T>
- All Implemented Interfaces:
Constant<T>
Constant implementation which always has the same value.
- Since:
- 10 Dec 2007
- Author:
- Mark Taylor
-
Constructor Summary
ConstructorsConstructorDescriptionFixedConstant
(T value, Class<T> clazz) Constructs a constant with a given value and class. -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> FixedConstant
<T> createConstant
(T value) Constructs a constant with a given value.Returns a class of which this object's value will be an instance.getValue()
Returns this object's value.boolean
Indicates whether evaluation of this constant needs to know the row index.
-
Constructor Details
-
FixedConstant
Constructs a constant with a given value and class.- Parameters:
value
- valueclazz
- content class
-
-
Method Details
-
getContentClass
Description copied from interface:Constant
Returns a class of which this object's value will be an instance.- Specified by:
getContentClass
in interfaceConstant<T>
- Returns:
- content class
-
getValue
Description copied from interface:Constant
Returns this object's value. Not necessarily always the same. -
requiresRowIndex
public boolean requiresRowIndex()Description copied from interface:Constant
Indicates whether evaluation of this constant needs to know the row index. If executingConstant.getValue()
may result in a call toStarTableJELRowReader.getCurrentRow()
, this method must return true.- Specified by:
requiresRowIndex
in interfaceConstant<T>
- Returns:
- true if evaluating this constant needs or may need to know the current row index
-
createConstant
Constructs a constant with a given value. The constant parameterised type is the runtime type of the supplied value.- Parameters:
value
- constant value- Returns:
- new constant
-