Skip to content

Commit 4be5aae

Browse files
committed
DATACMNS-1726 - Delombok source files.
1 parent 302fa63 commit 4be5aae

File tree

99 files changed

+3052
-715
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+3052
-715
lines changed

src/main/java/org/springframework/data/auditing/DefaultAuditableBeanWrapperFactory.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@
1515
*/
1616
package org.springframework.data.auditing;
1717

18-
import lombok.NonNull;
19-
import lombok.RequiredArgsConstructor;
20-
2118
import java.lang.reflect.Field;
2219
import java.time.Instant;
2320
import java.time.temporal.TemporalAccessor;
@@ -100,7 +97,7 @@ public <T> Optional<AuditableBeanWrapper<T>> getBeanWrapperFor(T source) {
10097
static class AuditableInterfaceBeanWrapper
10198
extends DateConvertingAuditableBeanWrapper<Auditable<Object, ?, TemporalAccessor>> {
10299

103-
private final @NonNull Auditable<Object, ?, TemporalAccessor> auditable;
100+
private final Auditable<Object, ?, TemporalAccessor> auditable;
104101
private final Class<? extends TemporalAccessor> type;
105102

106103
@SuppressWarnings("unchecked")
@@ -187,11 +184,14 @@ public TemporalAccessor setLastModifiedDate(TemporalAccessor value) {
187184
* @author Oliver Gierke
188185
* @since 1.8
189186
*/
190-
@RequiredArgsConstructor
191187
abstract static class DateConvertingAuditableBeanWrapper<T> implements AuditableBeanWrapper<T> {
192188

193189
private final ConversionService conversionService;
194190

191+
DateConvertingAuditableBeanWrapper(ConversionService conversionService) {
192+
this.conversionService = conversionService;
193+
}
194+
195195
/**
196196
* Returns the {@link TemporalAccessor} in a type, compatible to the given field.
197197
*

src/main/java/org/springframework/data/convert/CustomConversions.java

Lines changed: 79 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,6 @@
1515
*/
1616
package org.springframework.data.convert;
1717

18-
import lombok.AccessLevel;
19-
import lombok.Getter;
20-
import lombok.NonNull;
21-
import lombok.RequiredArgsConstructor;
22-
import lombok.Value;
23-
import lombok.extern.slf4j.Slf4j;
24-
2518
import java.util.ArrayList;
2619
import java.util.Arrays;
2720
import java.util.Collection;
@@ -37,6 +30,8 @@
3730
import java.util.function.Predicate;
3831
import java.util.stream.Collectors;
3932

33+
import org.slf4j.Logger;
34+
4035
import org.springframework.core.GenericTypeResolver;
4136
import org.springframework.core.convert.converter.Converter;
4237
import org.springframework.core.convert.converter.ConverterFactory;
@@ -49,6 +44,7 @@
4944
import org.springframework.data.util.Streamable;
5045
import org.springframework.lang.Nullable;
5146
import org.springframework.util.Assert;
47+
import org.springframework.util.ObjectUtils;
5248

5349
/**
5450
* Value object to capture custom conversion. That is essentially a {@link List} of converters and some additional logic
@@ -62,9 +58,9 @@
6258
* @author Mark Paluch
6359
* @since 2.0
6460
*/
65-
@Slf4j
6661
public class CustomConversions {
6762

63+
private static final Logger LOG = org.slf4j.LoggerFactory.getLogger(CustomConversions.class);
6864
private static final String READ_CONVERTER_NOT_SIMPLE = "Registering converter from %s to %s as reading converter although it doesn't convert from a store-supported type! You might want to check your annotation setup at the converter implementation.";
6965
private static final String WRITE_CONVERTER_NOT_SIMPLE = "Registering converter from %s to %s as writing converter although it doesn't convert to a store-supported type! You might want to check your annotation setup at the converter implementation.";
7066
private static final String NOT_A_CONVERTER = "Converter %s is neither a Spring Converter, GenericConverter or ConverterFactory!";
@@ -511,12 +507,15 @@ interface AbsentTargetTypeMarker {}
511507
*
512508
* @author Mark Paluch
513509
*/
514-
@RequiredArgsConstructor
515510
static class TargetTypes {
516511

517-
private final @NonNull Class<?> sourceType;
512+
private final Class<?> sourceType;
518513
private final Map<Class<?>, Class<?>> conversionTargets = new ConcurrentHashMap<>();
519514

515+
TargetTypes(Class<?> sourceType) {
516+
this.sourceType = sourceType;
517+
}
518+
520519
/**
521520
* Get or compute a target type given its {@code targetType}. Returns a cached {@link Optional} if the value
522521
* (present/absent target) was computed once. Otherwise, uses a {@link Function mappingFunction} to determine a
@@ -624,15 +623,23 @@ protected enum ConverterOrigin {
624623
* @author Oliver Gierke
625624
* @author Mark Paluch
626625
*/
627-
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
628626
private static class ConverterRegistration {
629627

630628
private final Object converter;
631-
private final @NonNull ConvertiblePair convertiblePair;
632-
private final @NonNull StoreConversions storeConversions;
629+
private final ConvertiblePair convertiblePair;
630+
private final StoreConversions storeConversions;
633631
private final boolean reading;
634632
private final boolean writing;
635633

634+
private ConverterRegistration(Object converter, ConvertiblePair convertiblePair, StoreConversions storeConversions,
635+
boolean reading, boolean writing) {
636+
this.converter = converter;
637+
this.convertiblePair = convertiblePair;
638+
this.storeConversions = storeConversions;
639+
this.reading = reading;
640+
this.writing = writing;
641+
}
642+
636643
/**
637644
* Returns whether the converter shall be used for writing.
638645
*
@@ -692,15 +699,18 @@ Object getConverter() {
692699
*
693700
* @author Oliver Gierke
694701
*/
695-
@Value
696-
@Getter(AccessLevel.PACKAGE)
697-
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
698702
public static class StoreConversions {
699703

700704
public static final StoreConversions NONE = StoreConversions.of(SimpleTypeHolder.DEFAULT, Collections.emptyList());
701705

702-
SimpleTypeHolder storeTypeHolder;
703-
Collection<?> storeConverters;
706+
private final SimpleTypeHolder storeTypeHolder;
707+
private final Collection<?> storeConverters;
708+
709+
private StoreConversions(SimpleTypeHolder storeTypeHolder, Collection<?> storeConverters) {
710+
711+
this.storeTypeHolder = storeTypeHolder;
712+
this.storeConverters = storeConverters;
713+
}
704714

705715
/**
706716
* Creates a new {@link StoreConversions} for the given store-specific {@link SimpleTypeHolder} and the given
@@ -800,6 +810,57 @@ private ConverterRegistration register(Object converter, ConvertiblePair pair, b
800810
private boolean isStoreSimpleType(Class<?> type) {
801811
return storeTypeHolder.isSimpleType(type);
802812
}
813+
814+
SimpleTypeHolder getStoreTypeHolder() {
815+
return this.storeTypeHolder;
816+
}
817+
818+
Collection<?> getStoreConverters() {
819+
return this.storeConverters;
820+
}
821+
822+
/*
823+
* (non-Javadoc)
824+
* @see java.lang.Object#equals(java.lang.Object)
825+
*/
826+
@Override
827+
public boolean equals(Object o) {
828+
829+
if (this == o) {
830+
return true;
831+
}
832+
833+
if (!(o instanceof StoreConversions)) {
834+
return false;
835+
}
836+
837+
StoreConversions that = (StoreConversions) o;
838+
if (!ObjectUtils.nullSafeEquals(storeTypeHolder, that.storeTypeHolder)) {
839+
return false;
840+
}
841+
842+
return ObjectUtils.nullSafeEquals(storeConverters, that.storeConverters);
843+
}
844+
845+
/*
846+
* (non-Javadoc)
847+
* @see java.lang.Object#hashCode()
848+
*/
849+
@Override
850+
public int hashCode() {
851+
int result = ObjectUtils.nullSafeHashCode(storeTypeHolder);
852+
result = 31 * result + ObjectUtils.nullSafeHashCode(storeConverters);
853+
return result;
854+
}
855+
856+
/*
857+
* (non-Javadoc)
858+
* @see java.lang.Object#toString()
859+
*/
860+
@Override
861+
public String toString() {
862+
return "StoreConversions{" + "storeTypeHolder=" + storeTypeHolder + ", storeConverters=" + storeConverters + '}';
863+
}
803864
}
804865

805866
/**

src/main/java/org/springframework/data/convert/DefaultConverterBuilder.java

Lines changed: 63 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,12 @@
1515
*/
1616
package org.springframework.data.convert;
1717

18-
import lombok.AccessLevel;
19-
import lombok.EqualsAndHashCode;
20-
import lombok.NonNull;
21-
import lombok.RequiredArgsConstructor;
22-
import lombok.With;
23-
2418
import java.util.Collections;
2519
import java.util.Optional;
2620
import java.util.Set;
2721
import java.util.function.Function;
2822
import java.util.stream.Collectors;
2923

30-
import javax.annotation.Nonnull;
31-
3224
import org.springframework.core.convert.TypeDescriptor;
3325
import org.springframework.core.convert.converter.Converter;
3426
import org.springframework.core.convert.converter.GenericConverter;
@@ -38,6 +30,7 @@
3830
import org.springframework.data.convert.ConverterBuilder.WritingConverterBuilder;
3931
import org.springframework.data.util.Optionals;
4032
import org.springframework.lang.Nullable;
33+
import org.springframework.util.ObjectUtils;
4134

4235
/**
4336
* Builder to easily set up (bi-directional) {@link Converter} instances for Spring Data type mapping using Lambdas. Use
@@ -50,14 +43,20 @@
5043
* @see ConverterBuilder#reading(Class, Class, Function)
5144
* @soundtrack John Mayer - Still Feel Like Your Man (The Search for Everything)
5245
*/
53-
@With(AccessLevel.PACKAGE)
54-
@RequiredArgsConstructor(access = AccessLevel.PACKAGE)
46+
@SuppressWarnings("OptionalUsedAsFieldOrParameterType")
5547
class DefaultConverterBuilder<S, T>
5648
implements ConverterAware, ReadingConverterBuilder<T, S>, WritingConverterBuilder<S, T> {
5749

58-
private final @NonNull ConvertiblePair convertiblePair;
59-
private final @NonNull Optional<Function<? super S, ? extends T>> writing;
60-
private final @NonNull Optional<Function<? super T, ? extends S>> reading;
50+
private final ConvertiblePair convertiblePair;
51+
private final Optional<Function<? super S, ? extends T>> writing;
52+
private final Optional<Function<? super T, ? extends S>> reading;
53+
54+
DefaultConverterBuilder(ConvertiblePair convertiblePair, Optional<Function<? super S, ? extends T>> writing,
55+
Optional<Function<? super T, ? extends S>> reading) {
56+
this.convertiblePair = convertiblePair;
57+
this.writing = writing;
58+
this.reading = reading;
59+
}
6160

6261
/*
6362
* (non-Javadoc)
@@ -121,13 +120,26 @@ private ConvertiblePair invertedPair() {
121120
return new ConvertiblePair(convertiblePair.getTargetType(), convertiblePair.getSourceType());
122121
}
123122

124-
@RequiredArgsConstructor
125-
@EqualsAndHashCode
123+
DefaultConverterBuilder<S, T> withWriting(Optional<Function<? super S, ? extends T>> writing) {
124+
return this.writing == writing ? this
125+
: new DefaultConverterBuilder<S, T>(this.convertiblePair, writing, this.reading);
126+
}
127+
128+
DefaultConverterBuilder<S, T> withReading(Optional<Function<? super T, ? extends S>> reading) {
129+
return this.reading == reading ? this
130+
: new DefaultConverterBuilder<S, T>(this.convertiblePair, this.writing, reading);
131+
}
132+
126133
private static class ConfigurableGenericConverter<S, T> implements GenericConverter {
127134

128135
private final ConvertiblePair convertiblePair;
129136
private final Function<? super S, ? extends T> function;
130137

138+
public ConfigurableGenericConverter(ConvertiblePair convertiblePair, Function<? super S, ? extends T> function) {
139+
this.convertiblePair = convertiblePair;
140+
this.function = function;
141+
}
142+
131143
/*
132144
* (non-Javadoc)
133145
* @see org.springframework.core.convert.converter.GenericConverter#convert(java.lang.Object, org.springframework.core.convert.TypeDescriptor, org.springframework.core.convert.TypeDescriptor)
@@ -143,12 +155,47 @@ public Object convert(@Nullable Object source, TypeDescriptor sourceType, TypeDe
143155
* (non-Javadoc)
144156
* @see org.springframework.core.convert.converter.GenericConverter#getConvertibleTypes()
145157
*/
146-
@Nonnull
158+
147159
@Override
148160
public Set<ConvertiblePair> getConvertibleTypes() {
149161
return Collections.singleton(convertiblePair);
150162
}
151163

164+
/*
165+
* (non-Javadoc)
166+
* @see java.lang.Object#equals(java.lang.Object)
167+
*/
168+
@Override
169+
public boolean equals(Object o) {
170+
171+
if (this == o) {
172+
return true;
173+
}
174+
175+
if (!(o instanceof ConfigurableGenericConverter)) {
176+
return false;
177+
}
178+
179+
ConfigurableGenericConverter<?, ?> that = (ConfigurableGenericConverter<?, ?>) o;
180+
181+
if (!ObjectUtils.nullSafeEquals(convertiblePair, that.convertiblePair)) {
182+
return false;
183+
}
184+
185+
return ObjectUtils.nullSafeEquals(function, that.function);
186+
}
187+
188+
/*
189+
* (non-Javadoc)
190+
* @see java.lang.Object#hashCode()
191+
*/
192+
@Override
193+
public int hashCode() {
194+
int result = ObjectUtils.nullSafeHashCode(convertiblePair);
195+
result = 31 * result + ObjectUtils.nullSafeHashCode(function);
196+
return result;
197+
}
198+
152199
@WritingConverter
153200
private static class Writing<S, T> extends ConfigurableGenericConverter<S, T> {
154201

src/main/java/org/springframework/data/convert/EntityInstantiatorAdapter.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
*/
1616
package org.springframework.data.convert;
1717

18-
import lombok.RequiredArgsConstructor;
19-
2018
import org.springframework.data.mapping.PersistentEntity;
2119
import org.springframework.data.mapping.PersistentProperty;
2220
import org.springframework.data.mapping.model.ParameterValueProvider;
@@ -26,11 +24,14 @@
2624
*
2725
* @author Oliver Drotbohm
2826
*/
29-
@RequiredArgsConstructor
3027
class EntityInstantiatorAdapter implements EntityInstantiator {
3128

3229
private final org.springframework.data.mapping.model.EntityInstantiator delegate;
3330

31+
EntityInstantiatorAdapter(org.springframework.data.mapping.model.EntityInstantiator delegate) {
32+
this.delegate = delegate;
33+
}
34+
3435
/*
3536
* (non-Javadoc)
3637
* @see org.springframework.data.mapping.model.EntityInstantiator#createInstance(org.springframework.data.mapping.PersistentEntity, org.springframework.data.mapping.model.ParameterValueProvider)

src/main/java/org/springframework/data/domain/AbstractPageRequest.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717

1818
import java.io.Serializable;
1919

20-
import org.springframework.lang.Nullable;
21-
2220
/**
2321
* Abstract Java Bean implementation of {@code Pageable}.
2422
*
@@ -134,7 +132,7 @@ public int hashCode() {
134132
* @see java.lang.Object#equals(java.lang.Object)
135133
*/
136134
@Override
137-
public boolean equals(@Nullable Object obj) {
135+
public boolean equals(Object obj) {
138136

139137
if (this == obj) {
140138
return true;

0 commit comments

Comments
 (0)