Class AbstractContext

  • All Implemented Interfaces:
    java.io.Serializable
    Direct Known Subclasses:
    ComparatorContext, ConverterContext, GrouperContext

    public abstract class AbstractContext
    extends java.lang.Object
    implements java.io.Serializable
    AbstractContext is a generic context class. It has two fields: name and userObject. The name is just the name of the context. You can use a meaningful string to name it. The userObject is customizable portion of Context. You can set whatever you want as userObject. It's just a convention between whoever set it and whoever use it. For example, in ConverterContext, we sometimes used it to pass in a Format.
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      AbstractContext​(java.lang.String name)
      Creates a named AbstractContext.
      AbstractContext​(java.lang.String name, java.lang.Object object)
      Creates an abstract context with a name and an object.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object o)
      Override equals.
      java.lang.String getName()
      Gets the name of the abstract context.
      java.lang.Object getUserObject()
      Gets the user object.
      int hashCode()  
      void setName​(java.lang.String name)
      Sets the name of the abstract context.
      void setUserObject​(java.lang.Object userObject)
      Sets the user object.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • AbstractContext

        public AbstractContext​(java.lang.String name)
        Creates a named AbstractContext.
        Parameters:
        name - the name of the AbstractContext.
      • AbstractContext

        public AbstractContext​(java.lang.String name,
                               java.lang.Object object)
        Creates an abstract context with a name and an object.
        Parameters:
        name - the name of the AbstractContext.
        object - the user object. It can be used any object to pass information along.
    • Method Detail

      • getName

        public java.lang.String getName()
        Gets the name of the abstract context.
        Returns:
        the name of the abstract context
      • setName

        public void setName​(java.lang.String name)
        Sets the name of the abstract context.
        Parameters:
        name - the name of the abstract context
      • getUserObject

        public java.lang.Object getUserObject()
        Gets the user object.
        Returns:
        the user object
      • setUserObject

        public void setUserObject​(java.lang.Object userObject)
        Sets the user object.
        Parameters:
        userObject - the user object.
      • equals

        public boolean equals​(java.lang.Object o)
        Override equals. Two abstract context equals as long as the name is the same.
        Overrides:
        equals in class java.lang.Object
        Parameters:
        o - object to compare.
        Returns:
        if two objects equal.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object