Class AbstractResourceEvent<T extends Serializable>

    • Constructor Detail

      • AbstractResourceEvent

        protected AbstractResourceEvent()
      • AbstractResourceEvent

        public AbstractResourceEvent​(ResourceEvent.Type type,
                                     @NotNull
                                     @NotNull T... resource)
        Constructs a new instance representing the specified event type in relation to the specified state change of the concerned resource.
        Parameters:
        type - the type of the event.
        resource - the resources implied in the event. For an update, two instances of the same resource is expected: the first being the resource before the update, the second being the resource after the update (the result of the update).
    • Method Detail

      • getType

        public ResourceEvent.Type getType()
        Description copied from interface: ResourceEvent
        Gets the type of the event. The type of the event carries the cause: a creation, an update, a removing or a deletion of the related resource. It defines then the state in the life-cycle of the resource.
        Specified by:
        getType in interface ResourceEvent<T extends Serializable>
        Returns:
        the type of the event (creation, update, deletion, ...)
      • getTransition

        public StateTransition<T> getTransition()
        Description copied from interface: ResourceEvent
        Gets the state transition implying by a change on the resource. The transition carries two instances of the resource: the resource before the change at the origin of this event, the the resource after the change has occurred. According to the type of the event, one of the state can be null or the two instances can be identical:
        • for a creation, the instance before the transition is null whereas the instance after the transition is the created resource,
        • for an update, the instance before the transition is the resource before the update whereas the instance after the transition is the resource after the update,
        • for a removing, the two instances are identical (as the resource is existent and recoverable),
        • for a deletion, the instance before the transition is the resource whereas the instance after the deletion is null.
        Specified by:
        getTransition in interface ResourceEvent<T extends Serializable>
        Returns:
        a state transition with two instances of the resource related by this event: one being the resource before the change, the second being the resource after the change.
      • putParameter

        public void putParameter​(String name,
                                 String value)
        Puts a new parameter to this resource. Parameters in event resource carries additional information and has to be simple.
        Parameters:
        name - the parameter name.
        value - the parameter value.
      • getParameterValue

        public String getParameterValue​(String name)
        Gets the value of the specified parameter. If the parameter isn't set in the event resource, then null is returned.
        Parameters:
        name - the name of the parameter to get.
        Returns:
        the value of the parameter or null if no such parameter is set in this notification.
      • getParameters

        public Set<String> getParameters()
        Gets the set of this event resource's parameters.
        Returns:
        an unmodifiable set of parameter names.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object