Class PojoWalker
java.lang.Object
org.apache.juneau.marshall.stream.PojoWalker
Format-neutral POJO walker that re-emits an arbitrary object graph through a
TokenWriter.
Used by TokenWriter.object(Object) on every format that supports the cursor-level POJO
bridge: the walker introspects the value (null / scalar / array / collection / map / bean) and
recursively emits startObject / fieldName
/ string / number /
bool / nil / binary
events on the calling writer. No raw bytes are written by the walker; per-format encoding is
the TokenWriter's job.
Notes:
- Object swaps and
@Schemaannotations are applied during the walk viaMarshallingContext.toBeanMap(Object)(e.g.java.timetypes are emitted as ISO-8601 strings). This is the explicit carve-out from the cursor's "purely structural" rule for theobjectbridge. The bean introspection uses the live session'sMarshallingContext(threaded throughPojoWalker.Options.context()) so swaps / bean-filters / locale / timezone honor the same per-invocation configuration asserialize(...); it falls back toMarshallingContext.DEFAULTonly when no context is supplied. - Self-referencing graphs are guarded by an identity-based ancestor check: re-entering an
object already on the current walk path throws
IllegalStateExceptionrather than recursing until the stack overflows. (Shared but acyclic references — the same node reachable by two distinct paths — are permitted.)
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordDatabind-level settings honored byPojoWalker. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidwalk(TokenWriter w, Object value) Walks the given value and emits its structure through the given writer usingdefault options.static voidwalk(TokenWriter w, Object value, PojoWalker.Options options) Walks the given value and emits its structure through the given writer using the supplied options.
-
Method Details
-
walk
Walks the given value and emits its structure through the given writer usingdefault options.- Parameters:
w- The token writer to emit events to. Must not benull .value- The value to walk. May benull .- Throws:
IOException- If the writer's underlying stream fails.
-
walk
Walks the given value and emits its structure through the given writer using the supplied options.- Parameters:
w- The token writer to emit events to. Must not benull .value- The value to walk. May benull .options- The walker's databind-level options. Must not benull .- Throws:
IOException- If the writer's underlying stream fails.
-