Closed
Description
JEP 394: Pattern Matching for instanceof allows to avoid direct typecasting.
Example
AS-IS
if (owner instanceof ElasticsearchPersistentEntity) {
return ((ElasticsearchPersistentEntity<?>) owner).getFieldNamingStrategy();
}
TO-BE
if (owner instanceof ElasticsearchPersistentEntity<?> persistentEntity) {
return persistentEntity.getFieldNamingStrategy();
}