Class MappedJacksonProperties
java.lang.Object
org.springframework.data.rest.webmvc.json.MappedJacksonProperties
Simple value object to capture a mapping of Jackson mapped field names and
PersistentProperty instances.- Since:
- 5.0
- Author:
- Mark Paluch, Oliver Gierke, Mark Paluch, Mathias Düsterhöft
-
Method Summary
Modifier and TypeMethodDescriptionstatic MappedJacksonPropertiesforDescription(PersistentEntity<?, ?> entity, tools.jackson.databind.BeanDescription description) static MappedJacksonPropertiesforDeserialization(PersistentEntity<?, ?> entity, tools.jackson.databind.ObjectMapper mapper) CreatesMappedJacksonPropertiesfor the givenPersistentEntityfor deserialization purposes.static MappedJacksonPropertiesforSerialization(PersistentEntity<?, ?> entity, tools.jackson.databind.ObjectMapper mapper) CreatesMappedJacksonPropertiesfor the givenPersistentEntityfor serialization purposes.Returns all property names of ignored properties.getMappedName(PersistentProperty<?> property) @Nullable PersistentProperty<?>getPersistentProperty(String fieldName) Returns all properties only known to Jackson.booleanhasPersistentPropertyForField(String fieldName) booleanisExposedProperty(String name) booleanisMappedProperty(PersistentProperty<?> property) Returns whether the givenPersistentPropertyis mapped, i.e. known to both Jackson and Spring Data.booleanisReadableField(String name) booleanisWritableField(String name) Returns whether the property is actually writable.static MappedJacksonPropertiesnone()
-
Method Details
-
forDeserialization
public static MappedJacksonProperties forDeserialization(PersistentEntity<?, ?> entity, tools.jackson.databind.ObjectMapper mapper) CreatesMappedJacksonPropertiesfor the givenPersistentEntityfor deserialization purposes. Will not include Jackson-read-only properties.- Parameters:
entity- must not be null.mapper- must not be null.- Returns:
-
forSerialization
public static MappedJacksonProperties forSerialization(PersistentEntity<?, ?> entity, tools.jackson.databind.ObjectMapper mapper) CreatesMappedJacksonPropertiesfor the givenPersistentEntityfor serialization purposes. Includes Jackson-read-only properties.- Parameters:
entity- must not be null.mapper- must not be null.- Returns:
-
forDescription
public static MappedJacksonProperties forDescription(PersistentEntity<?, ?> entity, tools.jackson.databind.BeanDescription description) -
none
-
getMappedName
- Parameters:
property- must not be null- Returns:
- the mapped name for the
PersistentProperty
-
hasPersistentPropertyForField
- Parameters:
fieldName- must not be empty or null.- Returns:
- true if the field name resolves to a PersistentProperty.
-
getPersistentProperty
- Parameters:
fieldName- must not be empty or null.- Returns:
- the
PersistentPropertybacking the field with the field name.
-
getSpringDataUnmappedProperties
Returns all properties only known to Jackson.- Returns:
- the names of all properties that are not known to Spring Data but appear in the Jackson metamodel.
-
getIgnoredProperties
Returns all property names of ignored properties.- Returns:
- will never be null.
- Since:
- 3.5.11, 3.6.4
-
isMappedProperty
Returns whether the givenPersistentPropertyis mapped, i.e. known to both Jackson and Spring Data.- Parameters:
property- must not be null.- Returns:
-
isWritableField
Returns whether the property is actually writable. I.e. whether there's a non-read-only property on the target type or there's a catch all method annotated withJsonAnySetter.- Parameters:
name- must not be null or empty.- Returns:
-
isReadableField
-
isExposedProperty
-