### *** This class provides Binary Compatibility only, not Source Compatibility ***

Package com.sas.services.session

# Class SessionContextStateChangedEvent

java.lang.Object
java.util.EventObject
com.sas.services.session.SessionContextStateChangedEvent

All Implemented Interfaces:
  `Serializable`

@SASScope("ALL") @BinaryCompatibilityOnly public class SessionContextStateChangedEvent extends EventObject implements Serializable
Sent to an object that implements `RemoteSessionContextStateChangedListener` when the object's state changes within the session context; currently, this is when the object is removed from the session context or when the session context is destroyed.

The session context binds the object by a call to `SessionContextInterface.setAttribute(Object)` and removes the object by a call to `SessionContextInterface.removeAttribute(String)` or `SessionContextInterface.destroy`.

Since:
  1.0
See Also:
  - Serialized Form

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final int`
  `OBJECT_REMOVED`
  Object removed.
  `static final long`
  `serialVersionUID`
  Serial version ID.
  `static final int`
  `SESSION_CONTEXT_DESTROYED`
  Session context destroyed.

  ### Fields inherited from class java.util.EventObject

  `source`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `SessionContextStateChangedEvent(SessionContextInterface sessionContext, String name, Object object, int stateChange)`
  Constructs an event that notifies an object that its state has changed within the session context; currently, this is when the object is removed from the session context.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `getName()`
  Returns the name with which the object is bound in the session context.
  `Object`
  `getObject()`
  Returns the object that was bound to the session context.
  `SessionContextInterface`
  `getSessionContext()`
  Returns the session context from which the object is removed.
  `Object`
  `getSource()`
  Returns the object that originated the event.
  `int`
  `getStateChange()`
  Returns the type of state change that occurred.
  `String`
  `toString()`
  Returns a String representation of this SessionContextStateChangedEvent.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Field Details

  - ### serialVersionUID

    public static final long serialVersionUID
    Serial version ID. This value should be changed if backward compatibility with previosly serialized versions is no longer desired.
    See Also:
      - Constant Field Values

  - ### OBJECT_REMOVED

    public static final int OBJECT_REMOVED
    Object removed.
    See Also:
      - Constant Field Values

  - ### SESSION_CONTEXT_DESTROYED

    public static final int SESSION_CONTEXT_DESTROYED
    Session context destroyed.
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### SessionContextStateChangedEvent

    public SessionContextStateChangedEvent(SessionContextInterface sessionContext, String name, Object object, int stateChange)
    Constructs an event that notifies an object that its state has changed within the session context; currently, this is when the object is removed from the session context.

    If an object added to a session context with `SessionContextInterface.setAttribute(Object)` implements `RemoteSessionContextStateChangedListener`, the session context will invoke `RemoteSessionContextStateChangedListener.contextStateChanged(SessionContextStateChangedEvent)` when the session context is destroyed or when the object is removed from the session context. This notification will allow the object to cleanup any resources that are necessary.

    Parameters:
      `sessionContext` - The session context to which the object is bound.
      `name` - The name with which the object is bound in the session context.
      `object` - The bound object.
      `stateChange` - The type of state change, either `SESSION_CONTEXT_DESTROYED`or `OBJECT_REMOVED`.

- ## Method Details

  - ### getName

    public String getName()
    Returns the name with which the object is bound in the session context.
    Returns:
      `String` The name with which the object is bound in the session context.

  - ### getSessionContext

    public SessionContextInterface getSessionContext()
    Returns the session context from which the object is removed.
    Returns:
      `SessionContextInterface` The session context from which the object is unbound.

  - ### getObject

    public Object getObject()
    Returns the object that was bound to the session context.
    Returns:
      `Object` The object that was bound to the session context..

  - ### getSource

    public Object getSource()
    Returns the object that originated the event. In this case, the object is the session context.
    Overrides:
      `getSource` in class `EventObject`
    Returns:
      `Object` The object that originated the event

  - ### toString

    public String toString()
    Returns a String representation of this SessionContextStateChangedEvent.
    Overrides:
      `toString` in class `EventObject`
    Returns:
      `String` The String represenation of this SessionContextStateChangedEvent.

  - ### getStateChange

    public int getStateChange()
    Returns the type of state change that occurred. Supported state changes include `OBJECT_REMOVED`and `SESSION_CONTEXT_DESROYED`.
    Returns:
      `int` The type of state change.