Interface ModelSpec<T>
- All Superinterfaces:
Resolvable
- All Known Implementing Classes:
ModelSpecImpl
- A node path
- Serializer for the data stored
- Options for how to create the node (mode, compression, etc.)
- Options for how to deleting the node (quietly, guaranteed, etc.)
- ACLs
- Optional schema generation
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionList
<org.apache.zookeeper.data.ACL> aclList()
Return the model's ACL liststatic <T> ModelSpecBuilder
<T> builder
(ModelSerializer<T> serializer) Start a new ModelSpecBuilder for the given serializer.static <T> ModelSpecBuilder
<T> builder
(ZPath path, ModelSerializer<T> serializer) Start a new ModelSpecBuilder for the given path and serializer.Return a new CuratorModel instance with all the same options but applying to the given child node of this CuratorModel's path.org.apache.zookeeper.CreateMode
Return the model's create modeReturn the model's create optionsReturn the model's delete optionsparent()
Return a new CuratorModel instance with all the same options but applying to the parent node of this CuratorModel's path.path()
Return the model's pathReturn a new CuratorModel instance with all the same options but using a resolved path by callingZPath.resolved(Object...)
using the given parametersReturn a new CuratorModel instance with all the same options but using a resolved path by callingZPath.resolved(java.util.List)
using the given parametersschema()
Return a Curator schema that validates ZNodes at this model's path using this model's valuesReturn the model's serializerlong
ttl()
Return the TTL to use or -1Return a new CuratorModel instance with all the same options but using the given path.
-
Field Details
-
defaultCreateOptions
-
defaultDeleteOptions
-
-
Method Details
-
builder
Start a new ModelSpecBuilder for the given path and serializer. The returned ModelSpecBuilder usesdefaultCreateOptions
anddefaultDeleteOptions
, but you can change these with builder methods.- Parameters:
path
- path to modelserializer
- the model's serializer- Returns:
- builder
-
builder
Start a new ModelSpecBuilder for the given serializer. The returned ModelSpecBuilder usesdefaultCreateOptions
anddefaultDeleteOptions
, but you can change these with builder methods. You must set a path before callingModelSpecBuilder.build()
- Parameters:
serializer
- the model's serializer- Returns:
- builder
-
child
Return a new CuratorModel instance with all the same options but applying to the given child node of this CuratorModel's path. E.g. if this CuratorModel instance applies to "/a/b", calling
modeled.at("c")
returns an instance that applies to "/a/b/c".The replacement is the
toString()
value of child or, if it implementsNodeName
, the value ofnodeName()
.- Parameters:
child
- child node.- Returns:
- new Modeled Spec instance
-
parent
Return a new CuratorModel instance with all the same options but applying to the parent node of this CuratorModel's path. E.g. if this CuratorModel instance applies to "/a/b/c", calling
modeled.parent()
returns an instance that applies to "/a/b".The replacement is the
toString()
value of child or, if it implementsNodeName
, the value ofnodeName()
.- Returns:
- new Modeled Spec instance
-
withPath
Return a new CuratorModel instance with all the same options but using the given path.- Parameters:
path
- new path- Returns:
- new Modeled Spec instance
-
resolved
Return a new CuratorModel instance with all the same options but using a resolved path by calling
ZPath.resolved(Object...)
using the given parametersThe replacement is the
toString()
value of the parameter object or, if the object implementsNodeName
, the value ofnodeName()
.- Specified by:
resolved
in interfaceResolvable
- Parameters:
parameters
- list of replacements. Must have be the same length as the number of parameter nodes in the path- Returns:
- new resolved ModelSpec
-
resolved
Return a new CuratorModel instance with all the same options but using a resolved path by calling
ZPath.resolved(java.util.List)
using the given parametersThe replacement is the
toString()
value of the parameter object or, if the object implementsNodeName
, the value ofnodeName()
.- Specified by:
resolved
in interfaceResolvable
- Parameters:
parameters
- list of replacements. Must have be the same length as the number of parameter nodes in the path- Returns:
- new resolved ModelSpec
-
path
ZPath path()Return the model's path- Returns:
- path
-
serializer
ModelSerializer<T> serializer()Return the model's serializer- Returns:
- serializer
-
createMode
org.apache.zookeeper.CreateMode createMode()Return the model's create mode- Returns:
- create mode
-
aclList
List<org.apache.zookeeper.data.ACL> aclList()Return the model's ACL list- Returns:
- ACL list
-
createOptions
Set<CreateOption> createOptions()Return the model's create options- Returns:
- create options
-
deleteOptions
Set<DeleteOption> deleteOptions()Return the model's delete options- Returns:
- delete options
-
ttl
long ttl()Return the TTL to use or -1- Returns:
- ttl
-
schema
Schema schema()Return a Curator schema that validates ZNodes at this model's path using this model's values- Returns:
- schema
-