spring-projects/spring-integration — pull request #1342 by garyrussell (2014-12-20 01:17:47+00:00)
Title: INT-3585: Handle `payload.class.name` Expressions

JIRA: https://jira.spring.io/browse/INT-3585

The spring integration `EvaluationContext` places custom
property accessors before the default `ReflectivePropertyAccessor` in.

The order is:

custom accessors + `MapAccessor` + `ReflectivePropertyAccessor`

If the `JsonPropertyAccessor` is included, it will attempt to
decode String arguments, such as `class` in `payload.class.name` when the
Payload class is `String`.

`payload.getClass().name` works ok.

The root cause is that the `JsonPropertyAccessor` can handle both Json nodes
and Strings.

Split the property accessor into two versions, one for Json nodes, one for
String. Add support so that the String version can be placed after the
`ReflecivePropertyAccessor`, enabling expressions such as the above to work.

For backwards compatibility, add a `CompositePropertyAccessor` and have the evaulation
context factory bean replace it with the delegates.

Add support for `Orderable`. Order property accessors as follows:

`Unordered custom` + `ordered custom < 0` + `map` + `standard` + `ordered custom >= 0`

In addition, the String version of the `JsonPropertyAccessor` returns `null` for the
target types so it is considered a general, not specific accessor.

See `PropertyOrFieldReference.getPropertyAccessorsToTry()`.

The old `JsonPropertyAccessor` functionality is retained for those cases where the
accessor is being used programmatically.