Class FixedConstant

  • All Implemented Interfaces:
    Constant

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

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

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Class<?> getContentClass()
      Returns a class of which this object's value will be an instance.
      java.lang.Object getValue()
      Returns this object's value.
      • Methods inherited from class java.lang.Object

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

      • FixedConstant

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

        public FixedConstant​(java.lang.Object value)
        Constructs a constant with a given value. The class is the class of value.
        Parameters:
        value - value
    • Method Detail

      • getContentClass

        public java.lang.Class<?> 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
        Returns:
        content class
      • getValue

        public java.lang.Object getValue()
        Description copied from interface: Constant
        Returns this object's value. Not necessarily always the same. Must be an instance of Constant.getContentClass() (or null).
        Specified by:
        getValue in interface Constant
        Returns:
        value