=cdd #17778 Convert samples to java

This commit is contained in:
Patrik Nordwall 2015-07-01 09:46:58 +02:00
parent 7bfc56f3f0
commit 94a61c7eb2
32 changed files with 2220 additions and 67 deletions

View file

@ -44,8 +44,19 @@ final class LWWMap[A] private[akka] (
type T = LWWMap[A]
/**
* Scala API: All entries of the map.
*/
def entries: Map[String, A] = underlying.entries.map { case (k, r) k -> r.value }
/**
* Java API: All entries of the map.
*/
def getEntries(): java.util.Map[String, A] = {
import scala.collection.JavaConverters._
entries.asJava
}
def get(key: String): Option[A] = underlying.get(key).map(_.value)
def contains(key: String): Boolean = underlying.contains(key)

View file

@ -37,7 +37,10 @@ final class PNCounterMap private[akka] (
def entries: Map[String, BigInt] = underlying.entries.map { case (k, c) k -> c.value }
/** Java API */
def getEntries: Map[String, BigInteger] = underlying.entries.map { case (k, c) k -> c.value.bigInteger }
def getEntries: java.util.Map[String, BigInteger] = {
import scala.collection.JavaConverters._
underlying.entries.map { case (k, c) k -> c.value.bigInteger }.asJava
}
/**
* Scala API: The count for a key

View file

@ -217,6 +217,13 @@ object Replicator {
* Java API: `Get` value from local `Replicator`, i.e. `ReadLocal` consistency.
*/
def this(key: Key[A], consistency: ReadConsistency) = this(key, consistency, None)
/**
* Java API: `Get` value from local `Replicator`, i.e. `ReadLocal` consistency.
*/
def this(key: Key[A], consistency: ReadConsistency, request: Optional[Any]) =
this(key, consistency, Option(request.orElse(null)))
}
sealed abstract class GetResponse[A <: ReplicatedData] extends NoSerializationVerificationNeeded {
def key: Key[A]