Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Serial annotation #4791

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package org.springframework.data.mongodb;

import java.io.Serial;
import java.util.List;

import org.springframework.dao.DataAccessException;
Expand All @@ -32,6 +33,7 @@
*/
public class BulkOperationException extends DataAccessException {

@Serial
private static final long serialVersionUID = 73929601661154421L;

private final List<BulkWriteError> errors;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@

import org.springframework.dao.InvalidDataAccessApiUsageException;

import java.io.Serial;

public class InvalidMongoDbApiUsageException extends InvalidDataAccessApiUsageException {

@Serial
private static final long serialVersionUID = 2034770973290508041L;

public InvalidMongoDbApiUsageException(String msg) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,14 @@

import org.springframework.dao.UncategorizedDataAccessException;

import java.io.Serial;

/**
* @author Oliver Gierke
*/
public class LazyLoadingException extends UncategorizedDataAccessException {

@Serial
private static final long serialVersionUID = -7089224903873220037L;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@
import org.springframework.dao.UncategorizedDataAccessException;
import org.springframework.lang.Nullable;

import java.io.Serial;

public class UncategorizedMongoDbException extends UncategorizedDataAccessException {

@Serial
private static final long serialVersionUID = -2336595514062364929L;

public UncategorizedMongoDbException(String msg, @Nullable Throwable cause) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,16 @@

import com.mongodb.WriteConcernResult;

import java.io.Serial;

/**
* Mongo-specific {@link DataIntegrityViolationException}.
*
* @author Oliver Gierke
*/
public class MongoDataIntegrityViolationException extends DataIntegrityViolationException {

@Serial
private static final long serialVersionUID = -186980521176764046L;

private final WriteConcernResult writeResult;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package org.springframework.data.mongodb.core.geo;

import java.io.IOException;
import java.io.Serial;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
Expand Down Expand Up @@ -46,6 +47,7 @@
*/
public class GeoJsonModule extends SimpleModule {

@Serial
private static final long serialVersionUID = -8723016728655643720L;

public GeoJsonModule() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package org.springframework.data.mongodb.core.geo;

import java.io.Serial;
import java.util.Arrays;
import java.util.List;

Expand All @@ -30,6 +31,7 @@
*/
public class GeoJsonPoint extends Point implements GeoJson<List<Double>> {

@Serial
private static final long serialVersionUID = -8026303425147474002L;

private static final String TYPE = "Point";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package org.springframework.data.mongodb.core.geo;

import java.io.Serial;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
Expand All @@ -38,6 +39,7 @@
*/
public class GeoJsonPolygon extends Polygon implements GeoJson<List<GeoJsonLineString>> {

@Serial
private static final long serialVersionUID = 3936163018187247185L;
private static final String TYPE = "Polygon";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package org.springframework.data.mongodb.core.geo;

import java.io.IOException;
import java.io.Serial;

import org.springframework.data.geo.Point;

Expand All @@ -34,6 +35,7 @@
*/
class GeoJsonSerializersModule extends SimpleModule {

@Serial
private static final long serialVersionUID = 1340494654898895610L;

GeoJsonSerializersModule() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package org.springframework.data.mongodb.core.index;

import java.io.Serial;
import java.lang.annotation.Annotation;
import java.time.Duration;
import java.util.ArrayList;
Expand Down Expand Up @@ -1028,6 +1029,7 @@ public int hashCode() {
*/
public static class CyclicPropertyReferenceException extends RuntimeException {

@Serial
private static final long serialVersionUID = -3762979307658772277L;

private final String propertyName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
import org.bson.Document;
import org.springframework.lang.Nullable;

import java.io.Serial;

/**
* Base class for delete events.
*
Expand All @@ -27,6 +29,7 @@
*/
public abstract class AbstractDeleteEvent<T> extends MongoMappingEvent<Document> {

@Serial
private static final long serialVersionUID = 1L;
private final @Nullable Class<T> type;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

import org.bson.Document;

import java.io.Serial;

/**
* {@link MongoMappingEvent} thrown after convert of a document.
*
Expand All @@ -26,6 +28,7 @@
*/
public class AfterConvertEvent<E> extends MongoMappingEvent<E> {

@Serial
private static final long serialVersionUID = 1L;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
import org.bson.Document;
import org.springframework.lang.Nullable;

import java.io.Serial;

/**
* Event being thrown after a single or a set of documents has/have been deleted. The {@link Document} held in the event
* will be the query document <em>after</em> it has been mapped onto the domain type handled.
Expand All @@ -28,6 +30,7 @@
*/
public class AfterDeleteEvent<T> extends AbstractDeleteEvent<T> {

@Serial
private static final long serialVersionUID = 1L;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
import org.bson.Document;
import org.springframework.util.Assert;

import java.io.Serial;

/**
* Event to be triggered after loading {@link Document}s to be mapped onto a given type.
*
Expand All @@ -29,6 +31,7 @@
*/
public class AfterLoadEvent<T> extends MongoMappingEvent<Document> {

@Serial
private static final long serialVersionUID = 1L;
private final Class<T> type;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

import org.bson.Document;

import java.io.Serial;

/**
* {@link MongoMappingEvent} triggered after save of a document.
*
Expand All @@ -26,6 +28,7 @@
*/
public class AfterSaveEvent<E> extends MongoMappingEvent<E> {

@Serial
private static final long serialVersionUID = 1L;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
*/
package org.springframework.data.mongodb.core.mapping.event;

import java.io.Serial;

/**
* Event being thrown before a domain object is converted to be persisted.
*
Expand All @@ -25,6 +27,7 @@
*/
public class BeforeConvertEvent<T> extends MongoMappingEvent<T> {

@Serial
private static final long serialVersionUID = 252614269008845243L;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
import org.bson.Document;
import org.springframework.lang.Nullable;

import java.io.Serial;

/**
* Event being thrown before a document is deleted. The {@link Document} held in the event will represent the query
* document <em>before</em> being mapped based on the domain class handled.
Expand All @@ -28,6 +30,7 @@
*/
public class BeforeDeleteEvent<T> extends AbstractDeleteEvent<T> {

@Serial
private static final long serialVersionUID = -2627547705679734497L;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

import org.bson.Document;

import java.io.Serial;

/**
* {@link MongoMappingEvent} triggered before save of a document.
*
Expand All @@ -26,6 +28,7 @@
*/
public class BeforeSaveEvent<E> extends MongoMappingEvent<E> {

@Serial
private static final long serialVersionUID = 1L;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package org.springframework.data.mongodb.core.mapping.event;

import java.io.Serial;
import java.util.function.Function;

import org.bson.Document;
Expand All @@ -30,6 +31,7 @@
*/
public class MongoMappingEvent<T> extends ApplicationEvent {

@Serial
private static final long serialVersionUID = 1L;
private final @Nullable Document document;
private final @Nullable String collectionName;
Expand Down