Class ContextEvent<T>


  • public class ContextEvent<T>
    extends Object
    Represents a change occuring to a Context. This includes when objects are added to and removed from a Context (with the getTarget() being valid) or when projections are added and removed (with the getProjection() being valid).
    Author:
    Tom Howe
    • Constructor Detail

      • ContextEvent

        public ContextEvent​(ContextEvent.EventType type,
                            Context<T> context,
                            T target)
        Creates a new instance of ContextEvent with a given type, context and target.
        Parameters:
        type - The type of event which occured.
        context - The context to which the event occured.
        target - The object which was the target of the event.
      • ContextEvent

        public ContextEvent​(ContextEvent.EventType type,
                            Context<T> context,
                            Projection<? super T> projection)
        Creates a new instance of ContextEvent with a given type, context and Projection.
        Parameters:
        type - The type of event which occured.
        context - The context to which the event occured.
        projection - The projection which was the target of the event.
      • ContextEvent

        public ContextEvent​(ContextEvent.EventType type,
                            Context<T> context,
                            Context<? extends T> subContext)
        Creates a new instance of ContextEvent with a given type, context and sub-Context.
        Parameters:
        type - The type of event which occured.
        context - The context to which the event occured.
        subContext - The subcontext which was the target of the event.
    • Method Detail

      • getType

        public ContextEvent.EventType getType()
        Get the type of event this represents.
        Returns:
        The type of event.
      • getContext

        public Context<T> getContext()
        Get the context to which the event occured.
        Returns:
        The effected Context.
      • getTarget

        public T getTarget()
        Get the target of the event.
        Returns:
        The object which was the target of the event.
      • getProjection

        public Projection<? super T> getProjection()
        Gets the project that was the target of the event.
        Returns:
        a projection that was added or removed
      • getSubContext

        public Context<? extends T> getSubContext()
        Gets the subcontext that was the target of the event, assuming this was a subcontext event.
        Returns:
        the subcontext that was the target of the event, assuming this was a subcontext event.