Class EntityInstantiators
java.lang.Object
org.springframework.data.mapping.model.EntityInstantiators
Simple value object allowing access to
EntityInstantiator instances for a given type falling back to a
default one.- Since:
- 2.3
- Author:
- Oliver Drotbohm, Thomas Darimont, Christoph Strobl, Mark Paluch
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a newEntityInstantiatorsusing the default fallback instantiator and no custom ones.EntityInstantiators(Map<Class<?>, EntityInstantiator> customInstantiators) Creates a newEntityInstantiatorsusing the default fallback instantiator and the given custom ones.EntityInstantiators(EntityInstantiator fallback) Creates a newEntityInstantiatorsusing the givenEntityInstantiatoras fallback.EntityInstantiators(EntityInstantiator defaultInstantiator, Map<Class<?>, EntityInstantiator> customInstantiators) Creates a newEntityInstantiatorusing the given fallbackEntityInstantiatorand the given custom ones. -
Method Summary
Modifier and TypeMethodDescriptiongetInstantiatorFor(PersistentEntity<?, ?> entity) Returns theEntityInstantiatorto be used to create the givenPersistentEntity.
-
Constructor Details
-
EntityInstantiators
public EntityInstantiators()Creates a newEntityInstantiatorsusing the default fallback instantiator and no custom ones. -
EntityInstantiators
Creates a newEntityInstantiatorsusing the givenEntityInstantiatoras fallback.- Parameters:
fallback- must not be null.
-
EntityInstantiators
Creates a newEntityInstantiatorsusing the default fallback instantiator and the given custom ones.- Parameters:
customInstantiators- must not be null.
-
EntityInstantiators
public EntityInstantiators(EntityInstantiator defaultInstantiator, Map<Class<?>, EntityInstantiator> customInstantiators) Creates a newEntityInstantiatorusing the given fallbackEntityInstantiatorand the given custom ones.- Parameters:
defaultInstantiator- must not be null.customInstantiators- must not be null.
-
-
Method Details
-
getInstantiatorFor
Returns theEntityInstantiatorto be used to create the givenPersistentEntity.- Parameters:
entity- must not be null.- Returns:
- will never be null.
-