Class DatastoreMappingContext

java.lang.Object
org.springframework.data.mapping.context.AbstractMappingContext<DatastorePersistentEntity<?>,DatastorePersistentProperty>
com.google.cloud.spring.data.datastore.core.mapping.DatastoreMappingContext
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationContextAware, org.springframework.context.ApplicationEventPublisherAware, org.springframework.data.mapping.context.MappingContext<DatastorePersistentEntity<?>,DatastorePersistentProperty>

public class DatastoreMappingContext extends org.springframework.data.mapping.context.AbstractMappingContext<DatastorePersistentEntity<?>,DatastorePersistentProperty> implements org.springframework.context.ApplicationContextAware
A mapping context for Datastore that provides ways to create persistent entities and properties.
Since:
1.1
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    Registers in the DatastoreMappingContext that two classes are discriminated from the same Datastore Kind.
    constructPersistentEntity(org.springframework.data.util.TypeInformation<T> typeInformation)
     
    protected <T> DatastorePersistentEntity<?>
    createPersistentEntity(org.springframework.data.util.TypeInformation<T> typeInformation)
     
    createPersistentProperty(org.springframework.data.mapping.model.Property property, DatastorePersistentEntity<?> owner, org.springframework.data.mapping.model.SimpleTypeHolder simpleTypeHolder)
     
    A non-null version of the MappingContext.getPersistentEntity(Class).
    static Set<Class>
    Get the set of other classes that share the same underlying Datastore Kind and that are subclasses of the given class.
    void
    setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
     

    Methods inherited from class org.springframework.data.mapping.context.AbstractMappingContext

    addPersistentEntity, addPersistentEntity, afterPropertiesSet, doFindPersistentPropertyPaths, findPersistentPropertyPaths, getManagedTypes, getPersistentEntities, getPersistentEntity, getPersistentEntity, getPersistentEntity, getPersistentPropertyPath, getPersistentPropertyPath, getPersistentPropertyPath, hasPersistentEntityFor, initialize, setApplicationEventPublisher, setInitialEntitySet, setManagedTypes, setSimpleTypeHolder, setStrict, shouldCreatePersistentEntityFor

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.springframework.data.mapping.context.MappingContext

    getRequiredPersistentEntity, getRequiredPersistentEntity, getRequiredPersistentEntity
  • Constructor Details

    • DatastoreMappingContext

      public DatastoreMappingContext()
  • Method Details

    • setApplicationContext

      public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
      Specified by:
      setApplicationContext in interface org.springframework.context.ApplicationContextAware
      Overrides:
      setApplicationContext in class org.springframework.data.mapping.context.AbstractMappingContext<DatastorePersistentEntity<?>,DatastorePersistentProperty>
    • addDiscriminationClassConnection

      public static void addDiscriminationClassConnection(Class parentClass, Class subClass)
      Registers in the DatastoreMappingContext that two classes are discriminated from the same Datastore Kind.
      Parameters:
      parentClass - the superclass.
      subClass - the subclass.
    • getDiscriminationFamily

      public static Set<Class> getDiscriminationFamily(Class clazz)
      Get the set of other classes that share the same underlying Datastore Kind and that are subclasses of the given class.
      Parameters:
      clazz - the class to look up.
      Returns:
      a Set of other classes that share the same Kind that are subclasses. Will be null if this class is not discriminated from a set of other classes.
    • constructPersistentEntity

      protected <T> DatastorePersistentEntityImpl<T> constructPersistentEntity(org.springframework.data.util.TypeInformation<T> typeInformation)
    • createPersistentEntity

      protected <T> DatastorePersistentEntity<?> createPersistentEntity(org.springframework.data.util.TypeInformation<T> typeInformation)
      Specified by:
      createPersistentEntity in class org.springframework.data.mapping.context.AbstractMappingContext<DatastorePersistentEntity<?>,DatastorePersistentProperty>
    • createPersistentProperty

      protected DatastorePersistentProperty createPersistentProperty(org.springframework.data.mapping.model.Property property, DatastorePersistentEntity<?> owner, org.springframework.data.mapping.model.SimpleTypeHolder simpleTypeHolder)
      Specified by:
      createPersistentProperty in class org.springframework.data.mapping.context.AbstractMappingContext<DatastorePersistentEntity<?>,DatastorePersistentProperty>
    • getDatastorePersistentEntity

      @NonNull public DatastorePersistentEntity<?> getDatastorePersistentEntity(Class<?> entityClass)
      A non-null version of the MappingContext.getPersistentEntity(Class).
      Parameters:
      entityClass - the entity type.
      Returns:
      the DatastorePersistentEntity for the provided type.
      Throws:
      DatastoreDataException - if unable to retrieve a DatastorePersistentEntity for the provided type.