ObjectWriter class final
A writer bound to one @JsonView: it writes only the properties of
that view, with its mapper's settings.
Get one from ObjectMapper.writerWithView and keep it when the same
view is written often, such as the public form of a model in a
controller (Jackson's ObjectWriter).
// Hide internal fields from public callers.
final public = mapper.writerWithView(Public);
final json = public.writeValueAsString(user);
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
valueToTree(
Object? value, [TypeInfo< Object?> ? type]) → Object? -
Returns
valueas decoded JSON (maps, lists and scalars), with only the view's properties. -
writeValueAsString(
Object? value) → String -
Returns
valueas JSON text, with only the view's properties.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited