Package org.apache.tapestry5.internal.services

## Class ComponentEventImpl

- java.lang.Object
- - org.apache.tapestry5.internal.services.EventImpl
  - - org.apache.tapestry5.internal.services.ComponentEventImpl

- All Implemented Interfaces:
    `ComponentEvent`, `Event`

      public class ComponentEventImpl
      extends EventImpl
      implements ComponentEvent

- - ### Field Summary

    - ### Fields inherited from class org.apache.tapestry5.internal.services.EventImpl

      `tracker`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `ComponentEventImpl​(java.lang.String eventType, java.lang.String originatingComponentId, EventContext context, ComponentEventCallback handler, ComponentPageElementResources elementResources, boolean exactParameterCountMatch, ComponentModel model, org.slf4j.Logger logger)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `java.lang.Object` | `coerceContext​(int index, java.lang.String desiredTypeName)` | Coerces a context value to a particular type.
    `java.lang.Object[]` | `getContext()` | Returns the underlying `EventContext` as a (possibly empty) array.
    `EventContext` | `getEventContext()` | Returns the underlying event context.
    `boolean` | `matches​(java.lang.String eventType, java.lang.String componentId, int parameterCount)` | Returns true if the event matches the provided criteria and the event has not yet been aborted.
    `java.lang.String` | `toString()` |

    - ### Methods inherited from class org.apache.tapestry5.internal.services.EventImpl

      `getMethodDescription, isAborted, setMethodDescription, storeResult`

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

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

    - ### Methods inherited from interface org.apache.tapestry5.runtime.ComponentEvent

      `matches`

    - ### Methods inherited from interface org.apache.tapestry5.runtime.Event

      `isAborted, setMethodDescription, storeResult`

- - ### Constructor Detail

    - #### ComponentEventImpl

          public ComponentEventImpl​(java.lang.String eventType,
                                    java.lang.String originatingComponentId,
                                    EventContext context,
                                    ComponentEventCallback handler,
                                    ComponentPageElementResources elementResources,
                                    boolean exactParameterCountMatch,
                                    ComponentModel model,
                                    org.slf4j.Logger logger)

      Parameters:
        `eventType` - non blank string used to identify the type of event that was triggered
        `originatingComponentId` - the id of the component that triggered the event
        `context` - provides access to parameter values
        `handler` - invoked when a non-null return value is obtained from an event handler method
        `elementResources` - provides access to common resources and services
        `exactParameterCountMatch` - the `Symbol` indicating an exact match on parameter count in the `EventContext`.
        `model` - the `ComponentModel` of the component originating the event.
        `logger` - used to log method invocations

  - ### Method Detail

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`

    - #### matches

          public boolean matches​(java.lang.String eventType,
                                 java.lang.String componentId,
                                 int parameterCount)

      Description copied from interface: `ComponentEvent`
      Returns true if the event matches the provided criteria and the event has not yet been aborted.
      Specified by:
        `matches` in interface `ComponentEvent`
      Parameters:
        `eventType` - the type of event (case insensitive match)
        `componentId` - component is to match against (case insensitive), or the empty string
        `parameterCount` - minimum number of context values
      Returns:
        true if the event matches (and has not yet been aborted)

    - #### coerceContext

          public java.lang.Object coerceContext​(int index,
                                                java.lang.String desiredTypeName)

      Description copied from interface: `ComponentEvent`
      Coerces a context value to a particular type. The context is an array of objects; typically it is an array of strings of extra path information encoded into the action URL.
      Specified by:
        `coerceContext` in interface `ComponentEvent`
      Parameters:
        `index` - the index of the context value
        `desiredTypeName` - the desired type
      Returns:
        the coerced value (a wrapper type if the desired type is a primitive)

    - #### getContext

          public java.lang.Object[] getContext()

      Description copied from interface: `ComponentEvent`
      Returns the underlying `EventContext` as a (possibly empty) array.
      Specified by:
        `getContext` in interface `ComponentEvent`

    - #### getEventContext

          public EventContext getEventContext()

      Description copied from interface: `ComponentEvent`
      Returns the underlying event context.
      Specified by:
        `getEventContext` in interface `ComponentEvent`