private static Marshaler<?> findMarshalerForObjectNode( ObjectNode objectNode, Collection<? extends Marshaler<?>> marshalers) throws MarshalingException { @Nullable Marshaler<?> nodeMarshaller = objectNode.getMarshaler(); assert objectNode instanceof RawObjectNode || nodeMarshaller != null; return nodeMarshaller == null ? findMarshaler(((RawObjectNode) objectNode).getObject(), marshalers) : nodeMarshaller; }
/** * Writes the given marshaling tree within the current marshal context. * * <p>Similar to {@link #acceptObject(Object)}, this method uses the current context to marshal * the object-node, using the {@link Marshaler} instance specified at construction. This means * that the {@link Marshaler} returned by {@link ObjectNode#getMarshaler()} will be ignored for * the given node (for child nodes, the marshaler property will not be ignored). * * @param tree tree represented by object-node * @throws MarshalingException if marshaling the given object fails (for instance, when a * user-defined {@link Marshaler#put(Object, MarshalContext)} implementation throws or causes * a {@link MarshalingException}) * @throws IOException if the operation failed because of an I/O error */ public void acceptTree(ObjectNode tree) throws IOException { @Nullable IOException exception = tree.accept(ObjectNodeVisitor.INSTANCE, this); if (exception != null) { throw exception; } }