Consistent @Nullable declarations on overridden converter methods
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2017 the original author or authors.
|
* Copyright 2002-2020 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -642,7 +642,7 @@ public class GenericConversionService implements ConfigurableConversionService {
|
|||||||
|
|
||||||
private List<String> getConverterStrings() {
|
private List<String> getConverterStrings() {
|
||||||
List<String> converterStrings = new ArrayList<>();
|
List<String> converterStrings = new ArrayList<>();
|
||||||
for (ConvertersForPair convertersForPair : converters.values()) {
|
for (ConvertersForPair convertersForPair : this.converters.values()) {
|
||||||
converterStrings.add(convertersForPair.toString());
|
converterStrings.add(convertersForPair.toString());
|
||||||
}
|
}
|
||||||
Collections.sort(converterStrings);
|
Collections.sort(converterStrings);
|
||||||
@@ -692,6 +692,7 @@ public class GenericConversionService implements ConfigurableConversionService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Nullable
|
||||||
public Set<ConvertiblePair> getConvertibleTypes() {
|
public Set<ConvertiblePair> getConvertibleTypes() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2017 the original author or authors.
|
* Copyright 2002-2020 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -61,12 +61,12 @@ final class MapToMapConverter implements ConditionalGenericConverter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public Object convert(@Nullable Object source, TypeDescriptor sourceType, TypeDescriptor targetType) {
|
public Object convert(@Nullable Object source, TypeDescriptor sourceType, TypeDescriptor targetType) {
|
||||||
if (source == null) {
|
if (source == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
Map<Object, Object> sourceMap = (Map<Object, Object>) source;
|
Map<Object, Object> sourceMap = (Map<Object, Object>) source;
|
||||||
|
|
||||||
// Shortcut if possible...
|
// Shortcut if possible...
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import java.util.HashSet;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.springframework.core.convert.converter.Converter;
|
import org.springframework.core.convert.converter.Converter;
|
||||||
|
import org.springframework.lang.Nullable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts String to a Boolean.
|
* Converts String to a Boolean.
|
||||||
@@ -48,6 +49,7 @@ final class StringToBooleanConverter implements Converter<String, Boolean> {
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Nullable
|
||||||
public Boolean convert(String source) {
|
public Boolean convert(String source) {
|
||||||
String value = source.trim();
|
String value = source.trim();
|
||||||
if (value.isEmpty()) {
|
if (value.isEmpty()) {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2017 the original author or authors.
|
* Copyright 2002-2020 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -17,6 +17,7 @@
|
|||||||
package org.springframework.core.convert.support;
|
package org.springframework.core.convert.support;
|
||||||
|
|
||||||
import org.springframework.core.convert.converter.Converter;
|
import org.springframework.core.convert.converter.Converter;
|
||||||
|
import org.springframework.lang.Nullable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts a String to a Character.
|
* Converts a String to a Character.
|
||||||
@@ -27,6 +28,7 @@ import org.springframework.core.convert.converter.Converter;
|
|||||||
final class StringToCharacterConverter implements Converter<String, Character> {
|
final class StringToCharacterConverter implements Converter<String, Character> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Nullable
|
||||||
public Character convert(String source) {
|
public Character convert(String source) {
|
||||||
if (source.isEmpty()) {
|
if (source.isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2017 the original author or authors.
|
* Copyright 2002-2020 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -18,6 +18,7 @@ package org.springframework.core.convert.support;
|
|||||||
|
|
||||||
import org.springframework.core.convert.converter.Converter;
|
import org.springframework.core.convert.converter.Converter;
|
||||||
import org.springframework.core.convert.converter.ConverterFactory;
|
import org.springframework.core.convert.converter.ConverterFactory;
|
||||||
|
import org.springframework.lang.Nullable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts from a String to a {@link java.lang.Enum} by calling {@link Enum#valueOf(Class, String)}.
|
* Converts from a String to a {@link java.lang.Enum} by calling {@link Enum#valueOf(Class, String)}.
|
||||||
@@ -44,6 +45,7 @@ final class StringToEnumConverterFactory implements ConverterFactory<String, Enu
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Nullable
|
||||||
public T convert(String source) {
|
public T convert(String source) {
|
||||||
if (source.isEmpty()) {
|
if (source.isEmpty()) {
|
||||||
// It's an empty enum identifier: reset the enum value to null.
|
// It's an empty enum identifier: reset the enum value to null.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2017 the original author or authors.
|
* Copyright 2002-2020 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -18,6 +18,7 @@ package org.springframework.core.convert.support;
|
|||||||
|
|
||||||
import org.springframework.core.convert.converter.Converter;
|
import org.springframework.core.convert.converter.Converter;
|
||||||
import org.springframework.core.convert.converter.ConverterFactory;
|
import org.springframework.core.convert.converter.ConverterFactory;
|
||||||
|
import org.springframework.lang.Nullable;
|
||||||
import org.springframework.util.NumberUtils;
|
import org.springframework.util.NumberUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -55,6 +56,7 @@ final class StringToNumberConverterFactory implements ConverterFactory<String, N
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Nullable
|
||||||
public T convert(String source) {
|
public T convert(String source) {
|
||||||
if (source.isEmpty()) {
|
if (source.isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
Reference in New Issue
Block a user