Class AbstractEventContext

    • Method Detail

      • tryGet

        public <T> Optional<T> tryGet​(Class<T> desiredType,
                                      int index)
        Description copied from interface: EventContext
        Tries to extract a parameter value and coerces or decodes it to the desired type.
        Specified by:
        tryGet in interface EventContext
        Parameters:
        desiredType - the type of value required
        index - identifies which parameter value to extract
        Returns:
        the value extracted and converted or coerced, wrapped in an Optional, or Optional.isEmpty() if index is out of bounds, or the value can't be converted.