Tabnine Logo
PartialFunction
Code IndexAdd Tabnine to your IDE (free)

How to use
PartialFunction
in
scala

Best Java code snippets using scala.PartialFunction (Showing top 20 results out of 315)

origin: com.typesafe.akka/akka-actor_2.10

 /**
  * Convenience function to make the Java code more readable.
  *
  * <pre><code>
  *   UnitMatcher&lt;X&gt; 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);
 }
}
origin: com.typesafe.akka/akka-actor_2.10

protected void addStatement(PartialFunction<F, T> statement) {
 if (statements == null)
  statements = statement;
 else
  statements = statements.orElse(statement);
}
origin: com.typesafe.play/play-test_2.10

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);
  }
}
origin: eclipse/ditto

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;
}
origin: com.typesafe.play/play-test_2.10

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);
  }
}
origin: org.eclipse.ditto/ditto-services-things-persistence

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;
}
origin: com.typesafe.akka/akka-actor_2.11

 /**
  * Convenience function to make the Java code more readable.
  *
  * <p>
  *
  * <pre><code>
  *   UnitMatcher&lt;X&gt; 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);
 }
}
origin: com.typesafe.akka/akka-actor_2.12

protected void addStatement(PartialFunction<Object, BoxedUnit> statement) {
 if (statements == null) statements = statement;
 else statements = statements.orElse(statement);
}
origin: play/play-test

/**
 * 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);
  }
}
origin: com.typesafe.akka/akka-actor_2.12

 /**
  * Convenience function to make the Java code more readable.
  *
  * <p>
  *
  * <pre><code>
  *   Match&lt;X, Y&gt; 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);
 }
}
origin: com.typesafe.akka/akka-actor_2.11

protected void addStatement(PartialFunction<Object, BoxedUnit> statement) {
 if (statements == null) statements = statement;
 else statements = statements.orElse(statement);
}
origin: eclipse/ditto

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();
}
origin: com.typesafe.akka/akka-actor_2.10

 /**
  * Convenience function to make the Java code more readable.
  *
  * <pre><code>
  *   Matcher&lt;X, Y&gt; 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);
 }
}
origin: com.typesafe.akka/akka-actor_2.11

protected void addStatement(PartialFunction<F, T> statement) {
 if (statements == null) statements = statement;
 else statements = statements.orElse(statement);
}
origin: com.typesafe.akka/akka-actor_2.12

 /**
  * Convenience function to make the Java code more readable.
  *
  * <p>
  *
  * <pre><code>
  *   UnitMatcher&lt;X&gt; 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);
 }
}
origin: com.typesafe.akka/akka-actor

protected void addStatement(PartialFunction<Object, BoxedUnit> statement) {
 if (statements == null) statements = statement;
 else statements = statements.orElse(statement);
}
origin: com.typesafe.akka/akka-actor

 /**
  * Convenience function to make the Java code more readable.
  *
  * <p>
  *
  * <pre><code>
  *   UnitMatcher&lt;X&gt; 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);
 }
}
origin: com.typesafe.akka/akka-actor_2.12

protected void addStatement(PartialFunction<F, T> statement) {
 if (statements == null) statements = statement;
 else statements = statements.orElse(statement);
}
origin: com.typesafe.akka/akka-actor_2.11

 /**
  * Convenience function to make the Java code more readable.
  *
  * <p>
  *
  * <pre><code>
  *   Match&lt;X, Y&gt; 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);
 }
}
origin: com.typesafe.akka/akka-actor

protected void addStatement(PartialFunction<F, T> statement) {
 if (statements == null) statements = statement;
 else statements = statements.orElse(statement);
}
scalaPartialFunction

Most used methods

  • apply
  • orElse
  • isDefinedAt
  • andThen

Popular in Java

  • Finding current android device location
  • scheduleAtFixedRate (Timer)
  • getSystemService (Context)
  • findViewById (Activity)
  • FlowLayout (java.awt)
    A flow layout arranges components in a left-to-right flow, much like lines of text in a paragraph. F
  • ArrayList (java.util)
    ArrayList is an implementation of List, backed by an array. All optional operations including adding
  • Locale (java.util)
    Locale represents a language/country/variant combination. Locales are used to alter the presentatio
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
  • Location (org.springframework.beans.factory.parsing)
    Class that models an arbitrary location in a Resource.Typically used to track the location of proble
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now