Interface TypedModelSpec<M,P1>
-
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface TypedModelSpec<M,P1>Abstraction that allows the construction of ModelSpecs using strongly typed parameter replacements. For example, given a ModelSpec with a path such as "/root/registry/people/{id}" where "id" should be
PersonId.// Step 1. Create a typed ZPath TypedZPath<PersonId> typedPath = TypedZPath.from("/root/registry/people/{id}"); // Step 2. Create a ModelSpec builder (do not build at this point) ModelSpecBuilder<Person> builder = ModelSpec.builder(JacksonModelSerializer.build(Person.class)) // Step 3. Create a typed ModelSpec using the typed ZPath and ModelSpec builder TypedModelSpec<Person, PersonId> typedModelSpec = TypedModelSpec.from(builder, path); // later on the TypedModelSpec can be resolved into a useable ModelSpec ModelSpec<Person> modelSpec = typedModelSpec.resolve(personId);
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static <M,P1>
TypedModelSpec<M,P1>from(ModelSpecBuilder<M> builder, java.lang.String pathWithIds)Return a new TypedModelSpec using the given model spec builder and path.static <M,P1>
TypedModelSpec<M,P1>from(ModelSpecBuilder<M> builder, TypedZPath<P1> path)Return a new TypedModelSpec using the given model spec builder and typed path.ModelSpec<M>resolved(P1 p1)Resolve into a ZPath using the given parameter
-
-
-
Method Detail
-
resolved
ModelSpec<M> resolved(P1 p1)
Resolve into a ZPath using the given parameter- Parameters:
p1- the parameter- Returns:
- ZPath
-
from
static <M,P1> TypedModelSpec<M,P1> from(ModelSpecBuilder<M> builder, TypedZPath<P1> path)
Return a new TypedModelSpec using the given model spec builder and typed path. Whenresolved(Object)is called the actual model spec is generated with the resolved path- Parameters:
builder- model spec builderpath- typed path- Returns:
- new TypedModelSpec
-
from
static <M,P1> TypedModelSpec<M,P1> from(ModelSpecBuilder<M> builder, java.lang.String pathWithIds)
Return a new TypedModelSpec using the given model spec builder and path. A TypedZPath is created from the given full path and Whenresolved(Object)is called the actual model spec is generated with the resolved path- Parameters:
builder- model spec builderpathWithIds- typed path- Returns:
- new TypedModelSpec
-
-