MCPcopy Index your code
hub / github.com/SeleniumHQ/selenium / mapObject

Method mapObject

java/src/org/openqa/selenium/json/JsonOutput.java:534–562  ·  view source on GitHub ↗

Convert the specified Java object via accessors that conform to the JavaBean specification. @param toConvert Java object to be converted @param maxDepth maximum depth of nested object traversal @param depthRemaining allowed traversal depth remaining @throws JsonException if allowed depth ha

(Object toConvert, int maxDepth, int depthRemaining)

Source from the content-addressed store, hash-verified

532 * @throws JsonException if allowed depth has been reached
533 */
534 private void mapObject(Object toConvert, int maxDepth, int depthRemaining) {
535 if (toConvert instanceof Class) {
536 write(((Class<?>) toConvert).getName());
537 return;
538 }
539
540 // Raw object via reflection? Nope, not needed
541 beginObject();
542 for (SimplePropertyDescriptor pd :
543 SimplePropertyDescriptor.getPropertyDescriptors(toConvert.getClass())) {
544
545 // Only include methods not on java.lang.Object to stop things being super-noisy
546 Function<Object, @Nullable Object> readMethod = pd.getReadMethod();
547 if (readMethod == null) {
548 continue;
549 }
550
551 if (!writeClassName && "class".equals(pd.getName())) {
552 continue;
553 }
554
555 Object value = readMethod.apply(toConvert);
556 if (!Optional.empty().equals(value)) {
557 name(pd.getName());
558 write0(value, maxDepth, depthRemaining - 1);
559 }
560 }
561 endObject();
562 }
563
564 /** Defines to common behavior of JSON containers (objects and arrays). */
565 private abstract class Node {

Callers 1

JsonOutputMethod · 0.95

Calls 12

writeMethod · 0.95
beginObjectMethod · 0.95
nameMethod · 0.95
write0Method · 0.95
endObjectMethod · 0.95
getReadMethodMethod · 0.80
getNameMethod · 0.65
getClassMethod · 0.65
equalsMethod · 0.45
applyMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected