Browse Source

Consistent PropertyAccessor method order as declared in the interface

Issue: SPR-11609
pull/500/head
Juergen Hoeller 12 years ago
parent
commit
b70148c12d
  1. 12
      spring-context/src/main/java/org/springframework/context/expression/BeanFactoryAccessor.java
  2. 12
      spring-context/src/main/java/org/springframework/context/expression/MapAccessor.java

12
spring-context/src/main/java/org/springframework/context/expression/BeanFactoryAccessor.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2012 the original author or authors. * Copyright 2002-2014 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -32,6 +32,11 @@ import org.springframework.expression.TypedValue;
*/ */
public class BeanFactoryAccessor implements PropertyAccessor { public class BeanFactoryAccessor implements PropertyAccessor {
@Override
public Class<?>[] getSpecificTargetClasses() {
return new Class<?>[] {BeanFactory.class};
}
@Override @Override
public boolean canRead(EvaluationContext context, Object target, String name) throws AccessException { public boolean canRead(EvaluationContext context, Object target, String name) throws AccessException {
return (((BeanFactory) target).containsBean(name)); return (((BeanFactory) target).containsBean(name));
@ -52,9 +57,4 @@ public class BeanFactoryAccessor implements PropertyAccessor {
throw new AccessException("Beans in a BeanFactory are read-only"); throw new AccessException("Beans in a BeanFactory are read-only");
} }
@Override
public Class<?>[] getSpecificTargetClasses() {
return new Class<?>[] {BeanFactory.class};
}
} }

12
spring-context/src/main/java/org/springframework/context/expression/MapAccessor.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2012 the original author or authors. * Copyright 2002-2014 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -33,6 +33,11 @@ import org.springframework.expression.TypedValue;
*/ */
public class MapAccessor implements PropertyAccessor { public class MapAccessor implements PropertyAccessor {
@Override
public Class<?>[] getSpecificTargetClasses() {
return new Class<?>[] {Map.class};
}
@Override @Override
public boolean canRead(EvaluationContext context, Object target, String name) throws AccessException { public boolean canRead(EvaluationContext context, Object target, String name) throws AccessException {
Map<?, ?> map = (Map<?, ?>) target; Map<?, ?> map = (Map<?, ?>) target;
@ -61,11 +66,6 @@ public class MapAccessor implements PropertyAccessor {
map.put(name, newValue); map.put(name, newValue);
} }
@Override
public Class<?>[] getSpecificTargetClasses() {
return new Class<?>[] {Map.class};
}
/** /**
* Exception thrown from {@code read} in order to reset a cached * Exception thrown from {@code read} in order to reset a cached

Loading…
Cancel
Save