Skip to content

Commit 92bc465

Browse files
committed
Consistently override canRead(…) / canWrite(…) in ALPS converter.
This commit has unified the canRead(…) / canWrite(…) call chains to consistently end up in the overload taking a ResolvableType. We now override these to let the ALPS converter only kick in to render Alps instances. Related: GH-2533.
1 parent abc7bfa commit 92bc465

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/alps/AlpsJacksonJsonHttpMessageConverter.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,16 +92,12 @@ public AlpsJacksonJsonHttpMessageConverter(JsonMapper objectMapper,
9292
}
9393

9494
@Override
95-
public boolean canWrite(Class<?> clazz, @Nullable MediaType mediaType) {
95+
public boolean canWrite(ResolvableType type, Class<?> clazz, @Nullable MediaType mediaType) {
96+
9697
return (clazz.isAssignableFrom(Alps.class) || clazz.isAssignableFrom(RootResourceInformation.class))
9798
&& super.canWrite(clazz, mediaType);
9899
}
99100

100-
@Override
101-
public boolean canRead(Class<?> type, @Nullable MediaType mediaType) {
102-
return false;
103-
}
104-
105101
@Override
106102
public boolean canRead(ResolvableType type, @Nullable MediaType mediaType) {
107103
return false;

0 commit comments

Comments
 (0)