Navigate all the fields of the specified object. If a field is null, it does not get visited. @param objTypePair The object,type (fully genericized) being navigated
(ObjectTypePair objTypePair, Visitor visitor)
| 95 | * @param objTypePair The object,type (fully genericized) being navigated |
| 96 | */ |
| 97 | public void accept(ObjectTypePair objTypePair, Visitor visitor) { |
| 98 | if (exclusionStrategy.shouldSkipClass($Gson$Types.getRawType(objTypePair.type))) { |
| 99 | return; |
| 100 | } |
| 101 | boolean visitedWithCustomHandler = visitor.visitUsingCustomHandler(objTypePair); |
| 102 | if (!visitedWithCustomHandler) { |
| 103 | Object obj = objTypePair.getObject(); |
| 104 | Object objectToVisit = (obj == null) ? visitor.getTarget() : obj; |
| 105 | if (objectToVisit == null) { |
| 106 | return; |
| 107 | } |
| 108 | objTypePair.setObject(objectToVisit); |
| 109 | visitor.start(objTypePair); |
| 110 | try { |
| 111 | if ($Gson$Types.isArray(objTypePair.type)) { |
| 112 | visitor.visitArray(objectToVisit, objTypePair.type); |
| 113 | } else if (objTypePair.type == Object.class && isPrimitiveOrString(objectToVisit)) { |
| 114 | // TODO(Joel): this is only used for deserialization of "primitives" |
| 115 | // we should rethink this!!! |
| 116 | visitor.visitPrimitive(objectToVisit); |
| 117 | visitor.getTarget(); |
| 118 | } else { |
| 119 | visitor.startVisitingObject(objectToVisit); |
| 120 | reflectingFieldNavigator.visitFieldsReflectively(objTypePair, visitor); |
| 121 | } |
| 122 | } finally { |
| 123 | visitor.end(objTypePair); |
| 124 | } |
| 125 | } |
| 126 | } |
| 127 | |
| 128 | private static boolean isPrimitiveOrString(Object objectToVisit) { |
| 129 | Class<?> realClazz = objectToVisit.getClass(); |
no test coverage detected