Class ModelSpecImpl<T>

  • All Implemented Interfaces:
    org.apache.curator.framework.schema.SchemaValidator, ModelSpec<T>, Resolvable

    public class ModelSpecImpl<T>
    extends java.lang.Object
    implements ModelSpec<T>, org.apache.curator.framework.schema.SchemaValidator
    • Constructor Summary

      Constructors 
      Constructor Description
      ModelSpecImpl​(ZPath path, ModelSerializer<T> serializer, org.apache.zookeeper.CreateMode createMode, java.util.List<org.apache.zookeeper.data.ACL> aclList, java.util.Set<CreateOption> createOptions, java.util.Set<DeleteOption> deleteOptions, long ttl)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.List<org.apache.zookeeper.data.ACL> aclList()
      Return the model's ACL list
      ModelSpec<T> child​(java.lang.Object child)
      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 createMode()
      Return the model's create mode
      java.util.Set<CreateOption> createOptions()
      Return the model's create options
      java.util.Set<DeleteOption> deleteOptions()
      Return the model's delete options
      boolean equals​(java.lang.Object o)  
      int hashCode()  
      boolean isValid​(org.apache.curator.framework.schema.Schema schema, java.lang.String path, byte[] data, java.util.List<org.apache.zookeeper.data.ACL> acl)  
      ModelSpec<T> parent()
      Return a new CuratorModel instance with all the same options but applying to the parent node of this CuratorModel's path.
      ZPath path()
      Return the model's path
      ModelSpec<T> resolved​(java.lang.Object... parameters)
      Return a new CuratorModel instance with all the same options but using a resolved path by calling ZPath.resolved(Object...) using the given parameters
      ModelSpec<T> resolved​(java.util.List<java.lang.Object> parameters)
      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 parameters
      org.apache.curator.framework.schema.Schema schema()
      Return a Curator schema that validates ZNodes at this model's path using this model's values
      ModelSerializer<T> serializer()
      Return the model's serializer
      java.lang.String toString()  
      long ttl()
      Return the TTL to use or -1
      ModelSpec<T> withPath​(ZPath newPath)
      Return a new CuratorModel instance with all the same options but using the given path.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • ModelSpecImpl

        public ModelSpecImpl​(ZPath path,
                             ModelSerializer<T> serializer,
                             org.apache.zookeeper.CreateMode createMode,
                             java.util.List<org.apache.zookeeper.data.ACL> aclList,
                             java.util.Set<CreateOption> createOptions,
                             java.util.Set<DeleteOption> deleteOptions,
                             long ttl)
    • Method Detail

      • child

        public ModelSpec<T> child​(java.lang.Object child)
        Description copied from interface: ModelSpec

        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 implements NodeName, the value of nodeName().

        Specified by:
        child in interface ModelSpec<T>
        Parameters:
        child - child node.
        Returns:
        new Modeled Spec instance
      • parent

        public ModelSpec<T> parent()
        Description copied from interface: ModelSpec

        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 implements NodeName, the value of nodeName().

        Specified by:
        parent in interface ModelSpec<T>
        Returns:
        new Modeled Spec instance
      • resolved

        public ModelSpec<T> resolved​(java.lang.Object... parameters)
        Description copied from interface: ModelSpec

        Return a new CuratorModel instance with all the same options but using a resolved path by calling ZPath.resolved(Object...) using the given parameters

        The replacement is the toString() value of the parameter object or, if the object implements NodeName, the value of nodeName().

        Specified by:
        resolved in interface ModelSpec<T>
        Specified by:
        resolved in interface Resolvable
        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

        public ModelSpec<T> resolved​(java.util.List<java.lang.Object> parameters)
        Description copied from interface: ModelSpec

        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 parameters

        The replacement is the toString() value of the parameter object or, if the object implements NodeName, the value of nodeName().

        Specified by:
        resolved in interface ModelSpec<T>
        Specified by:
        resolved in interface Resolvable
        Parameters:
        parameters - list of replacements. Must have be the same length as the number of parameter nodes in the path
        Returns:
        new resolved ModelSpec
      • withPath

        public ModelSpec<T> withPath​(ZPath newPath)
        Description copied from interface: ModelSpec
        Return a new CuratorModel instance with all the same options but using the given path.
        Specified by:
        withPath in interface ModelSpec<T>
        Parameters:
        newPath - new path
        Returns:
        new Modeled Spec instance
      • path

        public ZPath path()
        Description copied from interface: ModelSpec
        Return the model's path
        Specified by:
        path in interface ModelSpec<T>
        Returns:
        path
      • createMode

        public org.apache.zookeeper.CreateMode createMode()
        Description copied from interface: ModelSpec
        Return the model's create mode
        Specified by:
        createMode in interface ModelSpec<T>
        Returns:
        create mode
      • aclList

        public java.util.List<org.apache.zookeeper.data.ACL> aclList()
        Description copied from interface: ModelSpec
        Return the model's ACL list
        Specified by:
        aclList in interface ModelSpec<T>
        Returns:
        ACL list
      • createOptions

        public java.util.Set<CreateOption> createOptions()
        Description copied from interface: ModelSpec
        Return the model's create options
        Specified by:
        createOptions in interface ModelSpec<T>
        Returns:
        create options
      • deleteOptions

        public java.util.Set<DeleteOption> deleteOptions()
        Description copied from interface: ModelSpec
        Return the model's delete options
        Specified by:
        deleteOptions in interface ModelSpec<T>
        Returns:
        delete options
      • ttl

        public long ttl()
        Description copied from interface: ModelSpec
        Return the TTL to use or -1
        Specified by:
        ttl in interface ModelSpec<T>
        Returns:
        ttl
      • schema

        public org.apache.curator.framework.schema.Schema schema()
        Description copied from interface: ModelSpec
        Return a Curator schema that validates ZNodes at this model's path using this model's values
        Specified by:
        schema in interface ModelSpec<T>
        Returns:
        schema
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • isValid

        public boolean isValid​(org.apache.curator.framework.schema.Schema schema,
                               java.lang.String path,
                               byte[] data,
                               java.util.List<org.apache.zookeeper.data.ACL> acl)
        Specified by:
        isValid in interface org.apache.curator.framework.schema.SchemaValidator