MCPcopy
hub / github.com/SeleniumHQ/selenium / getAttribute

Method getAttribute

java/src/org/openqa/selenium/grid/jmx/MBean.java:220–241  ·  view source on GitHub ↗
(String attribute)

Source from the content-addressed store, hash-verified

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) {

Callers 1

getAttributesMethod · 0.95

Calls 9

entrySetMethod · 0.80
severeMethod · 0.80
getMethod · 0.65
toMapMethod · 0.65
toStringMethod · 0.65
invokeMethod · 0.45
streamMethod · 0.45
getValueMethod · 0.45
getMessageMethod · 0.45

Tested by

no test coverage detected