/** * Convenience function to make the Java code more readable. * * <pre><code> * UnitMatcher<X> matcher = UnitMatcher.create(...); * * matcher.match(obj); * </code></pre> * * @param i the argument to apply the match to * @throws scala.MatchError if there is no match */ public void match(I i) throws MatchError { statements.apply(i); } }
protected void addStatement(PartialFunction<F, T> statement) { if (statements == null) statements = statement; else statements = statements.orElse(statement); }
public static Result routeAndCall(Class<? extends Router> router, RequestBuilder requestBuilder, long timeout) { try { Request request = requestBuilder.build(); Router routes = (Router) router.getClassLoader().loadClass(router.getName() + "$").getDeclaredField("MODULE$").get(null); if(routes.routes().isDefinedAt(request._underlyingRequest())) { return invokeHandler(routes.routes().apply(request._underlyingRequest()), request, timeout); } else { return null; } } catch(RuntimeException e) { throw e; } catch(Throwable t) { throw new RuntimeException(t); } }
private AbstractActor.Receive applyPeekStepIfSet(final AbstractActor.Receive receive) { if (null != peekStep) { final PartialFunction<Object, BoxedUnit> onMessage = peekStep.andThen(receive.onMessage()); return new AbstractActor.Receive(onMessage); } return receive; }
public static Result routeAndCall(Router router, RequestBuilder requestBuilder, long timeout) { try { Request request = requestBuilder.build(); if(router.routes().isDefinedAt(request._underlyingRequest())) { return invokeHandler(router.routes().apply(request._underlyingRequest()), request, timeout); } else { return null; } } catch(RuntimeException e) { throw e; } catch(Throwable t) { throw new RuntimeException(t); } }
private AbstractActor.Receive applyPeekStepIfSet(final AbstractActor.Receive receive) { if (null != peekStep) { final PartialFunction<Object, BoxedUnit> onMessage = peekStep.andThen(receive.onMessage()); return new AbstractActor.Receive(onMessage); } return receive; }
/** * Convenience function to make the Java code more readable. * * <p> * * <pre><code> * UnitMatcher<X> matcher = UnitMatcher.create(...); * * matcher.match(obj); * </code></pre> * * @param i the argument to apply the match to * @throws scala.MatchError if there is no match */ public void match(I i) throws MatchError { statements.apply(i); } }
protected void addStatement(PartialFunction<Object, BoxedUnit> statement) { if (statements == null) statements = statement; else statements = statements.orElse(statement); }
/** * Use the Router to determine the Action to call for this request and executes it. * @deprecated * @see #route instead */ public static Result routeAndCall(Class<? extends play.core.Router.Routes> router, FakeRequest fakeRequest) { try { play.core.Router.Routes routes = (play.core.Router.Routes)router.getClassLoader().loadClass(router.getName() + "$").getDeclaredField("MODULE$").get(null); if(routes.routes().isDefinedAt(fakeRequest.getWrappedRequest())) { return invokeHandler(routes.routes().apply(fakeRequest.getWrappedRequest()), fakeRequest); } else { return null; } } catch(RuntimeException e) { throw e; } catch(Throwable t) { throw new RuntimeException(t); } }
/** * Convenience function to make the Java code more readable. * * <p> * * <pre><code> * Match<X, Y> matcher = Match.create(...); * * Y someY = matcher.match(obj); * </code></pre> * * @param i the argument to apply the match to * @return the result of the application * @throws MatchError if there is no match */ public R match(I i) throws MatchError { return statements.apply(i); } }
protected void addStatement(PartialFunction<Object, BoxedUnit> statement) { if (statements == null) statements = statement; else statements = statements.orElse(statement); }
private Receive lockBehavior(final Receive receive) { checkNotNull(receive, "actor's message handler"); return ReceiveBuilder.create() .matchEquals(Control.UNLOCK, unlock -> { locked = false; cancelLockTimeout(); unstashAll(); }) .matchAny(message -> { final PartialFunction<Object, ?> handler = receive.onMessage(); if (locked) { stash(); } else if (handler.isDefinedAt(message)) { handler.apply(message); } else { unhandled(message); } }) .build(); }
/** * Convenience function to make the Java code more readable. * * <pre><code> * Matcher<X, Y> matcher = Matcher.create(...); * * Y someY = matcher.match(obj); * </code></pre> * * @param i the argument to apply the match to * @return the result of the application * @throws MatchError if there is no match */ public R match(I i) throws MatchError { return statements.apply(i); } }
protected void addStatement(PartialFunction<F, T> statement) { if (statements == null) statements = statement; else statements = statements.orElse(statement); }
/** * Convenience function to make the Java code more readable. * * <p> * * <pre><code> * UnitMatcher<X> matcher = UnitMatcher.create(...); * * matcher.match(obj); * </code></pre> * * @param i the argument to apply the match to * @throws scala.MatchError if there is no match */ public void match(I i) throws MatchError { statements.apply(i); } }
protected void addStatement(PartialFunction<Object, BoxedUnit> statement) { if (statements == null) statements = statement; else statements = statements.orElse(statement); }
/** * Convenience function to make the Java code more readable. * * <p> * * <pre><code> * UnitMatcher<X> matcher = UnitMatcher.create(...); * * matcher.match(obj); * </code></pre> * * @param i the argument to apply the match to * @throws scala.MatchError if there is no match */ public void match(I i) throws MatchError { statements.apply(i); } }
protected void addStatement(PartialFunction<F, T> statement) { if (statements == null) statements = statement; else statements = statements.orElse(statement); }
/** * Convenience function to make the Java code more readable. * * <p> * * <pre><code> * Match<X, Y> matcher = Match.create(...); * * Y someY = matcher.match(obj); * </code></pre> * * @param i the argument to apply the match to * @return the result of the application * @throws MatchError if there is no match */ public R match(I i) throws MatchError { return statements.apply(i); } }
protected void addStatement(PartialFunction<F, T> statement) { if (statements == null) statements = statement; else statements = statements.orElse(statement); }