fixed generic registerCustomEditor signature
This commit is contained in:
parent
20fc42add0
commit
5649f2f31d
|
|
@ -154,7 +154,7 @@ public interface ConfigurableBeanFactory extends HierarchicalBeanFactory, Single
|
||||||
* @param requiredType type of the property
|
* @param requiredType type of the property
|
||||||
* @param propertyEditorClass the {@link PropertyEditor} class to register
|
* @param propertyEditorClass the {@link PropertyEditor} class to register
|
||||||
*/
|
*/
|
||||||
void registerCustomEditor(Class requiredType, Class<PropertyEditor> propertyEditorClass);
|
void registerCustomEditor(Class requiredType, Class<? extends PropertyEditor> propertyEditorClass);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the given PropertyEditorRegistry with the custom editors
|
* Initialize the given PropertyEditorRegistry with the custom editors
|
||||||
|
|
|
||||||
|
|
@ -122,8 +122,8 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
|
||||||
private TypeConverter typeConverter;
|
private TypeConverter typeConverter;
|
||||||
|
|
||||||
/** Custom PropertyEditors to apply to the beans of this factory */
|
/** Custom PropertyEditors to apply to the beans of this factory */
|
||||||
private final Map<Class, Class<PropertyEditor>> customEditors =
|
private final Map<Class, Class<? extends PropertyEditor>> customEditors =
|
||||||
new HashMap<Class, Class<PropertyEditor>>(4);
|
new HashMap<Class, Class<? extends PropertyEditor>>(4);
|
||||||
|
|
||||||
/** String resolvers to apply e.g. to annotation attribute values */
|
/** String resolvers to apply e.g. to annotation attribute values */
|
||||||
private final List<StringValueResolver> embeddedValueResolvers = new LinkedList<StringValueResolver>();
|
private final List<StringValueResolver> embeddedValueResolvers = new LinkedList<StringValueResolver>();
|
||||||
|
|
@ -213,7 +213,7 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
|
||||||
throws BeansException {
|
throws BeansException {
|
||||||
|
|
||||||
final String beanName = transformedBeanName(name);
|
final String beanName = transformedBeanName(name);
|
||||||
Object bean = null;
|
Object bean;
|
||||||
|
|
||||||
// Eagerly check singleton cache for manually registered singletons.
|
// Eagerly check singleton cache for manually registered singletons.
|
||||||
Object sharedInstance = getSingleton(beanName);
|
Object sharedInstance = getSingleton(beanName);
|
||||||
|
|
@ -613,7 +613,7 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
|
||||||
return this.propertyEditorRegistrars;
|
return this.propertyEditorRegistrars;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerCustomEditor(Class requiredType, Class<PropertyEditor> propertyEditorClass) {
|
public void registerCustomEditor(Class requiredType, Class<? extends PropertyEditor> propertyEditorClass) {
|
||||||
Assert.notNull(requiredType, "Required type must not be null");
|
Assert.notNull(requiredType, "Required type must not be null");
|
||||||
Assert.isAssignable(PropertyEditor.class, propertyEditorClass);
|
Assert.isAssignable(PropertyEditor.class, propertyEditorClass);
|
||||||
this.customEditors.put(requiredType, propertyEditorClass);
|
this.customEditors.put(requiredType, propertyEditorClass);
|
||||||
|
|
@ -626,7 +626,7 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
|
||||||
/**
|
/**
|
||||||
* Return the map of custom editors, with Classes as keys and PropertyEditor classes as values.
|
* Return the map of custom editors, with Classes as keys and PropertyEditor classes as values.
|
||||||
*/
|
*/
|
||||||
public Map<Class, Class<PropertyEditor>> getCustomEditors() {
|
public Map<Class, Class<? extends PropertyEditor>> getCustomEditors() {
|
||||||
return this.customEditors;
|
return this.customEditors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -795,6 +795,7 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
|
||||||
* @param beanName the name of the prototype about to be created
|
* @param beanName the name of the prototype about to be created
|
||||||
* @see #isPrototypeCurrentlyInCreation
|
* @see #isPrototypeCurrentlyInCreation
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
protected void beforePrototypeCreation(String beanName) {
|
protected void beforePrototypeCreation(String beanName) {
|
||||||
Object curVal = this.prototypesCurrentlyInCreation.get();
|
Object curVal = this.prototypesCurrentlyInCreation.get();
|
||||||
if (curVal == null) {
|
if (curVal == null) {
|
||||||
|
|
@ -818,6 +819,7 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
|
||||||
* @param beanName the name of the prototype that has been created
|
* @param beanName the name of the prototype that has been created
|
||||||
* @see #isPrototypeCurrentlyInCreation
|
* @see #isPrototypeCurrentlyInCreation
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
protected void afterPrototypeCreation(String beanName) {
|
protected void afterPrototypeCreation(String beanName) {
|
||||||
Object curVal = this.prototypesCurrentlyInCreation.get();
|
Object curVal = this.prototypesCurrentlyInCreation.get();
|
||||||
if (curVal instanceof String) {
|
if (curVal instanceof String) {
|
||||||
|
|
@ -957,7 +959,7 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!this.customEditors.isEmpty()) {
|
if (!this.customEditors.isEmpty()) {
|
||||||
for (Map.Entry<Class, Class<PropertyEditor>> entry : this.customEditors.entrySet()) {
|
for (Map.Entry<Class, Class<? extends PropertyEditor>> entry : this.customEditors.entrySet()) {
|
||||||
Class requiredType = entry.getKey();
|
Class requiredType = entry.getKey();
|
||||||
Class editorClass = entry.getValue();
|
Class editorClass = entry.getValue();
|
||||||
registry.registerCustomEditor(requiredType,
|
registry.registerCustomEditor(requiredType,
|
||||||
|
|
@ -1027,7 +1029,7 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Child bean definition: needs to be merged with parent.
|
// Child bean definition: needs to be merged with parent.
|
||||||
BeanDefinition pbd = null;
|
BeanDefinition pbd;
|
||||||
try {
|
try {
|
||||||
String parentBeanName = transformedBeanName(bd.getParentName());
|
String parentBeanName = transformedBeanName(bd.getParentName());
|
||||||
if (!beanName.equals(parentBeanName)) {
|
if (!beanName.equals(parentBeanName)) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue