It would be nice to have the SerializationHintsPredicates in RuntimeHintsPredicates as we have for reflections, resource and proxies.
I've created one myself for now:
public class SerializationHintsPredicates {
public TypeHintPredicate onType(TypeReference typeReference) {
Assert.notNull(typeReference, "'typeReference' should not be null");
return new TypeHintPredicate(typeReference);
}
public TypeHintPredicate onType(Class<?> type) {
Assert.notNull(type, "'type' should not be null");
return new TypeHintPredicate(TypeReference.of(type));
}
public static class TypeHintPredicate implements Predicate<RuntimeHints> {
private final TypeReference type;
TypeHintPredicate(TypeReference type) {
this.type = type;
}
@Override
public boolean test(RuntimeHints hints) {
return hints.serialization().javaSerialization().anyMatch((hint) -> hint.getType().equals(this.type));
}
}
}
Comment From: snicoll
Good catch @marcusdacoregio, thanks!