Class FixedConstant<T>

  • All Implemented Interfaces:
    Constant<T>

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

      Constructors 
      Constructor Description
      FixedConstant​(T value, java.lang.Class<T> clazz)
      Constructs a constant with a given value and class.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static <T> FixedConstant<T> createConstant​(T value)
      Constructs a constant with a given value.
      java.lang.Class<T> getContentClass()
      Returns a class of which this object's value will be an instance.
      T getValue()
      Returns this object's value.
      boolean requiresRowIndex()
      Indicates whether evaluation of this constant needs to know the row index.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • FixedConstant

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

      • getContentClass

        public java.lang.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