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.BeanFactoryAware, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationContextAware, org.springframework.context.ApplicationEventPublisherAware, org.springframework.context.EnvironmentAware, 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 Details

    • DatastoreMappingContext

      public DatastoreMappingContext()
    • DatastoreMappingContext

      public DatastoreMappingContext(boolean skipNullValue)
  • 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.
    • isSkipNullValue

      public boolean isSkipNullValue()