(String attribute)
| 218 | } |
| 219 | |
| 220 | @Override |
| 221 | public @Nullable Object getAttribute(String attribute) { |
| 222 | try { |
| 223 | AttributeInfo attributeInfo = attributeMap.get(attribute); |
| 224 | if (attributeInfo == null || attributeInfo.getter == null) { |
| 225 | return null; |
| 226 | } |
| 227 | Object res = attributeInfo.getter.invoke(bean); |
| 228 | if (res instanceof Map<?, ?>) { |
| 229 | return ((Map<?, ?>) res) |
| 230 | .entrySet().stream() |
| 231 | .collect(Collectors.toMap(Map.Entry::getKey, e -> e.getValue().toString())); |
| 232 | } else if (res instanceof Number) { |
| 233 | return res; |
| 234 | } else { |
| 235 | return res.toString(); |
| 236 | } |
| 237 | } catch (IllegalAccessException | InvocationTargetException e) { |
| 238 | LOG.severe("Error during execution: " + e.getMessage()); |
| 239 | return null; |
| 240 | } |
| 241 | } |
| 242 | |
| 243 | @Override |
| 244 | public void setAttribute(Attribute attribute) { |
no test coverage detected