Class ModelSpecImpl<T>

java.lang.Object
org.apache.curator.x.async.modeled.details.ModelSpecImpl<T>
All Implemented Interfaces:
SchemaValidator, ModelSpec<T>, Resolvable

public class ModelSpecImpl<T> extends Object implements ModelSpec<T>, SchemaValidator
  • Constructor Details

  • Method Details

    • child

      public ModelSpec<T> child(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(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(List<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
    • serializer

      public ModelSerializer<T> serializer()
      Description copied from interface: ModelSpec
      Return the model's serializer
      Specified by:
      serializer in interface ModelSpec<T>
      Returns:
      serializer
    • 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 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 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 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 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(Object o)
      Overrides:
      equals in class Object
    • hashCode

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

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

      public boolean isValid(Schema schema, String path, byte[] data, List<org.apache.zookeeper.data.ACL> acl)
      Specified by:
      isValid in interface SchemaValidator
      Parameters:
      schema - the schema being validated
      path - the path being operated on
      data - data or null
      acl - acls or null
      Returns:
      true if valid