public class JsonPropertyAccessor
extends java.lang.Object
implements org.springframework.expression.PropertyAccessor
PropertyAccessor
that knows how to read properties from JSON objects.
Uses Jackson JsonNode
API for nested properties access.Modifier and Type | Class and Description |
---|---|
static class |
JsonPropertyAccessor.ArrayNodeAsList
|
static class |
JsonPropertyAccessor.ToStringFriendlyJsonNode
A
JsonPropertyAccessor.WrappedJsonNode implementation to represent JsonNode as string. |
static interface |
JsonPropertyAccessor.WrappedJsonNode<T extends com.fasterxml.jackson.databind.JsonNode>
The base interface for wrapped
JsonNode . |
Constructor and Description |
---|
JsonPropertyAccessor() |
Modifier and Type | Method and Description |
---|---|
boolean |
canRead(org.springframework.expression.EvaluationContext context,
java.lang.Object target,
java.lang.String name) |
boolean |
canWrite(org.springframework.expression.EvaluationContext context,
java.lang.Object target,
java.lang.String name) |
java.lang.Class<?>[] |
getSpecificTargetClasses() |
org.springframework.expression.TypedValue |
read(org.springframework.expression.EvaluationContext context,
java.lang.Object target,
java.lang.String name) |
void |
setObjectMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper) |
static JsonPropertyAccessor.WrappedJsonNode<?> |
wrap(com.fasterxml.jackson.databind.JsonNode json) |
void |
write(org.springframework.expression.EvaluationContext context,
java.lang.Object target,
java.lang.String name,
java.lang.Object newValue) |
public void setObjectMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
public java.lang.Class<?>[] getSpecificTargetClasses()
getSpecificTargetClasses
in interface org.springframework.expression.PropertyAccessor
public boolean canRead(org.springframework.expression.EvaluationContext context, java.lang.Object target, java.lang.String name) throws org.springframework.expression.AccessException
canRead
in interface org.springframework.expression.PropertyAccessor
org.springframework.expression.AccessException
public org.springframework.expression.TypedValue read(org.springframework.expression.EvaluationContext context, java.lang.Object target, java.lang.String name) throws org.springframework.expression.AccessException
read
in interface org.springframework.expression.PropertyAccessor
org.springframework.expression.AccessException
public boolean canWrite(org.springframework.expression.EvaluationContext context, java.lang.Object target, java.lang.String name)
canWrite
in interface org.springframework.expression.PropertyAccessor
public void write(org.springframework.expression.EvaluationContext context, java.lang.Object target, java.lang.String name, java.lang.Object newValue)
write
in interface org.springframework.expression.PropertyAccessor
public static JsonPropertyAccessor.WrappedJsonNode<?> wrap(com.fasterxml.jackson.databind.JsonNode json)