Code view:

A painting is a person's account of this edit as text, recorded independently of the node mapping - a rendering often has several equally defensible answers where the mapping has one. Deletions and insertions carry no position on the opposite side in a painting, so that panel draws no caret for them.

Before

…lines 1–16 unchanged (16 lines)
17 protected final BeanProperty _property;
18
19 /**
20 * Method (or field) that represents the "any getter"
21 */
22 protected final AnnotatedMember _accessor;
23
24
25 protected MapSerializer _mapSerializer;
26
27 @SuppressWarnings("unchecked")
28 public AnyGetterWriter(BeanProperty property,
29 AnnotatedMember accessor, MapSerializer serializer)
30 {
31 _accessor = accessor;
32 _property = property;
33 _mapSerializer = (MapSerializer) serializer;
34 }
35
36 public void getAndSerialize(Object bean, JsonGenerator gen, SerializerProvider provider)
37 throws Exception
38 {
39 Object value = _accessor.getValue(bean);
40 if (value == null) {
…lines 41–45 unchanged (5 lines)
46 }
47 // 23-Feb-2015, tatu: Nasty, but has to do (for now)
48 if (_mapSerializer != null) {
49 _mapSerializer.serializeFields((Map<?,?>) value, gen, provider);
50 return;
51 }
52 }
53
54 /**
55 * @since 2.3
56 */
57 public void getAndFilter(Object bean, JsonGenerator gen, SerializerProvider provider,
58 PropertyFilter filter)
…lines 59–68 unchanged (10 lines)
69 // 19-Oct-2014, tatu: Should we try to support @JsonInclude options here?
70 if (_mapSerializer != null) {
71 _mapSerializer.serializeFilteredFields((Map<?,?>) value, gen, provider, filter, null);
72 return;
73 }
74 // ... not sure how custom handler would do it
75 }
76
77 // Note: NOT part of ResolvableSerializer...
78 @SuppressWarnings("unchecked")
79 public void resolve(SerializerProvider provider) throws JsonMappingException
80 {
81 // 05-Sep-2013, tatu: I _think_ this can be considered a primary property...
82 _mapSerializer = (MapSerializer) provider.handlePrimaryContextualization(_mapSerializer, _property);
83 }
84}
85

After

…lines 1–17 unchanged (17 lines)
18
19 /**
20 * Method (or field) that represents the "any getter"
21 */
22 protected final AnnotatedMember _accessor;
23
24 protected JsonSerializer<Object> _serializer;
25
26 protected MapSerializer _mapSerializer;
27
28 @SuppressWarnings("unchecked")
29 public AnyGetterWriter(BeanProperty property,
30 AnnotatedMember accessor, JsonSerializer<?> serializer)
31 {
32 _accessor = accessor;
33 _property = property;
34 _serializer = (JsonSerializer<Object>) serializer;
35 if (serializer instanceof MapSerializer) {
36 _mapSerializer = (MapSerializer) serializer;
37 }
38 }
39
40 public void getAndSerialize(Object bean, JsonGenerator gen, SerializerProvider provider)
41 throws Exception
42 {
43 Object value = _accessor.getValue(bean);
…lines 44–49 unchanged (6 lines)
50 }
51 // 23-Feb-2015, tatu: Nasty, but has to do (for now)
52 if (_mapSerializer != null) {
53 _mapSerializer.serializeFields((Map<?,?>) value, gen, provider);
54 return;
55 }
56 _serializer.serialize(value, gen, provider);
57 }
58
59 /**
60 * @since 2.3
61 */
62 public void getAndFilter(Object bean, JsonGenerator gen, SerializerProvider provider,
…lines 63–73 unchanged (11 lines)
74 // 19-Oct-2014, tatu: Should we try to support @JsonInclude options here?
75 if (_mapSerializer != null) {
76 _mapSerializer.serializeFilteredFields((Map<?,?>) value, gen, provider, filter, null);
77 return;
78 }
79 // ... not sure how custom handler would do it
80 _serializer.serialize(value, gen, provider);
81 }
82
83 // Note: NOT part of ResolvableSerializer...
84 @SuppressWarnings("unchecked")
85 public void resolve(SerializerProvider provider) throws JsonMappingException
86 {
87 // 05-Sep-2013, tatu: I _think_ this can be considered a primary property...
88 if (_serializer instanceof ContextualSerializer) {
89 JsonSerializer<?> ser = provider.handlePrimaryContextualization(_serializer, _property);
90 _serializer = (JsonSerializer<Object>) ser;
91 if (ser instanceof MapSerializer) {
92 _mapSerializer = (MapSerializer) ser;
93 }
94 }
95 }
96}
97

Before

program
package_declaration
package "package"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "fasterxml"
. "."
identifier "jackson"
. "."
identifier "databind"
. "."
identifier "ser"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Map"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "fasterxml"
. "."
identifier "jackson"
. "."
identifier "core"
. "."
asterisk
* "*"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "fasterxml"
. "."
identifier "jackson"
. "."
identifier "databind"
. "."
asterisk
* "*"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "fasterxml"
. "."
identifier "jackson"
. "."
identifier "databind"
. "."
identifier "introspect"
. "."
identifier "AnnotatedMember"
; ";"
import_declaration (+22 nodes collapsed)
block_comment "/**\n * Class similar to {@link BeanPropertyWriter}, but that"...
class_declaration
modifiers
public "public"
class "class"
identifier "AnyGetterWriter"
class_body
{ "{"
field_declaration
modifiers
protected "protected"
final "final"
type_identifier "BeanProperty"
variable_declarator
identifier "_property"
; ";"
block_comment "/**\n * Method (or field) that represents the \"any getter"...
field_declaration
modifiers
protected "protected"
final "final"
type_identifier "AnnotatedMember"
variable_declarator
identifier "_accessor"
; ";"
field_declaration
modifiers
protected "protected"
type_identifier "MapSerializer"
variable_declarator
identifier "_mapSerializer"
; ";"
constructor_declaration
modifiers
annotation
@ "@"
identifier "SuppressWarnings"
annotation_argument_list
( "("
string_literal
" "\""
string_fragment "unchecked"
" "\""
) ")"
public "public"
identifier "AnyGetterWriter"
formal_parameters
( "("
formal_parameter
type_identifier "BeanProperty"
identifier "property"
, ","
formal_parameter
type_identifier "AnnotatedMember"
identifier "accessor"
, ","
formal_parameter
type_identifier "MapSerializer"
identifier "serializer"
) ")"
constructor_body
{ "{"
expression_statement
assignment_expression
identifier "_accessor"
= "="
identifier "accessor"
; ";"
expression_statement
assignment_expression
identifier "_property"
= "="
identifier "property"
; ";"
expression_statement
assignment_expression
identifier "_mapSerializer"
= "="
cast_expression
( "("
type_identifier "MapSerializer"
) ")"
identifier "serializer"
; ";"
} "}"
method_declaration
modifiers
public "public"
void_type "void"
identifier "getAndSerialize"
formal_parameters
( "("
formal_parameter
type_identifier "Object"
identifier "bean"
, ","
formal_parameter
type_identifier "JsonGenerator"
identifier "gen"
, ","
formal_parameter
type_identifier "SerializerProvider"
identifier "provider"
) ")"
throws
throws "throws"
type_identifier "Exception"
block
{ "{"
local_variable_declaration
type_identifier "Object"
variable_declarator
identifier "value"
= "="
method_invocation
identifier "_accessor"
. "."
identifier "getValue"
argument_list
( "("
identifier "bean"
) ")"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
identifier "value"
== "=="
null_literal "null"
) ")"
block
{ "{"
return_statement
return "return"
; ";"
} "}"
if_statement (+69 nodes collapsed)
line_comment "// 23-Feb-2015, tatu: Nasty, but has to do (for now)"
if_statement (+42 nodes collapsed)
} "}"
block_comment "/**\n * @since 2.3\n */"
method_declaration
modifiers
public "public"
void_type "void"
identifier "getAndFilter"
formal_parameters
( "("
formal_parameter
type_identifier "Object"
identifier "bean"
, ","
formal_parameter
type_identifier "JsonGenerator"
identifier "gen"
, ","
formal_parameter
type_identifier "SerializerProvider"
identifier "provider"
, ","
formal_parameter
type_identifier "PropertyFilter"
identifier "filter"
) ")"
throws
throws "throws"
type_identifier "Exception"
block
{ "{"
local_variable_declaration
type_identifier "Object"
variable_declarator
identifier "value"
= "="
method_invocation
identifier "_accessor"
. "."
identifier "getValue"
argument_list
( "("
identifier "bean"
) ")"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
identifier "value"
== "=="
null_literal "null"
) ")"
block
{ "{"
return_statement
return "return"
; ";"
} "}"
if_statement (+69 nodes collapsed)
line_comment "// 19-Oct-2014, tatu: Should we try to support @JsonInclude "...
if_statement (+46 nodes collapsed)
line_comment "// ... not sure how custom handler would do it"
} "}"
line_comment "// Note: NOT part of ResolvableSerializer..."
method_declaration
modifiers
annotation
@ "@"
identifier "SuppressWarnings"
annotation_argument_list
( "("
string_literal
" "\""
string_fragment "unchecked"
" "\""
) ")"
public "public"
void_type "void"
identifier "resolve"
formal_parameters
( "("
formal_parameter
type_identifier "SerializerProvider"
identifier "provider"
) ")"
throws
throws "throws"
type_identifier "JsonMappingException"
block
{ "{"
line_comment "// 05-Sep-2013, tatu: I _think_ this can be considered a pri"...
expression_statement
assignment_expression
identifier "_mapSerializer"
= "="
cast_expression
( "("
type_identifier "MapSerializer"
) ")"
method_invocation
identifier "provider"
. "."
identifier "handlePrimaryContextualization"
argument_list
( "("
identifier "_mapSerializer"
, ","
identifier "_property"
) ")"
; ";"
} "}"
} "}"

After

program
package_declaration
package "package"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "fasterxml"
. "."
identifier "jackson"
. "."
identifier "databind"
. "."
identifier "ser"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "util"
. "."
identifier "Map"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "fasterxml"
. "."
identifier "jackson"
. "."
identifier "core"
. "."
asterisk
* "*"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "fasterxml"
. "."
identifier "jackson"
. "."
identifier "databind"
. "."
asterisk
* "*"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "com"
. "."
identifier "fasterxml"
. "."
identifier "jackson"
. "."
identifier "databind"
. "."
identifier "introspect"
. "."
identifier "AnnotatedMember"
; ";"
import_declaration (+22 nodes collapsed)
block_comment "/**\n * Class similar to {@link BeanPropertyWriter}, but that"...
class_declaration
modifiers
public "public"
class "class"
identifier "AnyGetterWriter"
class_body
{ "{"
field_declaration
modifiers
protected "protected"
final "final"
type_identifier "BeanProperty"
variable_declarator
identifier "_property"
; ";"
block_comment "/**\n * Method (or field) that represents the \"any getter"...
field_declaration
modifiers
protected "protected"
final "final"
type_identifier "AnnotatedMember"
variable_declarator
identifier "_accessor"
; ";"
field_declaration
modifiers
protected "protected"
generic_type
type_identifier "JsonSerializer"
type_arguments
< "<"
type_identifier "Object"
> ">"
variable_declarator
identifier "_serializer"
; ";"
field_declaration
modifiers
protected "protected"
type_identifier "MapSerializer"
variable_declarator
identifier "_mapSerializer"
; ";"
constructor_declaration
modifiers
annotation
@ "@"
identifier "SuppressWarnings"
annotation_argument_list
( "("
string_literal
" "\""
string_fragment "unchecked"
" "\""
) ")"
public "public"
identifier "AnyGetterWriter"
formal_parameters
( "("
formal_parameter
type_identifier "BeanProperty"
identifier "property"
, ","
formal_parameter
type_identifier "AnnotatedMember"
identifier "accessor"
, ","
formal_parameter
generic_type
type_identifier "JsonSerializer"
type_arguments
< "<"
wildcard
? "?"
> ">"
identifier "serializer"
) ")"
constructor_body
{ "{"
expression_statement
assignment_expression
identifier "_accessor"
= "="
identifier "accessor"
; ";"
expression_statement
assignment_expression
identifier "_property"
= "="
identifier "property"
; ";"
expression_statement
assignment_expression
identifier "_serializer"
= "="
cast_expression
( "("
generic_type
type_identifier "JsonSerializer"
type_arguments
< "<"
type_identifier "Object"
> ">"
) ")"
identifier "serializer"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
instanceof_expression
identifier "serializer"
instanceof "instanceof"
type_identifier "MapSerializer"
) ")"
block
{ "{"
expression_statement
assignment_expression
identifier "_mapSerializer"
= "="
cast_expression
( "("
type_identifier "MapSerializer"
) ")"
identifier "serializer"
; ";"
} "}"
} "}"
method_declaration
modifiers
public "public"
void_type "void"
identifier "getAndSerialize"
formal_parameters
( "("
formal_parameter
type_identifier "Object"
identifier "bean"
, ","
formal_parameter
type_identifier "JsonGenerator"
identifier "gen"
, ","
formal_parameter
type_identifier "SerializerProvider"
identifier "provider"
) ")"
throws
throws "throws"
type_identifier "Exception"
block
{ "{"
local_variable_declaration
type_identifier "Object"
variable_declarator
identifier "value"
= "="
method_invocation
identifier "_accessor"
. "."
identifier "getValue"
argument_list
( "("
identifier "bean"
) ")"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
identifier "value"
== "=="
null_literal "null"
) ")"
block
{ "{"
return_statement
return "return"
; ";"
} "}"
if_statement (+69 nodes collapsed)
line_comment "// 23-Feb-2015, tatu: Nasty, but has to do (for now)"
if_statement (+42 nodes collapsed)
expression_statement
method_invocation
identifier "_serializer"
. "."
identifier "serialize"
argument_list
( "("
identifier "value"
, ","
identifier "gen"
, ","
identifier "provider"
) ")"
; ";"
} "}"
block_comment "/**\n * @since 2.3\n */"
method_declaration
modifiers
public "public"
void_type "void"
identifier "getAndFilter"
formal_parameters
( "("
formal_parameter
type_identifier "Object"
identifier "bean"
, ","
formal_parameter
type_identifier "JsonGenerator"
identifier "gen"
, ","
formal_parameter
type_identifier "SerializerProvider"
identifier "provider"
, ","
formal_parameter
type_identifier "PropertyFilter"
identifier "filter"
) ")"
throws
throws "throws"
type_identifier "Exception"
block
{ "{"
local_variable_declaration
type_identifier "Object"
variable_declarator
identifier "value"
= "="
method_invocation
identifier "_accessor"
. "."
identifier "getValue"
argument_list
( "("
identifier "bean"
) ")"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
identifier "value"
== "=="
null_literal "null"
) ")"
block
{ "{"
return_statement
return "return"
; ";"
} "}"
if_statement (+69 nodes collapsed)
line_comment "// 19-Oct-2014, tatu: Should we try to support @JsonInclude "...
if_statement (+46 nodes collapsed)
line_comment "// ... not sure how custom handler would do it"
expression_statement
method_invocation
identifier "_serializer"
. "."
identifier "serialize"
argument_list
( "("
identifier "value"
, ","
identifier "gen"
, ","
identifier "provider"
) ")"
; ";"
} "}"
line_comment "// Note: NOT part of ResolvableSerializer..."
method_declaration
modifiers
annotation
@ "@"
identifier "SuppressWarnings"
annotation_argument_list
( "("
string_literal
" "\""
string_fragment "unchecked"
" "\""
) ")"
public "public"
void_type "void"
identifier "resolve"
formal_parameters
( "("
formal_parameter
type_identifier "SerializerProvider"
identifier "provider"
) ")"
throws
throws "throws"
type_identifier "JsonMappingException"
block
{ "{"
line_comment "// 05-Sep-2013, tatu: I _think_ this can be considered a pri"...
if_statement
if "if"
parenthesized_expression
( "("
instanceof_expression
identifier "_serializer"
instanceof "instanceof"
type_identifier "ContextualSerializer"
) ")"
block
{ "{"
local_variable_declaration
generic_type
type_identifier "JsonSerializer"
type_arguments
< "<"
wildcard
? "?"
> ">"
variable_declarator
identifier "ser"
= "="
method_invocation
identifier "provider"
. "."
identifier "handlePrimaryContextualization"
argument_list
( "("
identifier "_serializer"
, ","
identifier "_property"
) ")"
; ";"
expression_statement
assignment_expression
identifier "_serializer"
= "="
cast_expression
( "("
generic_type
type_identifier "JsonSerializer"
type_arguments
< "<"
type_identifier "Object"
> ">"
) ")"
identifier "ser"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
instanceof_expression
identifier "ser"
instanceof "instanceof"
type_identifier "MapSerializer"
) ")"
block
{ "{"
expression_statement
assignment_expression
identifier "_mapSerializer"
= "="
cast_expression
( "("
type_identifier "MapSerializer"
) ")"
identifier "ser"
; ";"
} "}"
} "}"
} "}"
} "}"