Lines 265-271
Link Here
|
265 |
Resource annotation = field.getAnnotation(Resource.class); |
265 |
Resource annotation = field.getAnnotation(Resource.class); |
266 |
String defaultName = |
266 |
String defaultName = |
267 |
classClass.getName() + SEPARATOR + field.getName(); |
267 |
classClass.getName() + SEPARATOR + field.getName(); |
268 |
String defaultType = field.getType().getCanonicalName(); |
268 |
Class<?> defaultType = field.getType(); |
269 |
addResource(context, annotation, defaultName, defaultType); |
269 |
addResource(context, annotation, defaultName, defaultType); |
270 |
} |
270 |
} |
271 |
} |
271 |
} |
Lines 290-297
Link Here
|
290 |
String defaultName = classClass.getName() + SEPARATOR + |
290 |
String defaultName = classClass.getName() + SEPARATOR + |
291 |
Introspection.getPropertyName(method); |
291 |
Introspection.getPropertyName(method); |
292 |
|
292 |
|
293 |
String defaultType = |
293 |
Class<?> defaultType = |
294 |
(method.getParameterTypes()[0]).getCanonicalName(); |
294 |
(method.getParameterTypes()[0]); |
295 |
addResource(context, annotation, defaultName, defaultType); |
295 |
addResource(context, annotation, defaultName, defaultType); |
296 |
} |
296 |
} |
297 |
} |
297 |
} |
Lines 309-315
Link Here
|
309 |
} |
309 |
} |
310 |
|
310 |
|
311 |
protected static void addResource(Context context, Resource annotation, |
311 |
protected static void addResource(Context context, Resource annotation, |
312 |
String defaultName, String defaultType) { |
312 |
String defaultName, Class<?> defaultType) { |
313 |
String name = getName(annotation, defaultName); |
313 |
String name = getName(annotation, defaultName); |
314 |
String type = getType(annotation, defaultType); |
314 |
String type = getType(annotation, defaultType); |
315 |
|
315 |
|
Lines 412-425
Link Here
|
412 |
} |
412 |
} |
413 |
|
413 |
|
414 |
|
414 |
|
415 |
private static String getType(Resource annotation, String defaultType) { |
415 |
private static String getType(Resource annotation, Class<?> defaultType) { |
416 |
String type = annotation.type().getCanonicalName(); |
416 |
Class<?> type = annotation.type(); |
417 |
if (type == null || type.equals("java.lang.Object")) { |
417 |
if (type == null || type.equals(Object.class)) { |
418 |
if (defaultType != null) { |
418 |
if (defaultType != null) { |
419 |
type = defaultType; |
419 |
type = defaultType; |
420 |
} |
420 |
} |
421 |
} |
421 |
} |
422 |
return type; |
422 |
return Introspection.convertPrimitiveType(type).getCanonicalName(); |
423 |
} |
423 |
} |
424 |
|
424 |
|
425 |
|
425 |
|