@@ -112,34 +112,38 @@ private static Map<String, Data> calculateData(Class<?> beanType) {
112
112
if (toReturn == null ) {
113
113
Map <String , Data > getters = new HashMap <String , Data >();
114
114
List <Method > setters = new ArrayList <Method >();
115
- for (Method method : beanType .getMethods ()) {
116
- if (BeanMethod .GET .matches (method )) {
117
- // match methods on their name for now, to find the most specific
118
- // override
119
- String name = method .getName ();
120
-
121
- Type genericReturnType = TypeUtils .resolveGenerics (beanType , method .getGenericReturnType ());
122
- Class <?> returnType = TypeUtils .ensureBaseType (genericReturnType );
123
-
124
- Data data = getters .get (name );
125
- if (data == null || data .type .isAssignableFrom (returnType )) {
126
- // no getter seen yet for the property, or a less specific one
127
- PropertyType propertyType ;
128
- if (TypeUtils .isValueType (returnType )) {
129
- propertyType = PropertyType .VALUE ;
130
- } else if (Collection .class .isAssignableFrom (returnType )) {
131
- propertyType = PropertyType .COLLECTION ;
132
- } else if (Map .class .isAssignableFrom (returnType )) {
133
- propertyType = PropertyType .MAP ;
134
- } else {
135
- propertyType = PropertyType .REFERENCE ;
115
+ if (!(Collection .class .isAssignableFrom (beanType )
116
+ || Map .class .isAssignableFrom (beanType ))) {
117
+ for (Method method : beanType .getMethods ()) {
118
+ if (BeanMethod .GET .matches (method )) {
119
+ // match methods on their name for now, to find the most specific
120
+ // override
121
+ String name = method .getName ();
122
+
123
+ Type genericReturnType = TypeUtils .resolveGenerics (beanType ,
124
+ method .getGenericReturnType ());
125
+ Class <?> returnType = TypeUtils .ensureBaseType (genericReturnType );
126
+
127
+ Data data = getters .get (name );
128
+ if (data == null || data .type .isAssignableFrom (returnType )) {
129
+ // no getter seen yet for the property, or a less specific one
130
+ PropertyType propertyType ;
131
+ if (TypeUtils .isValueType (returnType )) {
132
+ propertyType = PropertyType .VALUE ;
133
+ } else if (Collection .class .isAssignableFrom (returnType )) {
134
+ propertyType = PropertyType .COLLECTION ;
135
+ } else if (Map .class .isAssignableFrom (returnType )) {
136
+ propertyType = PropertyType .MAP ;
137
+ } else {
138
+ propertyType = PropertyType .REFERENCE ;
139
+ }
140
+ data = new Data (method , genericReturnType , returnType , propertyType );
141
+
142
+ getters .put (name , data );
136
143
}
137
- data = new Data (method , genericReturnType , returnType , propertyType );
138
-
139
- getters .put (name , data );
144
+ } else if (BeanMethod .SET .matches (method ) || BeanMethod .SET_BUILDER .matches (method )) {
145
+ setters .add (method );
140
146
}
141
- } else if (BeanMethod .SET .matches (method ) || BeanMethod .SET_BUILDER .matches (method )) {
142
- setters .add (method );
143
147
}
144
148
}
145
149
0 commit comments