akka.japi.pf.AbstractMatch Maven / Gradle / Ivy
/**
* Copyright (C) 2009-2014 Typesafe Inc.
*/
package akka.japi.pf;
import scala.PartialFunction;
/**
* Version of {@link scala.PartialFunction} that can be built during
* runtime from Java.
*
* @param the input type, that this PartialFunction will be applied to
* @param the return type, that the results of the application will have
*
* This is an EXPERIMENTAL feature and is subject to change until it has received more real world testing.
*/
class AbstractMatch {
protected final PartialFunction statements;
AbstractMatch(PartialFunction statements) {
PartialFunction empty = CaseStatement.empty();
if (statements == null)
this.statements = empty;
else
this.statements = statements.orElse(empty);
}
/**
* Turn this {@link Match} into a {@link scala.PartialFunction}.
*
* @return a partial function representation ot his {@link Match}
*/
public PartialFunction asPF() {
return statements;
}
}