Class JsonPropertyAccessor
java.lang.Object
org.springframework.integration.json.JsonPropertyAccessor
- All Implemented Interfaces:
PropertyAccessor
public class JsonPropertyAccessor extends Object implements PropertyAccessor
A SpEL
PropertyAccessor
that knows how to read properties from JSON objects.
Uses Jackson JsonNode
API for nested properties access.- Since:
- 3.0
- Author:
- Eric Bottard, Artem Bilan, Paul Martin, Gary Russell, Pierre Lakreb
-
Constructor Summary
Constructors Constructor Description JsonPropertyAccessor()
-
Method Summary
Modifier and Type Method Description boolean
canRead(EvaluationContext context, Object target, String name)
boolean
canWrite(EvaluationContext context, Object target, String name)
Class<?>[]
getSpecificTargetClasses()
TypedValue
read(EvaluationContext context, Object target, String name)
void
setObjectMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
static Object
wrap(com.fasterxml.jackson.databind.JsonNode json)
void
write(EvaluationContext context, Object target, String name, Object newValue)
-
Constructor Details
-
JsonPropertyAccessor
public JsonPropertyAccessor()
-
-
Method Details
-
setObjectMapper
public void setObjectMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper) -
getSpecificTargetClasses
- Specified by:
getSpecificTargetClasses
in interfacePropertyAccessor
-
canRead
public boolean canRead(EvaluationContext context, Object target, String name) throws AccessException- Specified by:
canRead
in interfacePropertyAccessor
- Throws:
AccessException
-
read
public TypedValue read(EvaluationContext context, @Nullable Object target, String name) throws AccessException- Specified by:
read
in interfacePropertyAccessor
- Throws:
AccessException
-
canWrite
- Specified by:
canWrite
in interfacePropertyAccessor
-
write
- Specified by:
write
in interfacePropertyAccessor
-
wrap
- Throws:
AccessException
-