Class StateObject


  • public class StateObject
    extends Object
    The StateObject is a convenience object that can be used to avoid certain programming errors. By setting this object when the state changes and asserting that it has the correct state before engaging in state dependent activity, the programmer can get proper feedback whenever the object is in the wrong state for a particular request.
    • Constructor Detail

      • StateObject

        public StateObject​(String type)
        Create a new StateObject with the specified type.
        Parameters:
        type - the type name of this StateObject, e.g. a class name
      • StateObject

        public StateObject()
        Create a new StateObject with the default type, which is "Object".
    • Method Detail

      • open

        public void open()
        Open the StateObject.
      • close

        public void close()
        Close the StateObject.
      • isClosed

        public boolean isClosed()
        Check if the StateObject has been closed.
        Returns:
        returns true if the object is closed
      • isOpen

        public boolean isOpen()
        Check if the StateObject has been opened.
        Returns:
        returns true if the object is opened