1
1
/*
2
- * Copyright 2002-2012 the original author or authors.
2
+ * Copyright 2002-2013 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -103,15 +103,14 @@ public boolean removeConstructorResolver(ConstructorResolver resolver) {
103
103
return this .constructorResolvers .remove (resolver );
104
104
}
105
105
106
- public List <ConstructorResolver > getConstructorResolvers () {
107
- ensureConstructorResolversInitialized ();
108
- return this .constructorResolvers ;
109
- }
110
-
111
106
public void setConstructorResolvers (List <ConstructorResolver > constructorResolvers ) {
112
107
this .constructorResolvers = constructorResolvers ;
113
108
}
114
109
110
+ public List <ConstructorResolver > getConstructorResolvers () {
111
+ ensureConstructorResolversInitialized ();
112
+ return this .constructorResolvers ;
113
+ }
115
114
116
115
public void addMethodResolver (MethodResolver resolver ) {
117
116
ensureMethodResolversInitialized ();
@@ -123,6 +122,10 @@ public boolean removeMethodResolver(MethodResolver methodResolver) {
123
122
return this .methodResolvers .remove (methodResolver );
124
123
}
125
124
125
+ public void setMethodResolvers (List <MethodResolver > methodResolvers ) {
126
+ this .methodResolvers = methodResolvers ;
127
+ }
128
+
126
129
public List <MethodResolver > getMethodResolvers () {
127
130
ensureMethodResolversInitialized ();
128
131
return this .methodResolvers ;
@@ -136,11 +139,6 @@ public BeanResolver getBeanResolver() {
136
139
return this .beanResolver ;
137
140
}
138
141
139
- public void setMethodResolvers (List <MethodResolver > methodResolvers ) {
140
- this .methodResolvers = methodResolvers ;
141
- }
142
-
143
-
144
142
public void addPropertyAccessor (PropertyAccessor accessor ) {
145
143
ensurePropertyAccessorsInitialized ();
146
144
this .propertyAccessors .add (this .propertyAccessors .size () - 1 , accessor );
@@ -150,15 +148,14 @@ public boolean removePropertyAccessor(PropertyAccessor accessor) {
150
148
return this .propertyAccessors .remove (accessor );
151
149
}
152
150
153
- public List <PropertyAccessor > getPropertyAccessors () {
154
- ensurePropertyAccessorsInitialized ();
155
- return this .propertyAccessors ;
156
- }
157
-
158
151
public void setPropertyAccessors (List <PropertyAccessor > propertyAccessors ) {
159
152
this .propertyAccessors = propertyAccessors ;
160
153
}
161
154
155
+ public List <PropertyAccessor > getPropertyAccessors () {
156
+ ensurePropertyAccessorsInitialized ();
157
+ return this .propertyAccessors ;
158
+ }
162
159
163
160
public void setTypeLocator (TypeLocator typeLocator ) {
164
161
Assert .notNull (typeLocator , "TypeLocator must not be null" );
@@ -221,19 +218,18 @@ public Object lookupVariable(String name) {
221
218
/**
222
219
* Register a {@code MethodFilter} which will be called during method resolution
223
220
* for the specified type.
224
- *
225
221
* <p>The {@code MethodFilter} may remove methods and/or sort the methods which
226
222
* will then be used by SpEL as the candidates to look through for a match.
227
- *
228
223
* @param type the type for which the filter should be called
229
224
* @param filter a {@code MethodFilter}, or {@code null} to unregister a filter for the type
230
225
* @throws IllegalStateException if the {@link ReflectiveMethodResolver} is not in use
231
226
*/
232
227
public void registerMethodFilter (Class <?> type , MethodFilter filter ) throws IllegalStateException {
233
228
ensureMethodResolversInitialized ();
234
- if (reflectiveMethodResolver != null ) {
235
- reflectiveMethodResolver .registerMethodFilter (type , filter );
236
- } else {
229
+ if (this .reflectiveMethodResolver != null ) {
230
+ this .reflectiveMethodResolver .registerMethodFilter (type , filter );
231
+ }
232
+ else {
237
233
throw new IllegalStateException ("Method filter cannot be set as the reflective method resolver is not in use" );
238
234
}
239
235
}
@@ -261,7 +257,8 @@ private void ensureMethodResolversInitialized() {
261
257
private synchronized void initializeMethodResolvers () {
262
258
if (this .methodResolvers == null ) {
263
259
List <MethodResolver > defaultResolvers = new ArrayList <MethodResolver >();
264
- defaultResolvers .add (reflectiveMethodResolver = new ReflectiveMethodResolver ());
260
+ this .reflectiveMethodResolver = new ReflectiveMethodResolver ();
261
+ defaultResolvers .add (this .reflectiveMethodResolver );
265
262
this .methodResolvers = defaultResolvers ;
266
263
}
267
264
}
0 commit comments