diff --git a/build.sbt b/build.sbt index b4f0d301..3e1104a7 100644 --- a/build.sbt +++ b/build.sbt @@ -11,3 +11,4 @@ scalaVersion := "2.10.3" lazy val spi = project lazy val tck = project.dependsOn(spi) + diff --git a/project/Build.scala b/project/Build.scala new file mode 100644 index 00000000..c69eac96 --- /dev/null +++ b/project/Build.scala @@ -0,0 +1,17 @@ +import sbt._ +import Keys._ + +object Common { + lazy val JavaDoc = config("genjavadoc") extend Compile + + val javadocSettings = inConfig(JavaDoc)(Defaults.configSettings) ++ Seq( + packageDoc in Compile <<= packageDoc in JavaDoc, + sources in JavaDoc <<= (target, compile in Compile, sources in Compile) map ((t, c, s) => + (t / "java" ** "*.java").get ++ s.filter(_.getName.endsWith(".java")) + ), + javacOptions in JavaDoc := Seq(), + artifactName in packageDoc in JavaDoc := ((sv, mod, art) => "" + mod.name + "_" + sv.binary + "-" + mod.revision + "-javadoc.jar"), + libraryDependencies += compilerPlugin("com.typesafe.genjavadoc" %% "genjavadoc-plugin" % "0.5" cross CrossVersion.full), + scalacOptions in Compile <+= target map (t => "-P:genjavadoc:out=" + (t / "java")) + ) +} diff --git a/spi/build.sbt b/spi/build.sbt index 6d576a7d..4c385634 100644 --- a/spi/build.sbt +++ b/spi/build.sbt @@ -1,3 +1,5 @@ organization := "org.reactivestreams" name := "reactive-streams-spi" + +Common.javadocSettings diff --git a/spi/src/main/scala/org/reactivestreams/api/Producer.scala b/spi/src/main/scala/org/reactivestreams/api/Producer.scala index 6616ff5c..99a24f4e 100644 --- a/spi/src/main/scala/org/reactivestreams/api/Producer.scala +++ b/spi/src/main/scala/org/reactivestreams/api/Producer.scala @@ -3,7 +3,7 @@ package api /** * A Producer is the logical source of elements of a given type. - * The underlying implementation is done by way of a [[asyncrx.spi.Publisher]]. + * The underlying implementation is done by way of a [[org.reactivestreams.spi.Publisher]]. * This interface is the user-level API for a source while a Publisher is the * SPI. * @@ -15,6 +15,8 @@ trait Producer[T] { /** * Get the underlying Publisher for this Producer. This method should only be used by * implementations of this API. + * + * @return the underlying publisher for this producer */ def getPublisher: spi.Publisher[T] @@ -24,19 +26,20 @@ trait Producer[T] { * underlying Publisher, which will initiate the transfer of the produced * stream of elements from producer to consumer until either of three things * happen: - * * + * + * @param consumer The consumer to register with this producer. */ def produceTo(consumer: Consumer[T]): Unit } /** * A Consumer is the logical sink of elements of a given type. - * The underlying implementation is done by way of a [[asyncrx.spi.Subscriber]]. + * The underlying implementation is done by way of a [[org.reactivestreams.spi.Subscriber]]. * This interface is the user-level API for a sink while a Subscriber is the SPI. * * Implementations of this interface will typically offer domain- or language-specific @@ -47,6 +50,8 @@ trait Consumer[T] { /** * Get the underlying Subscriber for this Consumer. This method should only be used by * implementations of this API. + * + * @return the underlying subscriber for this consumer */ def getSubscriber: spi.Subscriber[T] } diff --git a/spi/src/main/scala/org/reactivestreams/spi/Publisher.scala b/spi/src/main/scala/org/reactivestreams/spi/Publisher.scala index 4a3327ff..8e91d9bc 100644 --- a/spi/src/main/scala/org/reactivestreams/spi/Publisher.scala +++ b/spi/src/main/scala/org/reactivestreams/spi/Publisher.scala @@ -20,6 +20,8 @@ trait Subscription { * The number of requested elements is cumulative to the number requested previously. * The Publisher may eventually publish up to the requested number of elements to * the [[Subscriber]] which owns this Subscription. + * + * @param elements The number of elements requested. */ def requestMore(elements: Int): Unit } @@ -34,6 +36,8 @@ trait Publisher[T] { /** * Subscribe the given [[Subscriber]] to this Publisher. A Subscriber can at most be subscribed once * to a given Publisher, and to at most one Publisher in total. + * + * @param subscriber The subscriber to register with this publisher. */ def subscribe(subscriber: Subscriber[T]): Unit } @@ -49,6 +53,8 @@ trait Subscriber[T] { * The [[Publisher]] generates a [[Subscription]] upon [[Publisher#subscribe]] and passes * it on to the Subscriber named there using this method. The Publisher may choose to reject * the subscription request by calling [[#onError]] instead. + * + * @param subscription The subscription which connects this subscriber to its publisher. */ def onSubscribe(subscription: Subscription): Unit @@ -56,6 +62,8 @@ trait Subscriber[T] { * The [[Publisher]] calls this method to pass one element to this Subscriber. The element * must not be null. The Publisher must not call this method more often than * the Subscriber has signaled demand for via the corresponding [[Subscription]]. + * + * @param element The element that is passed from publisher to subscriber. */ def onNext(element: T): Unit @@ -75,6 +83,8 @@ trait Subscriber[T] { * This method is not intended to pass validation errors or similar from Publisher to Subscriber * in order to initiate an orderly shutdown of the exchange; it is intended only for fatal * failure conditions which make it impossible to continue processing further elements. + * + * @param cause An exception which describes the reason for tearing down this stream. */ def onError(cause: Throwable): Unit }