Skip to content

Commit

Permalink
Adding more JavaDocs, specifically to CloudState.java and CloudStateR…
Browse files Browse the repository at this point in the history
…unner.java
  • Loading branch information
viktorklang committed Aug 26, 2019
1 parent 6a47524 commit 6b9fffa
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@
import java.util.HashMap;
import java.util.Map;

// TODO JavaDoc
/**
* The CloudState class is the main interface to configuring entities to deploy,
* and subsequently starting a local server which will expose these entities to
* the CloudState Proxy Sidecar.
*/
public final class CloudState {
private final Map<String, StatefulService> services = new HashMap<>();
private ClassLoader classLoader = getClass().getClassLoader();
Expand All @@ -35,19 +39,35 @@ public CloudState withClassLoader(ClassLoader classLoader) {
return this;
}

// TODO JavaDoc
/**
* Sets the type URL prefix to be used when serializing and deserializing
* types from and to Protobyf Any values. Defaults to "type.googleapis.com".
*
* @param prefix the type URL prefix to be used.
* @return This CloudState instance.
*/
public CloudState withTypeUrlPrefix(String prefix) {
this.typeUrlPrefix = prefix;
return this;
}

// TODO JavaDoc
/**
* When locating protobufs, if both a Java and a ScalaPB generated class is found on the classpath,
* this specifies that Java should be preferred.
*
* @return This CloudState instance.
*/
public CloudState preferJavaProtobufs() {
this.prefer = AnySupport.PREFER_JAVA();
return this;
}

// TODO JavaDoc
/**
* When locating protobufs, if both a Java and a ScalaPB generated class is found on the classpath,
* this specifies that Scala should be preferred.
*
* @return This CloudState instance.
*/
public CloudState preferScalaProtobufs() {
this.prefer = AnySupport.PREFER_SCALA();
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,13 @@ object CloudStateRunner {
}
}

// TODO JavaDoc
/**
* The CloudStateRunner is responsible for handle the bootstrap of entities,
* and is used by [[io.cloudstate.javasupport.CloudState.start()]] to set up the local
* server with the given configuration.
*
* CloudStateRunner can be seen as a low-level API for cases where [[io.cloudstate.javasupport.CloudState.start()]] isn't enough.
*/
final class CloudStateRunner private[this](_system: ActorSystem, services: Map[String, StatefulService]) {
private[this] implicit final val system = _system
private[this] implicit final val materializer: Materializer = ActorMaterializer()
Expand Down Expand Up @@ -129,15 +135,27 @@ final class CloudStateRunner private[this](_system: ActorSystem, services: Map[S
FutureConverters.toJava(system.terminate()).thenApply(_ => Done)
}

// TODO JavaDoc
// This class will describe the stateless service and is created and passed by the user into a CloudState instance.
/**
* StatefulService describes an entitiy type in a way which makes it possible
* to deploy.
*/
trait StatefulService {
// TODO JavaDoc
/**
* @return a Protobuf ServiceDescriptor of its externally accessible gRPC API
*/
def descriptor: Descriptors.ServiceDescriptor
// TODO JavaDoc

/**
* Possible values are: "", "", "".
* @return the type of entity represented by this StatefulService
*/
def entityType: String
// TODO JavaDoc

/**
* @return the persistence identifier used for the the entities represented by this service
*/
def persistenceId: String = descriptor.getName

// TODO JavaDoc
def resolvedMethods: Option[Map[String, ResolvedServiceMethod[_, _]]]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,6 @@ private final class JacksonResolvedType[T](
}

trait ResolvedEntityFactory {
// TODO JavaDoc
def resolvedMethods: Map[String, ResolvedServiceMethod[_, _]]
}

0 comments on commit 6b9fffa

Please sign in to comment.