akka.japi.pf.UnitMatch Maven / Gradle / Ivy
/*
* Copyright (C) 2009-2020 Lightbend Inc.
*/
package akka.japi.pf;
import scala.MatchError;
import scala.PartialFunction;
import scala.runtime.BoxedUnit;
/**
* Version of {@link scala.PartialFunction} that can be built during runtime from Java. This is a
* specialized version of {@link UnitMatch} to map java void methods to {@link
* scala.runtime.BoxedUnit}.
*
* @param the input type, that this PartialFunction will be applied to
*/
public class UnitMatch extends AbstractMatch {
/**
* Convenience function to create a {@link UnitPFBuilder} with the first case statement added.
*
* @param type a type to match the argument against
* @param apply an action to apply to the argument if the type matches
* @return a builder with the case statement added
* @see UnitPFBuilder#match(Class, FI.UnitApply)
*/
public static UnitPFBuilder match(final Class type, FI.UnitApply
apply) {
return new UnitPFBuilder().match(type, apply);
}
/**
* Convenience function to create a {@link UnitPFBuilder} with the first case statement added.
* Should normally not be used.
*
* @see UnitPFBuilder#matchUnchecked(Class, FI.UnitApply)
*/
public static UnitPFBuilder