Browse Source

Cleanups in ClassTypeInformation as well as BasicMappingContext.

Removed obsolete constructor arguments in ClassTypeInformation. SKip static fields in BasicMappingContext.addPersistentEntity(…).
pull/2/head
Oliver Gierke 15 years ago
parent
commit
561cdbe4dc
  1. 5
      spring-data-commons-core/src/main/java/org/springframework/data/mapping/BasicMappingContext.java
  2. 17
      spring-data-commons-core/src/main/java/org/springframework/data/util/ClassTypeInformation.java

5
spring-data-commons-core/src/main/java/org/springframework/data/mapping/BasicMappingContext.java

@ -21,6 +21,7 @@ import java.beans.IntrospectionException; @@ -21,6 +21,7 @@ import java.beans.IntrospectionException;
import java.beans.Introspector;
import java.beans.PropertyDescriptor;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
@ -161,6 +162,10 @@ public class BasicMappingContext implements MappingContext, InitializingBean, Ap @@ -161,6 +162,10 @@ public class BasicMappingContext implements MappingContext, InitializingBean, Ap
log.error(e.getMessage(), e);
}
}
}, new ReflectionUtils.FieldFilter() {
public boolean matches(Field field) {
return !Modifier.isStatic(field.getModifiers());
}
});
entity.setPreferredConstructor(builder.getPreferredConstructor(type));

17
spring-data-commons-core/src/main/java/org/springframework/data/util/ClassTypeInformation.java

@ -20,26 +20,15 @@ public class ClassTypeInformation extends TypeDiscoverer { @@ -20,26 +20,15 @@ public class ClassTypeInformation extends TypeDiscoverer {
* @param type
*/
public ClassTypeInformation(Class<?> type) {
this(type, GenericTypeResolver.getTypeVariableMap(type), null, null);
}
/**
* Creates {@link ClassTypeInformation} for the given type and the given basic types. Handing over a basic type will
* prevent it's nested fields to be traversed for further {@link TypeInformation}.
*
* @param type
* @param basicTypes
*/
public ClassTypeInformation(Class<?> type, Set<Class<?>> basicTypes) {
this(type, GenericTypeResolver.getTypeVariableMap(type), basicTypes, null);
this(type, GenericTypeResolver.getTypeVariableMap(type), null);
}
ClassTypeInformation(Class<?> type, TypeDiscoverer parent) {
this(type, null, null, parent);
this(type, null, parent);
}
@SuppressWarnings("rawtypes")
ClassTypeInformation(Class<?> type, Map<TypeVariable, Type> typeVariableMap, Set<Class<?>> basicTypes,
ClassTypeInformation(Class<?> type, Map<TypeVariable, Type> typeVariableMap,
TypeDiscoverer parent) {
super(type, typeVariableMap, parent);
this.type = type;

Loading…
Cancel
Save