Class FixedConstant<T>

java.lang.Object
uk.ac.starlink.ttools.jel.FixedConstant<T>
All Implemented Interfaces:
Constant<T>

public class FixedConstant<T> extends Object implements Constant<T>
Constant implementation which always has the same value.
Since:
10 Dec 2007
Author:
Mark Taylor
  • Constructor Details

    • FixedConstant

      public FixedConstant(T value, Class<T> clazz)
      Constructs a constant with a given value and class.
      Parameters:
      clazz - content class
      value - value
  • Method Details

    • getContentClass

      public Class<T> getContentClass()
      Description copied from interface: Constant
      Returns a class of which this object's value will be an instance.
      Specified by:
      getContentClass in interface Constant<T>
      Returns:
      content class
    • getValue

      public T getValue()
      Description copied from interface: Constant
      Returns this object's value. Not necessarily always the same.
      Specified by:
      getValue in interface Constant<T>
      Returns:
      value
    • requiresRowIndex

      public boolean requiresRowIndex()
      Description copied from interface: Constant
      Indicates whether evaluation of this constant needs to know the row index. If executing Constant.getValue() may result in a call to StarTableJELRowReader.getCurrentRow(), this method must return true.
      Specified by:
      requiresRowIndex in interface Constant<T>
      Returns:
      true if evaluating this constant needs or may need to know the current row index
    • createConstant

      public static <T> FixedConstant<T> createConstant(T value)
      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