SGF-749 - Rename setGemfireInstantiators(:EntityInstantiators) to setEntityInstantiators(:EntityInstantiators)

Rename setGemfireInstantiators(:Map<Class<?>>, EntityInstantior>) to setEntityInstantiators(:Map<Class<?>, EntityInstantior>).

Rename getGemfireInstantiators() to getEntityInstantiators().

Rename getCustomPdxSerializer(:PersistentProperty) to resolveCustomPdxSerializer(:PersistentProperty).

Rename getInstantiatorFor(:PersistentEntity) to resolveEntityInstantiator(:PersistentEntity).
This commit is contained in:
John Blum
2018-06-09 20:13:17 -07:00
parent 7ca0bc3a17
commit aa4b2a70af
2 changed files with 187 additions and 187 deletions

View File

@@ -309,26 +309,6 @@ public class MappingPdxSerializer implements PdxSerializer, ApplicationContextAw
return Collections.unmodifiableMap(this.customPdxSerializers);
}
/**
* Returns a custom PDX serializer for the given {@link PersistentProperty entity persistent property}.
*
* @param property {@link PersistentProperty} of the entity used to lookup the custom PDX serializer.
* @return a custom {@link PdxSerializer} for the given entity {@link PersistentProperty},
* or {@literal null} if no custom {@link PdxSerializer} could be found.
* @see org.apache.geode.pdx.PdxSerializer
*/
@Nullable
protected PdxSerializer getCustomPdxSerializer(@NonNull PersistentProperty<?> property) {
Map<?, PdxSerializer> customPdxSerializers = getCustomPdxSerializers();
return this.pdxSerializerResolvers.stream()
.map(it -> it.resolve(customPdxSerializers, property))
.filter(Objects::nonNull)
.findFirst()
.orElse(null);
}
/**
* Configures the {@link EntityInstantiator EntityInstantiators} used to create the instances
* read by this {@link PdxSerializer}.
@@ -337,7 +317,7 @@ public class MappingPdxSerializer implements PdxSerializer, ApplicationContextAw
* read by this {@link PdxSerializer}; must not be {@literal null}.
* @see org.springframework.data.convert.EntityInstantiator
*/
public void setGemfireInstantiators(@NonNull EntityInstantiators entityInstantiators) {
public void setEntityInstantiators(@NonNull EntityInstantiators entityInstantiators) {
Assert.notNull(entityInstantiators, "EntityInstantiators must not be null");
@@ -353,8 +333,8 @@ public class MappingPdxSerializer implements PdxSerializer, ApplicationContextAw
* @see org.springframework.data.convert.EntityInstantiator
* @see java.util.Map
*/
public void setGemfireInstantiators(@NonNull Map<Class<?>, EntityInstantiator> gemfireInstantiators) {
setGemfireInstantiators(new EntityInstantiators(gemfireInstantiators));
public void setEntityInstantiators(@NonNull Map<Class<?>, EntityInstantiator> gemfireInstantiators) {
setEntityInstantiators(new EntityInstantiators(gemfireInstantiators));
}
/**
@@ -363,23 +343,10 @@ public class MappingPdxSerializer implements PdxSerializer, ApplicationContextAw
* @return the configured {@link EntityInstantiators} handling instantiation for Pivotal GemFire persistent entities.
* @see org.springframework.data.convert.EntityInstantiators
*/
protected EntityInstantiators getGemfireInstantiators() {
protected EntityInstantiators getEntityInstantiators() {
return this.entityInstantiators;
}
/**
* Looks up and returns an EntityInstantiator to construct and initialize an instance of the object defined
* by the given PersistentEntity (meta-data).
*
* @param entity the PersistentEntity object used to lookup the custom EntityInstantiator.
* @return an EntityInstantiator for the given PersistentEntity.
* @see org.springframework.data.convert.EntityInstantiator
* @see org.springframework.data.mapping.PersistentEntity
*/
protected EntityInstantiator getInstantiatorFor(PersistentEntity entity) {
return getGemfireInstantiators().getInstantiatorFor(entity);
}
/**
* Returns a reference to the configured {@link Logger} used to log {@link String messages}
* about the functions of this {@link PdxSerializer}.
@@ -510,7 +477,7 @@ public class MappingPdxSerializer implements PdxSerializer, ApplicationContextAw
GemfirePersistentEntity<?> entity = getPersistentEntity(type);
Object instance = getInstantiatorFor(entity)
Object instance = resolveEntityInstantiator(entity)
.createInstance(entity, new PersistentEntityParameterValueProvider<>(entity,
new GemfirePropertyValueProvider(reader), null));
@@ -521,7 +488,7 @@ public class MappingPdxSerializer implements PdxSerializer, ApplicationContextAw
if (isWritable(entity, persistentProperty)) {
PdxSerializer customPdxSerializer = getCustomPdxSerializer(persistentProperty);
PdxSerializer customPdxSerializer = resolveCustomPdxSerializer(persistentProperty);
Object value = null;
@@ -606,7 +573,7 @@ public class MappingPdxSerializer implements PdxSerializer, ApplicationContextAw
if (isReadable(persistentProperty)) {
PdxSerializer customPdxSerializer = getCustomPdxSerializer(persistentProperty);
PdxSerializer customPdxSerializer = resolveCustomPdxSerializer(persistentProperty);
Object propertyValue = null;
@@ -666,6 +633,39 @@ public class MappingPdxSerializer implements PdxSerializer, ApplicationContextAw
return !persistentProperty.isTransient();
}
/**
* Returns a custom PDX serializer for the given {@link PersistentProperty entity persistent property}.
*
* @param property {@link PersistentProperty} of the entity used to lookup the custom PDX serializer.
* @return a custom {@link PdxSerializer} for the given entity {@link PersistentProperty},
* or {@literal null} if no custom {@link PdxSerializer} could be found.
* @see org.apache.geode.pdx.PdxSerializer
*/
@Nullable
protected PdxSerializer resolveCustomPdxSerializer(@NonNull PersistentProperty<?> property) {
Map<?, PdxSerializer> customPdxSerializers = getCustomPdxSerializers();
return this.pdxSerializerResolvers.stream()
.map(it -> it.resolve(customPdxSerializers, property))
.filter(Objects::nonNull)
.findFirst()
.orElse(null);
}
/**
* Looks up and returns an EntityInstantiator to construct and initialize an instance of the object defined
* by the given PersistentEntity (meta-data).
*
* @param entity the PersistentEntity object used to lookup the custom EntityInstantiator.
* @return an EntityInstantiator for the given PersistentEntity.
* @see org.springframework.data.convert.EntityInstantiator
* @see org.springframework.data.mapping.PersistentEntity
*/
protected EntityInstantiator resolveEntityInstantiator(PersistentEntity entity) {
return getEntityInstantiators().getInstantiatorFor(entity);
}
/**
* Resolves the {@link Class type} of the given {@link Object}.
*