|
Spring Data Commons | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.springframework.data.mapping.context.AbstractMappingContext<E,P>
public abstract class AbstractMappingContext<E extends MutablePersistentEntity<?,P>,P extends PersistentProperty<P>>
Base class to build mapping metadata and thus create instances of PersistentEntity and
PersistentProperty.
The implementation uses a ReentrantReadWriteLock to make sure PersistentEntity are completely
populated before accessing them from outside.
| Constructor Summary | |
|---|---|
AbstractMappingContext()
|
|
| Method Summary | ||
|---|---|---|
protected E |
addPersistentEntity(Class<?> type)
Adds the given type to the MappingContext. |
|
protected E |
addPersistentEntity(TypeInformation<?> typeInformation)
Adds the given TypeInformation to the MappingContext. |
|
void |
afterPropertiesSet()
Deprecated. |
|
protected abstract
|
createPersistentEntity(TypeInformation<T> typeInformation)
Creates the concrete PersistentEntity instance. |
|
protected abstract P |
createPersistentProperty(Field field,
PropertyDescriptor descriptor,
E owner,
SimpleTypeHolder simpleTypeHolder)
Creates the concrete instance of PersistentProperty. |
|
List<Validator> |
getEntityValidators(E entity)
Obtains a validator for the given entity TODO: Why do we need validators at the MappingContext? |
|
Collection<E> |
getPersistentEntities()
Returns all PersistentEntitys held in the context. |
|
E |
getPersistentEntity(Class<?> type)
Returns a PersistentEntity for the given Class. |
|
E |
getPersistentEntity(P persistentProperty)
Returns the PersistentEntity mapped by the given PersistentProperty. |
|
E |
getPersistentEntity(TypeInformation<?> type)
Returns a PersistentEntity for the given TypeInformation. |
|
PersistentPropertyPath<P> |
getPersistentPropertyPath(PropertyPath propertyPath)
Returns all PersistentPropertys for the given path expression based on the given PropertyPath. |
|
void |
initialize()
Initializes the mapping context. |
|
void |
onApplicationEvent(ContextRefreshedEvent event)
|
|
void |
setApplicationContext(ApplicationContext applicationContext)
|
|
void |
setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher)
Deprecated. |
|
void |
setInitialEntitySet(Set<? extends Class<?>> initialEntitySet)
Sets the Set of types to populate the context initially. |
|
void |
setSimpleTypeHolder(SimpleTypeHolder simpleTypes)
Configures the SimpleTypeHolder to be used by the MappingContext. |
|
void |
setStrict(boolean strict)
Configures whether the MappingContext is in strict mode which means, that it will throw
MappingExceptions in case one tries to lookup a PersistentEntity not already in the context. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AbstractMappingContext()
| Method Detail |
|---|
@Deprecated public void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher)
setApplicationContext(ApplicationContext) instead.
setApplicationEventPublisher in interface ApplicationEventPublisherAwaresetApplicationContext(ApplicationContext),
ApplicationEventPublisherAware.setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher)
public void setApplicationContext(ApplicationContext applicationContext)
throws BeansException
setApplicationContext in interface ApplicationContextAwareBeansExceptionpublic void setInitialEntitySet(Set<? extends Class<?>> initialEntitySet)
Set of types to populate the context initially.
initialEntitySet - public void setStrict(boolean strict)
MappingContext is in strict mode which means, that it will throw
MappingExceptions in case one tries to lookup a PersistentEntity not already in the context. This
defaults to false so that unknown types will be transparently added to the MappingContext if not known
in advance.
strict - public void setSimpleTypeHolder(SimpleTypeHolder simpleTypes)
SimpleTypeHolder to be used by the MappingContext. Allows customization of what
types will be regarded as simple types and thus not recursively analysed. Setting this to null will
reset the context to use the default SimpleTypeHolder.
simpleTypes - public Collection<E> getPersistentEntities()
MappingContextPersistentEntitys held in the context.
getPersistentEntities in interface MappingContext<E extends MutablePersistentEntity<?,P>,P extends PersistentProperty<P>>public E getPersistentEntity(Class<?> type)
MappingContextPersistentEntity for the given Class.
getPersistentEntity in interface MappingContext<E extends MutablePersistentEntity<?,P>,P extends PersistentProperty<P>>public E getPersistentEntity(TypeInformation<?> type)
MappingContextPersistentEntity for the given TypeInformation.
getPersistentEntity in interface MappingContext<E extends MutablePersistentEntity<?,P>,P extends PersistentProperty<P>>public E getPersistentEntity(P persistentProperty)
MappingContextPersistentEntity mapped by the given PersistentProperty.
getPersistentEntity in interface MappingContext<E extends MutablePersistentEntity<?,P>,P extends PersistentProperty<P>>PersistentEntity mapped by the given PersistentProperty or null if no
PersistentEntity exists for it or the PersistentProperty does not refer to an entity.public PersistentPropertyPath<P> getPersistentPropertyPath(PropertyPath propertyPath)
MappingContextPersistentPropertys for the given path expression based on the given PropertyPath.
getPersistentPropertyPath in interface MappingContext<E extends MutablePersistentEntity<?,P>,P extends PersistentProperty<P>>public List<Validator> getEntityValidators(E entity)
MappingContextMappingContext?
getEntityValidators in interface MappingContext<E extends MutablePersistentEntity<?,P>,P extends PersistentProperty<P>>entity - The entity
protected E addPersistentEntity(Class<?> type)
MappingContext.
type -
protected E addPersistentEntity(TypeInformation<?> typeInformation)
TypeInformation to the MappingContext.
typeInformation -
protected abstract <T> E createPersistentEntity(TypeInformation<T> typeInformation)
PersistentEntity instance.
T - typeInformation -
protected abstract P createPersistentProperty(Field field,
PropertyDescriptor descriptor,
E owner,
SimpleTypeHolder simpleTypeHolder)
PersistentProperty.
field - descriptor - owner - simpleTypeHolder -
@Deprecated public void afterPropertiesSet()
ContextRefreshedEvent. If implementations still need
the InitializingBean hook implement the interface yourself. Assume not entities being added at invocation
time yet.
afterPropertiesSet in interface InitializingBeanonApplicationEvent(ContextRefreshedEvent),
InitializingBean.afterPropertiesSet()public void onApplicationEvent(ContextRefreshedEvent event)
onApplicationEvent in interface ApplicationListener<ContextRefreshedEvent>public void initialize()
setInitialEntitySet(Set) to the
context.
|
Spring Data Commons | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||