@Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { if (isNotTraditionalGetter(method)) { log.warn("QueryResult interface method " + method.getName() + " doesn't appear to be a getter and therefore may not return the correct result."); } if (method.isAnnotationPresent(Property.class)) { Property annotation = method.getAnnotation(Property.class); return Utils.coerceTypes(method.getReturnType(), data.get(annotation.name())); } Matcher matcher = beanGetterPattern.matcher(method.getName()); if (matcher.matches()) { String propertyKey = matcher.group(2); propertyKey = propertyKey.substring(0, 1).toLowerCase().concat(propertyKey.substring(1)); return Utils.coerceTypes(method.getReturnType(), data.get(propertyKey)); } return Utils.coerceTypes(method.getReturnType(), data.get(method.getName())); }
@Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { if (isNotTraditionalGetter(method)) { log.warn("QueryResult interface method " + method.getName() + " doesn't appear to be a getter and therefore may not return the correct result."); } if (method.isAnnotationPresent(Property.class)) { Property annotation = method.getAnnotation(Property.class); return Utils.coerceTypes(method.getReturnType(), data.get(annotation.name())); } Matcher matcher = beanGetterPattern.matcher(method.getName()); if (matcher.matches()) { String propertyKey = matcher.group(2); propertyKey = propertyKey.substring(0, 1).toLowerCase().concat(propertyKey.substring(1)); return Utils.coerceTypes(method.getReturnType(), data.get(propertyKey)); } return Utils.coerceTypes(method.getReturnType(), data.get(method.getName())); }