Interface PdoFactory

All Known Implementing Classes:
AbstractPdoFactory, DefaultPdoFactory

public interface PdoFactory
A factory for persistent domain objects.
Author:
harald
  • Method Details

    • getInstance

      static PdoFactory getInstance()
      The singleton.
      Returns:
      the singleton
    • getPersistenceMapper

      org.tentackle.reflect.ClassMapper getPersistenceMapper()
      Gets the persistence class mapper associated to this factory.
      The classmapper maps PDO interfaces to their persistence implementation.
      Returns:
      the mapper for the persistence implementations
    • getDomainMapper

      org.tentackle.reflect.ClassMapper getDomainMapper()
      Gets the domain class mapper associated to this factory.
      The classmapper maps PDO interfaces to their domain implementation.
      Returns:
      the mapper for the domain implementations
    • create

      <T extends PersistentDomainObject<T>> T create(Class<T> clazz, DomainContext context)
      Creates a PDO.
      Type Parameters:
      T - the PDO type
      Parameters:
      clazz - the class of the PDO, usually an interface
      context - the domain context
      Returns:
      the created PDO
    • create

      <T extends PersistentDomainObject<T>> T create(Class<T> clazz, Session session)
      Creates a PDO.
      Type Parameters:
      T - the PDO type
      Parameters:
      clazz - the class of the PDO, usually an interface
      session - the session
      Returns:
      the created PDO
    • create

      <T extends PersistentDomainObject<T>> T create(String className, DomainContext context)
      Creates a PDO.
      Type Parameters:
      T - the PDO type
      Parameters:
      className - the name of PDO-class, usually an interface
      context - the domain context
      Returns:
      the created PDO
    • create

      <T extends PersistentDomainObject<T>> T create(String className, Session session)
      Creates a PDO for a session only.

      Note: the application must set the context.

      Type Parameters:
      T - the PDO type
      Parameters:
      className - the name of PDO-class, usually an interface
      session - the session
      Returns:
      the created PDO
    • create

      <T extends PersistentDomainObject<T>> T create(Class<T> clazz)
      Creates a PDO without any domain context or session.

      Note: the application must set the context.

      Type Parameters:
      T - the PDO type
      Parameters:
      clazz - the class of the PDO, usually an interface
      Returns:
      the created PDO
    • create

      <T extends PersistentDomainObject<T>> T create(String className)
      Creates a PDO without any domain context or session.

      Note: the application must set the context.

      Type Parameters:
      T - the PDO type
      Parameters:
      className - the name of PDO-class, usually an interface
      Returns:
      the created PDO
    • create

      <T extends PersistentDomainObject<T>> T create(T pdo)
      Creates a PDO.
      Type Parameters:
      T - the PDO type
      Parameters:
      pdo - the PDO
      Returns:
      the created PDO belonging to the same class as the given pdo and in same context.
    • create

      <T extends PersistentDomainObject<T>> T create(T pdo, String contextName)
      Creates a PDO within a sub context.
      If the current context is already within the given context name, the result is equivalent to create(PersistentDomainObject).
      Type Parameters:
      T - the PDO type
      Parameters:
      pdo - the PDO
      contextName - the context name
      Returns:
      the created PDO belonging to the same class as the given pdo in a sub context of given name
    • create

      <T extends PersistentDomainObject<T>> T create(Class<T> clazz, PersistentObject<T> persistenceDelegate)
      Creates a PDO for a given persistence delegate.
      Type Parameters:
      T - the PDO type
      Parameters:
      clazz - the class of the PDO, usually an interface
      persistenceDelegate - the persistence delegate
      Returns:
      the created PDO
    • create

      <T extends PersistentDomainObject<T>> T create(String className, PersistentObject<T> persistenceDelegate)
      Creates a PDO for a given persistence delegate.
      Type Parameters:
      T - the PDO type
      Parameters:
      className - the name of PDO-class, usually an interface
      persistenceDelegate - the persistence delegate
      Returns:
      the created PDO
    • create

      <T extends PersistentDomainObject<T>> T create(Class<T> clazz, DomainContext context, DomainObject<T> domainDelegate)
      Creates a PDO for a given domain delegate.
      Type Parameters:
      T - the PDO type
      Parameters:
      clazz - the class of the PDO, usually an interface
      context - the domain context
      domainDelegate - the domain delegate
      Returns:
      the created PDO
    • create

      <T extends PersistentDomainObject<T>> T create(String className, DomainContext context, DomainObject<T> domainDelegate)
      Creates a PDO for a given domain delegate.
      Type Parameters:
      T - the PDO type
      Parameters:
      className - the name of PDO-class, usually an interface
      context - the domain context
      domainDelegate - the domain delegate
      Returns:
      the created PDO
    • create

      <T extends PersistentDomainObject<T>> T create(Class<T> clazz, Session session, DomainObject<T> domainDelegate)
      Creates a PDO for a given domain delegate.
      Type Parameters:
      T - the PDO type
      Parameters:
      clazz - the class of the PDO, usually an interface
      session - the session
      domainDelegate - the domain delegate
      Returns:
      the created PDO
    • create

      <T extends PersistentDomainObject<T>> T create(String className, Session session, DomainObject<T> domainDelegate)
      Creates a PDO for a given domain delegate.
      Type Parameters:
      T - the PDO type
      Parameters:
      className - the name of PDO-class, usually an interface
      session - the session
      domainDelegate - the domain delegate
      Returns:
      the created PDO
    • create

      <T extends PersistentDomainObject<T>> T create(Class<T> clazz, PersistentObject<T> persistenceDelegate, DomainObject<T> domainDelegate)
      Creates a PDO for given delegates.
      Type Parameters:
      T - the PDO type
      Parameters:
      clazz - the class of the PDO, usually an interface
      persistenceDelegate - the persistence delegate
      domainDelegate - the domain delegate
      Returns:
      the created PDO
    • create

      <T extends PersistentDomainObject<T>> T create(String className, PersistentObject<T> persistenceDelegate, DomainObject<T> domainDelegate)
      Creates a PDO for given delegates.
      Type Parameters:
      T - the PDO type
      Parameters:
      className - the name of PDO-class, usually an interface
      persistenceDelegate - the persistence delegate
      domainDelegate - the domain delegate
      Returns:
      the created PDO
    • getPersistenceClass

      <T extends PersistentDomainObject<T>> Class<PersistentObject<T>> getPersistenceClass(String className)
      Gets the class implementing the persistence layer.
      Type Parameters:
      T - the PDO type
      Parameters:
      className - the name of PDO-class, usually an interface
      Returns:
      the persistence class
    • getDomainClass

      <T extends PersistentDomainObject<T>> Class<DomainObject<T>> getDomainClass(String className)
      Gets the class implementing the domain layer.
      Type Parameters:
      T - the PDO type
      Parameters:
      className - the name of PDO-class, usually an interface
      Returns:
      the domain class
    • createPersistenceDelegate

      <T extends PersistentDomainObject<T>> PersistentObject<T> createPersistenceDelegate(String className)
      Creates the delegate implementing the persistence layer.
      Type Parameters:
      T - the PDO type
      Parameters:
      className - the name of PDO-class, usually an interface
      Returns:
      the persistent delegate
    • createDomainDelegate

      <T extends PersistentDomainObject<T>> DomainObject<T> createDomainDelegate(String className)
      Creates the delegate implementing the domain layer.
      Type Parameters:
      T - the PDO type
      Parameters:
      className - the name of PDO-class, usually an interface
      Returns:
      the domain delegate