diff --git a/akka-actor/build.sbt b/akka-actor/build.sbt index 6ffec3edf3..a55394ba6b 100644 --- a/akka-actor/build.sbt +++ b/akka-actor/build.sbt @@ -14,3 +14,6 @@ OSGi.actor libraryDependencies ++= Dependencies.actor MimaKeys.previousArtifact := akkaPreviousArtifact("akka-actor").value + +spray.boilerplate.BoilerplatePlugin.Boilerplate.settings + diff --git a/akka-actor/src/main/boilerplate/akka/japi/function/Functions.scala.template b/akka-actor/src/main/boilerplate/akka/japi/function/Functions.scala.template new file mode 100644 index 0000000000..e447c56a80 --- /dev/null +++ b/akka-actor/src/main/boilerplate/akka/japi/function/Functions.scala.template @@ -0,0 +1,29 @@ +/** + * Copyright (C) 2015 Typesafe Inc. + */ +package akka.japi.function + +[3..22#/** + * A Function interface. Used to create 1-arg first-class-functions is Java. + * `Serializable` is needed to be able to grab line number for Java 8 lambdas. + */ +@SerialVersionUID(##1L) +trait Function1[[#-T1#], +R] extends java.io.Serializable { + @throws(classOf[Exception]) + def apply([#arg1: T1#]): R +}# + +] + +[2..#/** + * A Consumer interface. Used to create 1-arg consumers in Java. + * A Procedure is like a Function, but it doesn't produce a return value. + * `Serializable` is needed to be able to grab line number for Java 8 lambdas. + */ +@SerialVersionUID(##1L) +trait Procedure1[[#-T1#]] extends java.io.Serializable { + @throws(classOf[Exception]) + def apply([#arg1: T1#]): Unit +}# + +] diff --git a/akka-actor/src/main/scala/akka/japi/function/Function.scala b/akka-actor/src/main/scala/akka/japi/function/Function.scala new file mode 100644 index 0000000000..ce635a26c7 --- /dev/null +++ b/akka-actor/src/main/scala/akka/japi/function/Function.scala @@ -0,0 +1,66 @@ +/** + * Copyright (C) 2009-2015 Typesafe Inc. + */ +package akka.japi.function + +/** + * A Function interface. Used to create first-class-functions is Java. + * `Serializable` is needed to be able to grab line number for Java 8 lambdas. + */ +@SerialVersionUID(1L) +trait Function[-T, +R] extends java.io.Serializable { + @throws(classOf[Exception]) + def apply(param: T): R +} + +/** + * A Function interface. Used to create 2-arg first-class-functions is Java. + * `Serializable` is needed to be able to grab line number for Java 8 lambdas. + */ +@SerialVersionUID(1L) +trait Function2[-T1, -T2, +R] extends java.io.Serializable { + @throws(classOf[Exception]) + def apply(arg1: T1, arg2: T2): R +} + +/** + * A Procedure is like a Function, but it doesn't produce a return value. + * `Serializable` is needed to be able to grab line number for Java 8 lambdas. + */ +@SerialVersionUID(1L) +trait Procedure[-T] extends java.io.Serializable { + @throws(classOf[Exception]) + def apply(param: T): Unit +} + +/** + * An executable piece of code that takes no parameters and doesn't return any value. + * `Serializable` is needed to be able to grab line number for Java 8 lambdas. + */ +@SerialVersionUID(1L) +trait Effect extends java.io.Serializable { + @throws(classOf[Exception]) + def apply(): Unit +} + +/** + * Java API: Defines a criteria and determines whether the parameter meets this criteria. + * `Serializable` is needed to be able to grab line number for Java 8 lambdas. + */ +@SerialVersionUID(1L) +trait Predicate[-T] extends java.io.Serializable { + def test(param: T): Boolean +} + +/** + * A constructor/factory, takes no parameters but creates a new value of type T every call. + */ +@SerialVersionUID(1L) +trait Creator[+T] extends Serializable { + /** + * This method must return a different instance upon every call. + */ + @throws(classOf[Exception]) + def create(): T +} + diff --git a/project/plugins.sbt b/project/plugins.sbt index 10708baab5..b38ef45389 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,7 +1,6 @@ resolvers += Classpaths.typesafeResolver resolvers += "jgit-repo" at "http://download.eclipse.org/jgit/maven" - // need this to resolve http://jcenter.bintray.com/org/jenkins-ci/jenkins/1.26/ // which is used by plugin "org.kohsuke" % "github-api" % "1.68" resolvers += Resolver.jcenterRepo @@ -38,3 +37,6 @@ addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.0.0-RC1") addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.7.4") libraryDependencies += "org.kohsuke" % "github-api" % "1.68" + +addSbtPlugin("io.spray" % "sbt-boilerplate" % "0.5.9") +