Polishing.

Pattern matching usage.
Diamond operator usage.
Remove unused import.
isEmpty usage.

Original pull request #1912
This commit is contained in:
Tran Ngoc Nhan
2024-10-12 02:05:10 +07:00
committed by Jens Schauder
parent a8463e0ca6
commit f2d62ad7e7
17 changed files with 17 additions and 36 deletions

View File

@@ -209,7 +209,7 @@ public interface DbAction<T> {
* Note that deletes for contained entities that reference the root are to be represented by separate
* {@link DbAction}s.
* </p>
*
*
* @param <T> type of the entity for which this represents a database interaction.
*/
final class DeleteRoot<T> implements DbAction<T> {
@@ -274,7 +274,7 @@ public interface DbAction<T> {
* Note that deletes for contained entities that reference the root are to be represented by separate
* {@link DbAction}s.
* </p>
*
*
* @param <T> type of the entity for which this represents a database interaction.
*/
final class DeleteAllRoot<T> implements DbAction<T> {
@@ -467,7 +467,7 @@ public interface DbAction<T> {
* <p>
* Values come from parent entities but one might also add values manually.
* </p>
*
*
* @return guaranteed to be not {@code null}.
*/
Map<PersistentPropertyPath<RelationalPersistentProperty>, Object> getQualifiers();
@@ -479,7 +479,7 @@ public interface DbAction<T> {
default Pair<PersistentPropertyPath<RelationalPersistentProperty>, Object> getQualifier() {
Map<PersistentPropertyPath<RelationalPersistentProperty>, Object> qualifiers = getQualifiers();
if (qualifiers.size() == 0)
if (qualifiers.isEmpty())
return null;
if (qualifiers.size() > 1) {

View File

@@ -17,7 +17,6 @@ package org.springframework.data.relational.core.dialect;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import org.springframework.data.relational.core.sql.IdentifierProcessing;

View File

@@ -23,9 +23,6 @@ package org.springframework.data.relational.core.mapping;
*/
record EmbeddedContext(RelationalPersistentProperty ownerProperty) {
EmbeddedContext {
}
public String getEmbeddedPrefix() {
return ownerProperty.getEmbeddedPrefix();
}

View File

@@ -17,7 +17,6 @@ package org.springframework.data.relational.core.mapping;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

View File

@@ -15,8 +15,6 @@
*/
package org.springframework.data.relational.core.mapping.event;
import org.springframework.data.relational.core.conversion.AggregateChange;
import java.io.Serial;
/**
@@ -37,7 +35,7 @@ import java.io.Serial;
* <li>SQL statements get applied to the database.</li>
* <li>{@link AfterSaveCallback} and {@link AfterSaveEvent} get published.</li>
* </ol>
*
*
* @since 1.1
* @author Jens Schauder
* @author Mark Paluch

View File

@@ -101,9 +101,7 @@ class SelectStatementVisitor extends DelegatingVisitor implements PartRenderer {
@Override
public Delegation doLeave(Visitable segment) {
if (segment instanceof Select) {
Select select = (Select) segment;
if (segment instanceof Select select) {
builder.append("SELECT ");

View File

@@ -23,7 +23,6 @@ import org.springframework.data.relational.core.query.Criteria;
import org.springframework.data.relational.core.sql.Expression;
import org.springframework.data.repository.query.parser.Part;
import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
/**