Class SpannerMappingContext

java.lang.Object
org.springframework.data.mapping.context.AbstractMappingContext<SpannerPersistentEntity<?>,SpannerPersistentProperty>
com.google.cloud.spring.data.spanner.core.mapping.SpannerMappingContext
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<SpannerPersistentEntity<?>,SpannerPersistentProperty>

public class SpannerMappingContext extends org.springframework.data.mapping.context.AbstractMappingContext<SpannerPersistentEntity<?>,SpannerPersistentProperty> implements org.springframework.context.ApplicationContextAware
A mapping context for Cloud Spanner that provides ways to create persistent entities and properties.
Since:
1.1
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    SpannerMappingContext(com.google.gson.Gson gson)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected <T> SpannerPersistentEntityImpl<T>
    constructPersistentEntity(org.springframework.data.util.TypeInformation<T> typeInformation)
     
    protected <T> SpannerPersistentEntity<T>
    createPersistentEntity(org.springframework.data.util.TypeInformation<T> typeInformation)
     
    createPersistentProperty(org.springframework.data.mapping.model.Property property, SpannerPersistentEntity<?> owner, org.springframework.data.mapping.model.SimpleTypeHolder simpleTypeHolder)
     
    org.springframework.data.mapping.model.FieldNamingStrategy
    Gets the field naming strategy used by this mapping context.
    com.google.gson.Gson
     
     
    void
    setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
     
    void
    setFieldNamingStrategy(org.springframework.data.mapping.model.FieldNamingStrategy fieldNamingStrategy)
    Set the field naming strategy used when creating persistent properties.

    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

    • SpannerMappingContext

      public SpannerMappingContext()
    • SpannerMappingContext

      public SpannerMappingContext(com.google.gson.Gson gson)
  • Method Details

    • getGson

      @NonNull public com.google.gson.Gson getGson()
    • setFieldNamingStrategy

      public void setFieldNamingStrategy(org.springframework.data.mapping.model.FieldNamingStrategy fieldNamingStrategy)
      Set the field naming strategy used when creating persistent properties.
      Parameters:
      fieldNamingStrategy - the field naming strategy passed used by created persistent properties get column names.
    • getFieldNamingStrategy

      public org.springframework.data.mapping.model.FieldNamingStrategy getFieldNamingStrategy()
      Gets the field naming strategy used by this mapping context.
      Returns:
      the field naming strategy.
    • createPersistentEntity

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

      protected <T> SpannerPersistentEntityImpl<T> constructPersistentEntity(org.springframework.data.util.TypeInformation<T> typeInformation)
    • createPersistentProperty

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

      public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException
      Specified by:
      setApplicationContext in interface org.springframework.context.ApplicationContextAware
      Overrides:
      setApplicationContext in class org.springframework.data.mapping.context.AbstractMappingContext<SpannerPersistentEntity<?>,SpannerPersistentProperty>
      Throws:
      org.springframework.beans.BeansException
    • getPersistentEntityOrFail

      public SpannerPersistentEntity<?> getPersistentEntityOrFail(Class<?> entityClass)