@ Override public < T > boolean match ( final MatcherContext < T > context ) { final Matcher matcher = context . getMatcher ( ) ; final PreMatchEvent < T > preMatchEvent = new PreMatchEvent <> ( context ) ; bus . post ( preMatchEvent ) ; if ( throwable != null ) throw new GrappaException ( "parsing listener error (before match)" , throwable ) ; // FIXME: is there any case at all where context.getMatcher() is null? @ SuppressWarnings ( "ConstantConditions" ) final boolean match = matcher . match ( context ) ; final MatchContextEvent < T > postMatchEvent = match ? new MatchSuccessEvent <> ( context ) : new MatchFailureEvent <> ( context ) ; bus . post ( postMatchEvent ) ; if ( throwable != null ) throw new GrappaException ( "parsing listener error (after match)" , throwable ) ; return match ; }
Internal method . DO NOT USE!