Tweaks to BasicMappingContext to remove a circular reference
This commit is contained in:
@@ -41,12 +41,6 @@ public class BasicMappingConfigurationBuilder implements MappingConfigurationBui
|
||||
protected static ConcurrentMap<Class<?>, BeanInfo> beanInfo = new ConcurrentHashMap<Class<?>, BeanInfo>();
|
||||
protected Logger log = LoggerFactory.getLogger(getClass());
|
||||
|
||||
protected MappingContext mappingContext;
|
||||
|
||||
public BasicMappingConfigurationBuilder(MappingContext mappingContext) {
|
||||
this.mappingContext = mappingContext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> boolean isPersistentEntity(Class<T> type) {
|
||||
if (type.isAnnotationPresent(Persistent.class)) {
|
||||
@@ -68,7 +62,7 @@ public class BasicMappingConfigurationBuilder implements MappingConfigurationBui
|
||||
|
||||
@SuppressWarnings({"unchecked"})
|
||||
@Override
|
||||
public <T> PersistentEntity<T> createPersistentEntity(Class<T> type) throws MappingConfigurationException {
|
||||
public <T> PersistentEntity<T> createPersistentEntity(Class<T> type, MappingContext mappingContext) throws MappingConfigurationException {
|
||||
return new BasicPersistentEntity<T>(mappingContext, type);
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ public class BasicMappingContext implements MappingContext, InitializingBean {
|
||||
protected GenericConversionService conversionService = ConversionServiceFactory.createDefaultConversionService();
|
||||
|
||||
public BasicMappingContext() {
|
||||
builder = new BasicMappingConfigurationBuilder(this);
|
||||
builder = new BasicMappingConfigurationBuilder();
|
||||
}
|
||||
|
||||
public BasicMappingContext(MappingConfigurationBuilder builder) {
|
||||
@@ -83,7 +83,7 @@ public class BasicMappingContext implements MappingContext, InitializingBean {
|
||||
public <T> PersistentEntity<T> addPersistentEntity(Class<T> type) {
|
||||
if (null == persistentEntities.get(type.getName())) {
|
||||
try {
|
||||
PersistentEntity<T> entity = builder.createPersistentEntity(type);
|
||||
PersistentEntity<T> entity = builder.createPersistentEntity(type, this);
|
||||
BeanInfo info = Introspector.getBeanInfo(type);
|
||||
|
||||
Map<String, PropertyDescriptor> descriptors = new HashMap<String, PropertyDescriptor>();
|
||||
|
||||
@@ -26,7 +26,7 @@ public interface MappingConfigurationBuilder {
|
||||
|
||||
<T> boolean isPersistentEntity(Class<T> clazz);
|
||||
|
||||
<T> PersistentEntity<T> createPersistentEntity(Class<T> clazz) throws MappingConfigurationException;
|
||||
<T> PersistentEntity<T> createPersistentEntity(Class<T> clazz, MappingContext mappingContext) throws MappingConfigurationException;
|
||||
|
||||
boolean isPersistentProperty(Field field, PropertyDescriptor descriptor) throws MappingConfigurationException;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user