Browse Source

Update Nullable constraints.

See: #4874
5.0.x
Christoph Strobl 3 weeks ago
parent
commit
df4de0445c
No known key found for this signature in database
GPG Key ID: E6054036D0C37A4B
  1. 1
      spring-data-mongodb/src/main/java/org/springframework/data/mongodb/SessionAwareMethodInterceptor.java
  2. 2
      spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/DefaultReactiveBulkOperations.java
  3. 1
      spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/MongoTemplate.java
  4. 2
      spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/AddFieldsOperation.java
  5. 2
      spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/DateOperators.java
  6. 2
      spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/Fields.java
  7. 2
      spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/SetWindowFieldsOperation.java
  8. 123
      spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/convert/GeoConverters.java
  9. 20
      spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/convert/MongoConverters.java
  10. 5
      spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/convert/QueryMapper.java
  11. 3
      spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/convert/UpdateMapper.java
  12. 2
      spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/WildcardIndex.java
  13. 2
      spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/messaging/TailableCursorRequest.java
  14. 2
      spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/query/Collation.java
  15. 1
      spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/query/SerializationUtils.java
  16. 6
      spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/schema/IdentifiableJsonSchemaProperty.java
  17. 8
      spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/schema/TypedJsonSchemaObject.java
  18. 1
      spring-data-mongodb/src/main/java/org/springframework/data/mongodb/util/BsonUtils.java

1
spring-data-mongodb/src/main/java/org/springframework/data/mongodb/SessionAwareMethodInterceptor.java

@ -165,6 +165,7 @@ public class SessionAwareMethodInterceptor<D, C> implements MethodInterceptor { @@ -165,6 +165,7 @@ public class SessionAwareMethodInterceptor<D, C> implements MethodInterceptor {
* @param targetClass
* @return
*/
@SuppressWarnings("NullAway")
Optional<Method> lookup(Method method, Class<?> targetClass, Class<? extends ClientSession> sessionType) {
return cache.computeIfAbsent(new MethodClassKey(method, targetClass),

2
spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/DefaultReactiveBulkOperations.java

@ -133,7 +133,7 @@ class DefaultReactiveBulkOperations extends BulkOperationsSupport implements Rea @@ -133,7 +133,7 @@ class DefaultReactiveBulkOperations extends BulkOperationsSupport implements Rea
}
@Override
@Contract("_, _, _ -> this")
@Contract("_, _ -> this")
public ReactiveBulkOperations updateOne(Query query, UpdateDefinition update) {
Assert.notNull(query, "Query must not be null");

1
spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/MongoTemplate.java

@ -1986,6 +1986,7 @@ public class MongoTemplate implements MongoOperations, ApplicationContextAware, @@ -1986,6 +1986,7 @@ public class MongoTemplate implements MongoOperations, ApplicationContextAware,
* @deprecated since 3.4 in favor of {@link #aggregate(TypedAggregation, Class)}.
*/
@Deprecated
@SuppressWarnings("NullAway")
public <T> List<T> mapReduce(Query query, Class<?> domainType, String inputCollectionName, String mapFunction,
String reduceFunction, @Nullable MapReduceOptions mapReduceOptions, Class<T> resultType) {

2
spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/AddFieldsOperation.java

@ -84,7 +84,7 @@ public class AddFieldsOperation extends DocumentEnhancingOperation { @@ -84,7 +84,7 @@ public class AddFieldsOperation extends DocumentEnhancingOperation {
* @param value the value to assign.
* @return new instance of {@link AddFieldsOperation}.
*/
@Contract("_ -> new")
@Contract("_, _ -> new")
public AddFieldsOperation addField(Object field, Object value) {
LinkedHashMap<Object, Object> target = new LinkedHashMap<>(getValueMap());

2
spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/DateOperators.java

@ -2717,7 +2717,7 @@ public class DateOperators { @@ -2717,7 +2717,7 @@ public class DateOperators {
*
* @return new instance of {@link DateToParts}.
*/
@Contract("_ -> new")
@Contract("-> new")
public DateToParts iso8601() {
return new DateToParts(append("iso8601", true));
}

2
spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/Fields.java

@ -151,7 +151,7 @@ public final class Fields implements Iterable<Field> { @@ -151,7 +151,7 @@ public final class Fields implements Iterable<Field> {
return and(new AggregationField(name));
}
@Contract("_ -> new")
@Contract("_, _ -> new")
public Fields and(String name, String target) {
return and(new AggregationField(name, target));
}

2
spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/SetWindowFieldsOperation.java

@ -518,7 +518,7 @@ public class SetWindowFieldsOperation @@ -518,7 +518,7 @@ public class SetWindowFieldsOperation
return from(UNBOUNDED);
}
@Contract("-> this")
@Contract("_ -> this")
public DocumentWindowBuilder to(String upper) {
this.upper = upper;

123
spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/convert/GeoConverters.java

@ -65,7 +65,7 @@ import com.mongodb.Function; @@ -65,7 +65,7 @@ import com.mongodb.Function;
@SuppressWarnings("ConstantConditions")
abstract class GeoConverters {
private final static Map<String, Function<Document, GeoJson<?>>> converters;
private final static Map<String, Function<Document, @Nullable GeoJson<?>>> converters;
static {
@ -127,15 +127,15 @@ abstract class GeoConverters { @@ -127,15 +127,15 @@ abstract class GeoConverters {
* @since 1.5
*/
@ReadingConverter
enum DocumentToPointConverter implements Converter<Document, Point> {
enum DocumentToPointConverter implements Converter<Document, @Nullable Point> {
INSTANCE;
@Override
@Contract("null -> null; !null -> !null")
public @Nullable Point convert(@Nullable Document source) {
@SuppressWarnings("NullAway")
public Point convert(Document source) {
if (source == null) {
if(ObjectUtils.isEmpty(source)) {
return null;
}
@ -155,6 +155,7 @@ abstract class GeoConverters { @@ -155,6 +155,7 @@ abstract class GeoConverters {
* @author Thomas Darimont
* @since 1.5
*/
@SuppressWarnings("NullAway")
enum PointToDocumentConverter implements Converter<Point, Document> {
INSTANCE;
@ -173,6 +174,7 @@ abstract class GeoConverters { @@ -173,6 +174,7 @@ abstract class GeoConverters {
* @since 1.5
*/
@WritingConverter
@SuppressWarnings("NullAway")
enum BoxToDocumentConverter implements Converter<Box, Document> {
INSTANCE;
@ -199,21 +201,25 @@ abstract class GeoConverters { @@ -199,21 +201,25 @@ abstract class GeoConverters {
* @since 1.5
*/
@ReadingConverter
enum DocumentToBoxConverter implements Converter<Document, Box> {
enum DocumentToBoxConverter implements Converter<Document, @Nullable Box> {
INSTANCE;
@Override
@Contract("null -> null; !null -> !null")
@SuppressWarnings("NullAway")
public @Nullable Box convert(@Nullable Document source) {
public Box convert(Document source) {
if (source == null) {
if(ObjectUtils.isEmpty(source)) {
return null;
}
Point first = DocumentToPointConverter.INSTANCE.convert((Document) source.get("first"));
Point second = DocumentToPointConverter.INSTANCE.convert((Document) source.get("second"));
Document firstDoc = (Document) source.get("first");
Document secondDoc = (Document) source.get("second");
Assert.notNull(firstDoc, "first must not be null");
Assert.notNull(secondDoc, "second must not be null");
Point first = DocumentToPointConverter.INSTANCE.convert(firstDoc);
Point second = DocumentToPointConverter.INSTANCE.convert(secondDoc);
return new Box(first, second);
}
@ -225,6 +231,7 @@ abstract class GeoConverters { @@ -225,6 +231,7 @@ abstract class GeoConverters {
* @author Thomas Darimont
* @since 1.5
*/
@SuppressWarnings("NullAway")
enum CircleToDocumentConverter implements Converter<Circle, Document> {
INSTANCE;
@ -252,15 +259,15 @@ abstract class GeoConverters { @@ -252,15 +259,15 @@ abstract class GeoConverters {
* @since 1.5
*/
@ReadingConverter
enum DocumentToCircleConverter implements Converter<Document, Circle> {
enum DocumentToCircleConverter implements Converter<Document, @Nullable Circle> {
INSTANCE;
@Override
@Contract("null -> null; !null -> !null")
public @Nullable Circle convert(@Nullable Document source) {
@SuppressWarnings("NullAway")
public Circle convert(Document source) {
if (source == null) {
if(ObjectUtils.isEmpty(source)) {
return null;
}
@ -290,6 +297,7 @@ abstract class GeoConverters { @@ -290,6 +297,7 @@ abstract class GeoConverters {
* @author Thomas Darimont
* @since 1.5
*/
@SuppressWarnings("NullAway")
enum SphereToDocumentConverter implements Converter<Sphere, Document> {
INSTANCE;
@ -317,15 +325,15 @@ abstract class GeoConverters { @@ -317,15 +325,15 @@ abstract class GeoConverters {
* @since 1.5
*/
@ReadingConverter
enum DocumentToSphereConverter implements Converter<Document, Sphere> {
enum DocumentToSphereConverter implements Converter<Document, @Nullable Sphere> {
INSTANCE;
@Override
@Contract("null -> null; !null -> !null")
public @Nullable Sphere convert(@Nullable Document source) {
@SuppressWarnings("NullAway")
public Sphere convert(Document source) {
if (source == null) {
if(ObjectUtils.isEmpty(source)) {
return null;
}
@ -355,6 +363,7 @@ abstract class GeoConverters { @@ -355,6 +363,7 @@ abstract class GeoConverters {
* @author Thomas Darimont
* @since 1.5
*/
@SuppressWarnings("NullAway")
enum PolygonToDocumentConverter implements Converter<Polygon, Document> {
INSTANCE;
@ -387,16 +396,15 @@ abstract class GeoConverters { @@ -387,16 +396,15 @@ abstract class GeoConverters {
* @since 1.5
*/
@ReadingConverter
enum DocumentToPolygonConverter implements Converter<Document, Polygon> {
enum DocumentToPolygonConverter implements Converter<Document, @Nullable Polygon> {
INSTANCE;
@Override
@SuppressWarnings({ "unchecked" })
@Contract("null -> null; !null -> !null")
public @Nullable Polygon convert(@Nullable Document source) {
@SuppressWarnings({ "unchecked", "NullAway" })
public Polygon convert(Document source) {
if (source == null) {
if(ObjectUtils.isEmpty(source)) {
return null;
}
@ -420,6 +428,7 @@ abstract class GeoConverters { @@ -420,6 +428,7 @@ abstract class GeoConverters {
* @author Thomas Darimont
* @since 1.5
*/
@SuppressWarnings("NullAway")
enum GeoCommandToDocumentConverter implements Converter<GeoCommand, Document> {
INSTANCE;
@ -473,6 +482,7 @@ abstract class GeoConverters { @@ -473,6 +482,7 @@ abstract class GeoConverters {
* @author Christoph Strobl
* @since 1.7
*/
@SuppressWarnings("NullAway")
enum GeoJsonToDocumentConverter implements Converter<GeoJson<?>, Document> {
INSTANCE;
@ -561,16 +571,15 @@ abstract class GeoConverters { @@ -561,16 +571,15 @@ abstract class GeoConverters {
* @author Christoph Strobl
* @since 1.7
*/
enum DocumentToGeoJsonPointConverter implements Converter<Document, GeoJsonPoint> {
enum DocumentToGeoJsonPointConverter implements Converter<Document, @Nullable GeoJsonPoint> {
INSTANCE;
@Override
@SuppressWarnings("unchecked")
@Contract("null -> null; !null -> !null")
public @Nullable GeoJsonPoint convert(@Nullable Document source) {
@SuppressWarnings({"unchecked", "NullAway"})
public GeoJsonPoint convert(Document source) {
if (source == null) {
if(ObjectUtils.isEmpty(source)) {
return null;
}
@ -589,15 +598,15 @@ abstract class GeoConverters { @@ -589,15 +598,15 @@ abstract class GeoConverters {
* @author Christoph Strobl
* @since 1.7
*/
enum DocumentToGeoJsonPolygonConverter implements Converter<Document, GeoJsonPolygon> {
enum DocumentToGeoJsonPolygonConverter implements Converter<Document, @Nullable GeoJsonPolygon> {
INSTANCE;
@Override
@Contract("null -> null; !null -> !null")
public @Nullable GeoJsonPolygon convert(@Nullable Document source) {
@SuppressWarnings("NullAway")
public GeoJsonPolygon convert(Document source) {
if (source == null) {
if(ObjectUtils.isEmpty(source)) {
return null;
}
@ -612,15 +621,15 @@ abstract class GeoConverters { @@ -612,15 +621,15 @@ abstract class GeoConverters {
* @author Christoph Strobl
* @since 1.7
*/
enum DocumentToGeoJsonMultiPolygonConverter implements Converter<Document, GeoJsonMultiPolygon> {
enum DocumentToGeoJsonMultiPolygonConverter implements Converter<Document, @Nullable GeoJsonMultiPolygon> {
INSTANCE;
@Override
@Contract("null -> null; !null -> !null")
public @Nullable GeoJsonMultiPolygon convert(@Nullable Document source) {
@SuppressWarnings("NullAway")
public GeoJsonMultiPolygon convert(Document source) {
if (source == null) {
if(ObjectUtils.isEmpty(source)) {
return null;
}
@ -643,15 +652,15 @@ abstract class GeoConverters { @@ -643,15 +652,15 @@ abstract class GeoConverters {
* @author Christoph Strobl
* @since 1.7
*/
enum DocumentToGeoJsonLineStringConverter implements Converter<Document, GeoJsonLineString> {
enum DocumentToGeoJsonLineStringConverter implements Converter<Document, @Nullable GeoJsonLineString> {
INSTANCE;
@Override
@Contract("null -> null; !null -> !null")
public @Nullable GeoJsonLineString convert(@Nullable Document source) {
@SuppressWarnings("NullAway")
public GeoJsonLineString convert(Document source) {
if (source == null) {
if(ObjectUtils.isEmpty(source)) {
return null;
}
@ -668,15 +677,15 @@ abstract class GeoConverters { @@ -668,15 +677,15 @@ abstract class GeoConverters {
* @author Christoph Strobl
* @since 1.7
*/
enum DocumentToGeoJsonMultiPointConverter implements Converter<Document, GeoJsonMultiPoint> {
enum DocumentToGeoJsonMultiPointConverter implements Converter<Document, @Nullable GeoJsonMultiPoint> {
INSTANCE;
@Override
@Contract("null -> null; !null -> !null")
public @Nullable GeoJsonMultiPoint convert(@Nullable Document source) {
@SuppressWarnings("NullAway")
public GeoJsonMultiPoint convert(Document source) {
if (source == null) {
if(ObjectUtils.isEmpty(source)) {
return null;
}
@ -693,15 +702,15 @@ abstract class GeoConverters { @@ -693,15 +702,15 @@ abstract class GeoConverters {
* @author Christoph Strobl
* @since 1.7
*/
enum DocumentToGeoJsonMultiLineStringConverter implements Converter<Document, GeoJsonMultiLineString> {
enum DocumentToGeoJsonMultiLineStringConverter implements Converter<Document, @Nullable GeoJsonMultiLineString> {
INSTANCE;
@Override
@Contract("null -> null; !null -> !null")
public @Nullable GeoJsonMultiLineString convert(@Nullable Document source) {
@SuppressWarnings("NullAway")
public GeoJsonMultiLineString convert(Document source) {
if (source == null) {
if(ObjectUtils.isEmpty(source)) {
return null;
}
@ -725,15 +734,15 @@ abstract class GeoConverters { @@ -725,15 +734,15 @@ abstract class GeoConverters {
* @author Christoph Strobl
* @since 1.7
*/
enum DocumentToGeoJsonGeometryCollectionConverter implements Converter<Document, GeoJsonGeometryCollection> {
enum DocumentToGeoJsonGeometryCollectionConverter implements Converter<Document, @Nullable GeoJsonGeometryCollection> {
INSTANCE;
@Override
@Contract("null -> null; !null -> !null")
public @Nullable GeoJsonGeometryCollection convert(@Nullable Document source) {
@SuppressWarnings("NullAway")
public GeoJsonGeometryCollection convert(Document source) {
if (source == null) {
if(ObjectUtils.isEmpty(source)) {
return null;
}
@ -808,11 +817,17 @@ abstract class GeoConverters { @@ -808,11 +817,17 @@ abstract class GeoConverters {
* @author Christoph Strobl
*/
@ReadingConverter
enum DocumentToGeoJsonConverter implements Converter<Document, GeoJson<?>> {
enum DocumentToGeoJsonConverter implements Converter<Document, @Nullable GeoJson<?>> {
INSTANCE;
@Override
@SuppressWarnings("NullAway")
public GeoJson<?> convert(Document source) {
if(ObjectUtils.isEmpty(source)) {
return null;
}
return toGenericGeoJson(source);
}
}

20
spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/convert/MongoConverters.java

@ -194,10 +194,11 @@ abstract class MongoConverters { @@ -194,10 +194,11 @@ abstract class MongoConverters {
*
* @author Oliver Gierke
*/
enum StringToObjectIdConverter implements Converter<String, ObjectId> {
@SuppressWarnings("NullAway")
enum StringToObjectIdConverter implements Converter<String, @Nullable ObjectId> {
INSTANCE;
public @Nullable ObjectId convert(String source) {
public ObjectId convert(String source) {
return StringUtils.hasText(source) ? new ObjectId(source) : null;
}
}
@ -262,10 +263,11 @@ abstract class MongoConverters { @@ -262,10 +263,11 @@ abstract class MongoConverters {
}
@ReadingConverter
enum StringToBigDecimalConverter implements Converter<String, BigDecimal> {
@SuppressWarnings("NullAway")
enum StringToBigDecimalConverter implements Converter<String, @Nullable BigDecimal> {
INSTANCE;
public @Nullable BigDecimal convert(String source) {
public BigDecimal convert(String source) {
return StringUtils.hasText(source) ? new BigDecimal(source) : null;
}
}
@ -292,10 +294,11 @@ abstract class MongoConverters { @@ -292,10 +294,11 @@ abstract class MongoConverters {
}
@ReadingConverter
enum StringToBigIntegerConverter implements Converter<String, BigInteger> {
@SuppressWarnings("NullAway")
enum StringToBigIntegerConverter implements Converter<String, @Nullable BigInteger> {
INSTANCE;
public @Nullable BigInteger convert(String source) {
public BigInteger convert(String source) {
return StringUtils.hasText(source) ? new BigInteger(source) : null;
}
}
@ -439,12 +442,13 @@ abstract class MongoConverters { @@ -439,12 +442,13 @@ abstract class MongoConverters {
* @since 1.9
*/
@ReadingConverter
enum StringToCurrencyConverter implements Converter<String, Currency> {
@SuppressWarnings("NullAway")
enum StringToCurrencyConverter implements Converter<String, @Nullable Currency> {
INSTANCE;
@Override
public @Nullable Currency convert(String source) {
public Currency convert(String source) {
return StringUtils.hasText(source) ? Currency.getInstance(source) : null;
}
}

5
spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/convert/QueryMapper.java

@ -1595,7 +1595,8 @@ public class QueryMapper { @@ -1595,7 +1595,8 @@ public class QueryMapper {
*
* @author Oliver Gierke
*/
protected static class AssociationConverter implements Converter<MongoPersistentProperty, String> {
@SuppressWarnings("NullAway")
protected static class AssociationConverter implements Converter<MongoPersistentProperty, @Nullable String> {
private final String name;
private final MongoPersistentProperty property;
@ -1614,7 +1615,7 @@ public class QueryMapper { @@ -1614,7 +1615,7 @@ public class QueryMapper {
}
@Override
public @Nullable String convert(MongoPersistentProperty source) {
public String convert(MongoPersistentProperty source) {
if (associationFound) {
return null;

3
spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/convert/UpdateMapper.java

@ -329,6 +329,7 @@ public class UpdateMapper extends QueryMapper { @@ -329,6 +329,7 @@ public class UpdateMapper extends QueryMapper {
*
* @author Christoph Strobl
*/
@SuppressWarnings("NullAway")
protected static class UpdateAssociationConverter extends AssociationConverter {
private final KeyMapper mapper;
@ -347,7 +348,7 @@ public class UpdateMapper extends QueryMapper { @@ -347,7 +348,7 @@ public class UpdateMapper extends QueryMapper {
}
@Override
public @Nullable String convert(MongoPersistentProperty source) {
public String convert(MongoPersistentProperty source) {
return super.convert(source) == null ? null : mapper.mapPropertyName(source);
}
}

2
spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/WildcardIndex.java

@ -115,7 +115,7 @@ public class WildcardIndex extends Index { @@ -115,7 +115,7 @@ public class WildcardIndex extends Index {
* @throws UnsupportedOperationException not supported for wildcard indexes.
*/
@Override
@Contract("-> fail")
@Contract("_ -> fail")
public Index expire(long seconds) {
throw new UnsupportedOperationException("Wildcard Index does not support 'ttl'");
}

2
spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/messaging/TailableCursorRequest.java

@ -267,7 +267,7 @@ public class TailableCursorRequest<T> implements SubscriptionRequest<Document, T @@ -267,7 +267,7 @@ public class TailableCursorRequest<T> implements SubscriptionRequest<Document, T
/**
* @return the build {@link ChangeStreamRequest}.
*/
@Contract("_ -> new")
@Contract("-> new")
public TailableCursorRequest<T> build() {
Assert.notNull(listener, "MessageListener must not be null");

2
spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/query/Collation.java

@ -307,7 +307,7 @@ public class Collation { @@ -307,7 +307,7 @@ public class Collation {
*
* @return new {@link Collation}.
*/
@Contract("_ -> new")
@Contract("-> new")
public Collation backwardDiacriticSort() {
return backwards(true);
}

1
spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/query/SerializationUtils.java

@ -149,6 +149,7 @@ public abstract class SerializationUtils { @@ -149,6 +149,7 @@ public abstract class SerializationUtils {
entry -> String.format("\"%s\" : %s", entry.getKey(), serializeToJsonSafely(entry.getValue())));
}
@SuppressWarnings("NullAway")
private static String toString(Collection<?> source) {
return iterableToDelimitedString(source, "[ ", " ]", SerializationUtils::serializeToJsonSafely);
}

6
spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/schema/IdentifiableJsonSchemaProperty.java

@ -197,7 +197,7 @@ public class IdentifiableJsonSchemaProperty<T extends JsonSchemaObject> implemen @@ -197,7 +197,7 @@ public class IdentifiableJsonSchemaProperty<T extends JsonSchemaObject> implemen
* @return new instance of {@link StringJsonSchemaProperty}.
* @see StringJsonSchemaObject#generateDescription()
*/
@Contract("_ -> new")
@Contract("-> new")
public UntypedJsonSchemaProperty generatedDescription() {
return new UntypedJsonSchemaProperty(identifier, jsonSchemaObjectDelegate.generatedDescription());
}
@ -354,7 +354,7 @@ public class IdentifiableJsonSchemaProperty<T extends JsonSchemaObject> implemen @@ -354,7 +354,7 @@ public class IdentifiableJsonSchemaProperty<T extends JsonSchemaObject> implemen
* @return new instance of {@link StringJsonSchemaProperty}.
* @see StringJsonSchemaObject#generateDescription()
*/
@Contract("_ -> new")
@Contract("-> new")
public StringJsonSchemaProperty generatedDescription() {
return new StringJsonSchemaProperty(identifier, jsonSchemaObjectDelegate.generatedDescription());
}
@ -552,7 +552,7 @@ public class IdentifiableJsonSchemaProperty<T extends JsonSchemaObject> implemen @@ -552,7 +552,7 @@ public class IdentifiableJsonSchemaProperty<T extends JsonSchemaObject> implemen
* @return new instance of {@link ObjectJsonSchemaProperty}.
* @see ObjectJsonSchemaObject#generateDescription()
*/
@Contract("_ -> new")
@Contract("-> new")
public ObjectJsonSchemaProperty generatedDescription() {
return new ObjectJsonSchemaProperty(identifier, jsonSchemaObjectDelegate.generatedDescription());
}

8
spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/schema/TypedJsonSchemaObject.java

@ -421,7 +421,7 @@ public class TypedJsonSchemaObject extends UntypedJsonSchemaObject { @@ -421,7 +421,7 @@ public class TypedJsonSchemaObject extends UntypedJsonSchemaObject {
}
@Override
@Contract("_ -> new")
@Contract("-> new")
public ObjectJsonSchemaObject generatedDescription() {
return newInstance(description, true, restrictions);
}
@ -696,7 +696,7 @@ public class TypedJsonSchemaObject extends UntypedJsonSchemaObject { @@ -696,7 +696,7 @@ public class TypedJsonSchemaObject extends UntypedJsonSchemaObject {
}
@Override
@Contract("_ -> new")
@Contract("-> new")
public NumericJsonSchemaObject generatedDescription() {
return newInstance(description, true, restrictions);
}
@ -1110,7 +1110,7 @@ public class TypedJsonSchemaObject extends UntypedJsonSchemaObject { @@ -1110,7 +1110,7 @@ public class TypedJsonSchemaObject extends UntypedJsonSchemaObject {
}
@Override
@Contract("_ -> new")
@Contract("-> new")
public ArrayJsonSchemaObject generatedDescription() {
return newInstance(description, true, restrictions);
}
@ -1242,7 +1242,7 @@ public class TypedJsonSchemaObject extends UntypedJsonSchemaObject { @@ -1242,7 +1242,7 @@ public class TypedJsonSchemaObject extends UntypedJsonSchemaObject {
}
@Override
@Contract("_ -> new")
@Contract("-> new")
public BooleanJsonSchemaObject generatedDescription() {
return new BooleanJsonSchemaObject(description, true, restrictions);
}

1
spring-data-mongodb/src/main/java/org/springframework/data/mongodb/util/BsonUtils.java

@ -797,6 +797,7 @@ public class BsonUtils { @@ -797,6 +797,7 @@ public class BsonUtils {
entry -> "\"" + entry.getKey() + "\" : " + toJson(entry.getValue()));
}
@SuppressWarnings("NullAway")
private static String toString(Collection<?> source) {
return iterableToDelimitedString(source, "[ ", " ]", BsonUtils::toJson);
}

Loading…
Cancel
Save