@@ -116,7 +116,7 @@ public ArangoTypeMapper getTypeMapper() {
116116
117117 @ SuppressWarnings ("unchecked" )
118118 @ Override
119- public <R > R read (final Class <R > type , final JsonNode source ) {
119+ public <R > R read (Class <R > type , JsonNode source ) {
120120 return (R ) readInternal (TypeInformation .of (type ), source );
121121 }
122122
@@ -161,8 +161,8 @@ private Object readInternal(final TypeInformation<?> type, final JsonNode source
161161 return readMap (typeToUse , source );
162162 }
163163
164- if (!source .isArray () && (TypeInformation .OBJECT .equals (typeToUse ) || rawTypeToUse .equals (Object .class ))) {
165- return readMap (TypeInformation .MAP , source );
164+ if (!source .isArray () && (TypeInformation .OBJECT .equals (typeToUse ) || rawTypeToUse .equals (Object .class ))) {
165+ return readMap (TypeInformation .MAP , source );
166166 }
167167
168168 if (typeToUse .getType ().isArray ()) {
@@ -173,8 +173,8 @@ private Object readInternal(final TypeInformation<?> type, final JsonNode source
173173 return readCollection (typeToUse , source );
174174 }
175175
176- if (TypeInformation .OBJECT .equals (typeToUse ) || rawTypeToUse .equals (Object .class )) {
177- return readCollection (TypeInformation .COLLECTION , source );
176+ if (TypeInformation .OBJECT .equals (typeToUse ) || rawTypeToUse .equals (Object .class )) {
177+ return readCollection (TypeInformation .COLLECTION , source );
178178 }
179179
180180 ArangoPersistentEntity <?> entity = context .getRequiredPersistentEntity (rawTypeToUse );
@@ -184,7 +184,8 @@ private Object readInternal(final TypeInformation<?> type, final JsonNode source
184184 private Object readEntity (
185185 final TypeInformation <?> type ,
186186 final JsonNode source ,
187- final ArangoPersistentEntity <?> entity ) {
187+ final ArangoPersistentEntity <?> entity
188+ ) {
188189
189190 if (!source .isObject ()) {
190191 throw new MappingException (
@@ -222,7 +223,8 @@ private void readProperty(
222223 final String parentId ,
223224 final PersistentPropertyAccessor <?> accessor ,
224225 final JsonNode source ,
225- final ArangoPersistentProperty property ) {
226+ final ArangoPersistentProperty property
227+ ) {
226228
227229 Object propertyValue = readPropertyValue (entity , parentId , source , property );
228230 if (propertyValue != null || !property .getType ().isPrimitive ()) {
@@ -234,7 +236,8 @@ private Object readPropertyValue(
234236 final ArangoPersistentEntity <?> entity ,
235237 final String parentId ,
236238 final JsonNode source ,
237- final ArangoPersistentProperty property ) {
239+ final ArangoPersistentProperty property
240+ ) {
238241
239242 Optional <Ref > ref = property .getRef ();
240243 if (ref .isPresent ()) {
@@ -329,13 +332,14 @@ private Object readArray(final TypeInformation<?> type, final JsonNode source) {
329332 private Optional <Object > readReference (
330333 final JsonNode source ,
331334 final ArangoPersistentProperty property ,
332- final Annotation annotation ) {
335+ final Annotation annotation
336+ ) {
333337
334- if (source .isMissingNode () || source .isNull ()) {
335- return Optional .empty ();
336- }
338+ if (source .isMissingNode () || source .isNull ()) {
339+ return Optional .empty ();
340+ }
337341
338- Optional <ReferenceResolver <Annotation >> resolver = resolverFactory .getReferenceResolver (annotation );
342+ Optional <ReferenceResolver <Annotation >> resolver = resolverFactory .getReferenceResolver (annotation );
339343
340344 if (resolver .isEmpty ()) {
341345 return Optional .empty ();
@@ -349,9 +353,9 @@ private Optional<Object> readReference(
349353
350354 return resolver .map (res -> res .resolveMultiple (ids , property .getTypeInformation (), annotation ));
351355 } else if (source .isObject ()) {
352- // source contains target
353- return Optional .of (readInternal (property .getTypeInformation (), source ));
354- } else {
356+ // source contains target
357+ return Optional .of (readInternal (property .getTypeInformation (), source ));
358+ } else {
355359 if (!source .isTextual ()) {
356360 throw new MappingException (
357361 String .format ("A reference must be of type String, but got type %s!" , source .getNodeType ()));
@@ -366,7 +370,8 @@ private <A extends Annotation> Optional<Object> readRelation(
366370 final String parentId ,
367371 final JsonNode source ,
368372 final ArangoPersistentProperty property ,
369- final A annotation ) {
373+ final A annotation
374+ ) {
370375
371376 if (source .isNull ()) {
372377 return Optional .empty ();
@@ -446,7 +451,7 @@ private Object readSimple(final Class<?> type, final JsonNode source) {
446451 Enum <?> e = Enum .valueOf ((Class <? extends Enum >) type , value );
447452 return e ;
448453 } else if (byte [].class .isAssignableFrom (type )) {
449- return Base64 .getDecoder ().decode (value );
454+ return Base64 .getDecoder ().decode (value );
450455 } else if (java .sql .Date .class .isAssignableFrom (type )) {
451456 return new java .sql .Date (parseDate (value ).getTime ());
452457 } else if (Timestamp .class .isAssignableFrom (type )) {
@@ -505,7 +510,8 @@ private DBDocumentEntity readDBDocumentEntity(final JsonNode source) {
505510
506511 private ParameterValueProvider <ArangoPersistentProperty > getParameterProvider (
507512 final ArangoPersistentEntity <?> entity ,
508- final JsonNode source ) {
513+ final JsonNode source
514+ ) {
509515
510516 PropertyValueProvider <ArangoPersistentProperty > provider = new ArangoPropertyValueProvider (entity , source );
511517 return new PersistentEntityParameterValueProvider <>(entity , provider , null );
@@ -778,16 +784,16 @@ private Optional<String> getRefId(final Object source, final ArangoPersistentEnt
778784 }
779785
780786 return Optional .ofNullable (entity .getIdentifierAccessor (source ).getIdentifier ())
781- .map (key -> {
782- if (annotation != null ) {
783- return resolverFactory .getReferenceResolver (annotation )
784- .map (resolver -> resolver .write (source , entity , convertId (key ), annotation ))
785- .orElseThrow (() -> new IllegalArgumentException ("Missing reference resolver for " + annotation ));
786- } else {
787- return MetadataUtils .createIdFromCollectionAndKey (entity .getCollection (), convertId (key ));
788- }
789- })
790- .or (() -> Optional .ofNullable ((String ) entity .getArangoIdAccessor (source ).getIdentifier ()));
787+ .map (key -> {
788+ if (annotation != null ) {
789+ return resolverFactory .getReferenceResolver (annotation )
790+ .map (resolver -> resolver .write (source , entity , convertId (key )))
791+ .orElseThrow (() -> new IllegalArgumentException ("Missing reference resolver for " + annotation ));
792+ } else {
793+ return MetadataUtils .createIdFromCollectionAndKey (entity .getCollection (), convertId (key ));
794+ }
795+ })
796+ .or (() -> Optional .ofNullable ((String ) entity .getArangoIdAccessor (source ).getIdentifier ()));
791797 }
792798
793799 private static Collection <?> asCollection (final Object source ) {
0 commit comments