@@ -45,7 +45,7 @@ public class AnnotationDetectionFieldCallback implements FieldCallback {
|
||||
*/
|
||||
public AnnotationDetectionFieldCallback(Class<? extends Annotation> annotationType) {
|
||||
|
||||
Assert.notNull(annotationType, "AnnotationType must not be null!");
|
||||
Assert.notNull(annotationType, "AnnotationType must not be null");
|
||||
|
||||
this.annotationType = annotationType;
|
||||
}
|
||||
@@ -121,7 +121,7 @@ public class AnnotationDetectionFieldCallback implements FieldCallback {
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T> T getValue(Object source) {
|
||||
|
||||
Assert.notNull(source, "Source object must not be null!");
|
||||
Assert.notNull(source, "Source object must not be null");
|
||||
|
||||
Field field = this.field;
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ import org.springframework.util.ReflectionUtils.MethodCallback;
|
||||
*/
|
||||
public class AnnotationDetectionMethodCallback<A extends Annotation> implements MethodCallback {
|
||||
|
||||
private static final String MULTIPLE_FOUND = "Found annotation %s both on %s and %s! Make sure only one of them is annotated with it!";
|
||||
private static final String MULTIPLE_FOUND = "Found annotation %s both on %s and %s; Make sure only one of them is annotated with it";
|
||||
|
||||
private final boolean enforceUniqueness;
|
||||
private final Class<A> annotationType;
|
||||
@@ -59,7 +59,7 @@ public class AnnotationDetectionMethodCallback<A extends Annotation> implements
|
||||
*/
|
||||
public AnnotationDetectionMethodCallback(Class<A> annotationType, boolean enforceUniqueness) {
|
||||
|
||||
Assert.notNull(annotationType, "Annotation type must not be null!");
|
||||
Assert.notNull(annotationType, "Annotation type must not be null");
|
||||
|
||||
this.annotationType = annotationType;
|
||||
this.enforceUniqueness = enforceUniqueness;
|
||||
|
||||
@@ -47,7 +47,7 @@ public abstract class BeanLookup {
|
||||
*/
|
||||
public static <T> Lazy<T> lazyIfAvailable(Class<T> type, BeanFactory beanFactory) {
|
||||
|
||||
Assert.notNull(type, "Type must not be null!");
|
||||
Assert.notNull(type, "Type must not be null");
|
||||
Assert.isInstanceOf(ListableBeanFactory.class, beanFactory);
|
||||
|
||||
return Lazy.of(() -> lookupBean(type, (ListableBeanFactory) beanFactory));
|
||||
|
||||
@@ -67,7 +67,7 @@ public class ClassTypeInformation<S> extends TypeDiscoverer<S> {
|
||||
*/
|
||||
public static <S> ClassTypeInformation<S> from(Class<S> type) {
|
||||
|
||||
Assert.notNull(type, "Type must not be null!");
|
||||
Assert.notNull(type, "Type must not be null");
|
||||
|
||||
return (ClassTypeInformation<S>) cache.computeIfAbsent(type, ClassTypeInformation::new);
|
||||
}
|
||||
@@ -80,7 +80,7 @@ public class ClassTypeInformation<S> extends TypeDiscoverer<S> {
|
||||
*/
|
||||
public static <S> TypeInformation<S> fromReturnTypeOf(Method method) {
|
||||
|
||||
Assert.notNull(method, "Method must not be null!");
|
||||
Assert.notNull(method, "Method must not be null");
|
||||
return (TypeInformation<S>) ClassTypeInformation.from(method.getDeclaringClass())
|
||||
.createInfo(method.getGenericReturnType());
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ public class CustomCollections {
|
||||
*/
|
||||
public static boolean isMapBaseType(Class<?> type) {
|
||||
|
||||
Assert.notNull(type, "Type must not be null!");
|
||||
Assert.notNull(type, "Type must not be null");
|
||||
|
||||
return MAP_TYPES.has(type);
|
||||
}
|
||||
@@ -180,7 +180,7 @@ public class CustomCollections {
|
||||
*/
|
||||
public static void registerConvertersIn(ConverterRegistry registry) {
|
||||
|
||||
Assert.notNull(registry, "ConverterRegistry must not be null!");
|
||||
Assert.notNull(registry, "ConverterRegistry must not be null");
|
||||
|
||||
REGISTRARS.forEach(it -> it.registerConvertersIn(registry));
|
||||
}
|
||||
@@ -215,7 +215,7 @@ public class CustomCollections {
|
||||
|
||||
public boolean hasSuperTypeFor(Class<?> type) {
|
||||
|
||||
Assert.notNull(type, "Type must not be null!");
|
||||
Assert.notNull(type, "Type must not be null");
|
||||
|
||||
return isOneOf(type, IS_ASSIGNABLE, IS_NOT_NULL);
|
||||
}
|
||||
@@ -228,7 +228,7 @@ public class CustomCollections {
|
||||
*/
|
||||
public boolean has(Class<?> type) {
|
||||
|
||||
Assert.notNull(type, "Type must not be null!");
|
||||
Assert.notNull(type, "Type must not be null");
|
||||
|
||||
return isOneOf(type, EQUALS, IS_NOT_NULL);
|
||||
}
|
||||
@@ -242,9 +242,9 @@ public class CustomCollections {
|
||||
*/
|
||||
public Class<?> getSuperType(Class<?> type) {
|
||||
|
||||
Assert.notNull(type, "Type must not be null!");
|
||||
Assert.notNull(type, "Type must not be null");
|
||||
|
||||
Supplier<String> message = () -> String.format("Type %s not contained in candidates %s!", type, types);
|
||||
Supplier<String> message = () -> String.format("Type %s not contained in candidates %s", type, types);
|
||||
|
||||
return isOneOf(type, (l, r) -> l.isAssignableFrom(r), rejectNull(message));
|
||||
}
|
||||
@@ -278,7 +278,7 @@ public class CustomCollections {
|
||||
*/
|
||||
private static Function<Class<?>, Class<?>> rejectNull(Supplier<String> message) {
|
||||
|
||||
Assert.notNull(message, "Message must not be null!");
|
||||
Assert.notNull(message, "Message must not be null");
|
||||
|
||||
return candidate -> {
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ public class Lazy<T> implements Supplier<T> {
|
||||
*/
|
||||
public static <T> Lazy<T> of(T value) {
|
||||
|
||||
Assert.notNull(value, "Value must not be null!");
|
||||
Assert.notNull(value, "Value must not be null");
|
||||
|
||||
return new Lazy<>(() -> value);
|
||||
}
|
||||
@@ -137,7 +137,7 @@ public class Lazy<T> implements Supplier<T> {
|
||||
*/
|
||||
public Lazy<T> or(Supplier<? extends T> supplier) {
|
||||
|
||||
Assert.notNull(supplier, "Supplier must not be null!");
|
||||
Assert.notNull(supplier, "Supplier must not be null");
|
||||
|
||||
return Lazy.of(() -> orElseGet(supplier));
|
||||
}
|
||||
@@ -150,7 +150,7 @@ public class Lazy<T> implements Supplier<T> {
|
||||
*/
|
||||
public Lazy<T> or(T value) {
|
||||
|
||||
Assert.notNull(value, "Value must not be null!");
|
||||
Assert.notNull(value, "Value must not be null");
|
||||
|
||||
return Lazy.of(() -> orElse(value));
|
||||
}
|
||||
@@ -180,7 +180,7 @@ public class Lazy<T> implements Supplier<T> {
|
||||
@Nullable
|
||||
private T orElseGet(Supplier<? extends T> supplier) {
|
||||
|
||||
Assert.notNull(supplier, "Default value supplier must not be null!");
|
||||
Assert.notNull(supplier, "Default value supplier must not be null");
|
||||
|
||||
T value = getNullable();
|
||||
|
||||
@@ -195,7 +195,7 @@ public class Lazy<T> implements Supplier<T> {
|
||||
*/
|
||||
public <S> Lazy<S> map(Function<? super T, ? extends S> function) {
|
||||
|
||||
Assert.notNull(function, "Function must not be null!");
|
||||
Assert.notNull(function, "Function must not be null");
|
||||
|
||||
return Lazy.of(() -> function.apply(get()));
|
||||
}
|
||||
@@ -208,7 +208,7 @@ public class Lazy<T> implements Supplier<T> {
|
||||
*/
|
||||
public <S> Lazy<S> flatMap(Function<? super T, Lazy<? extends S>> function) {
|
||||
|
||||
Assert.notNull(function, "Function must not be null!");
|
||||
Assert.notNull(function, "Function must not be null");
|
||||
|
||||
return Lazy.of(() -> function.apply(get()).get());
|
||||
}
|
||||
|
||||
@@ -70,8 +70,8 @@ public class MethodInvocationRecorder {
|
||||
*/
|
||||
public static <T> Recorded<T> forProxyOf(Class<T> type) {
|
||||
|
||||
Assert.notNull(type, "Type must not be null!");
|
||||
Assert.isTrue(!Modifier.isFinal(type.getModifiers()), "Type to record invocations on must not be final!");
|
||||
Assert.notNull(type, "Type must not be null");
|
||||
Assert.isTrue(!Modifier.isFinal(type.getModifiers()), "Type to record invocations on must not be final");
|
||||
|
||||
return new MethodInvocationRecorder().create(type);
|
||||
}
|
||||
@@ -172,7 +172,7 @@ public class MethodInvocationRecorder {
|
||||
|
||||
public InvocationInformation(Recorded<?> recorded, @Nullable Method invokedMethod) {
|
||||
|
||||
Assert.notNull(recorded, "Recorded must not be null!");
|
||||
Assert.notNull(recorded, "Recorded must not be null");
|
||||
|
||||
this.recorded = recorded;
|
||||
this.invokedMethod = invokedMethod;
|
||||
@@ -317,7 +317,7 @@ public class MethodInvocationRecorder {
|
||||
*/
|
||||
public <S> Recorded<S> record(Function<? super T, S> converter) {
|
||||
|
||||
Assert.notNull(converter, "Function must not be null!");
|
||||
Assert.notNull(converter, "Function must not be null");
|
||||
|
||||
return new Recorded<S>(converter.apply(currentInstance), recorder);
|
||||
}
|
||||
@@ -330,7 +330,7 @@ public class MethodInvocationRecorder {
|
||||
*/
|
||||
public <S> Recorded<S> record(ToCollectionConverter<T, S> converter) {
|
||||
|
||||
Assert.notNull(converter, "Converter must not be null!");
|
||||
Assert.notNull(converter, "Converter must not be null");
|
||||
|
||||
return new Recorded<S>(converter.apply(currentInstance).iterator().next(), recorder);
|
||||
}
|
||||
@@ -343,7 +343,7 @@ public class MethodInvocationRecorder {
|
||||
*/
|
||||
public <S> Recorded<S> record(ToMapConverter<T, S> converter) {
|
||||
|
||||
Assert.notNull(converter, "Converter must not be null!");
|
||||
Assert.notNull(converter, "Converter must not be null");
|
||||
|
||||
return new Recorded<S>(converter.apply(currentInstance).values().iterator().next(), recorder);
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ public abstract class NullableWrapperConverters {
|
||||
*/
|
||||
public static boolean supports(Class<?> type) {
|
||||
|
||||
Assert.notNull(type, "Type must not be null!");
|
||||
Assert.notNull(type, "Type must not be null");
|
||||
|
||||
return supportsCache.computeIfAbsent(type, key -> {
|
||||
|
||||
@@ -125,7 +125,7 @@ public abstract class NullableWrapperConverters {
|
||||
*/
|
||||
public static boolean supportsUnwrapping(Class<?> type) {
|
||||
|
||||
Assert.notNull(type, "Type must not be null!");
|
||||
Assert.notNull(type, "Type must not be null");
|
||||
|
||||
for (WrapperType candidate : UNWRAPPER_TYPES) {
|
||||
if (candidate.getType().isAssignableFrom(type)) {
|
||||
@@ -154,7 +154,7 @@ public abstract class NullableWrapperConverters {
|
||||
*/
|
||||
public static void registerConvertersIn(ConverterRegistry registry) {
|
||||
|
||||
Assert.notNull(registry, "ConversionService must not be null!");
|
||||
Assert.notNull(registry, "ConversionService must not be null");
|
||||
|
||||
registry.addConverter(NullableWrapperToJdk8OptionalConverter.INSTANCE);
|
||||
|
||||
@@ -232,7 +232,7 @@ public abstract class NullableWrapperConverters {
|
||||
*/
|
||||
protected AbstractWrapperTypeConverter(Object nullValue) {
|
||||
|
||||
Assert.notNull(nullValue, "Null value must not be null!");
|
||||
Assert.notNull(nullValue, "Null value must not be null");
|
||||
|
||||
this.nullValue = nullValue;
|
||||
this.wrapperTypes = Collections.singleton(nullValue.getClass());
|
||||
|
||||
@@ -43,7 +43,7 @@ public interface Optionals {
|
||||
*/
|
||||
public static boolean isAnyPresent(Optional<?>... optionals) {
|
||||
|
||||
Assert.notNull(optionals, "Optionals must not be null!");
|
||||
Assert.notNull(optionals, "Optionals must not be null");
|
||||
|
||||
return Arrays.stream(optionals).anyMatch(Optional::isPresent);
|
||||
}
|
||||
@@ -57,7 +57,7 @@ public interface Optionals {
|
||||
@SafeVarargs
|
||||
public static <T> Stream<T> toStream(Optional<? extends T>... optionals) {
|
||||
|
||||
Assert.notNull(optionals, "Optional must not be null!");
|
||||
Assert.notNull(optionals, "Optional must not be null");
|
||||
|
||||
return Arrays.asList(optionals).stream().flatMap(it -> it.map(Stream::of).orElseGet(Stream::empty));
|
||||
}
|
||||
@@ -71,8 +71,8 @@ public interface Optionals {
|
||||
*/
|
||||
public static <S, T> Optional<T> firstNonEmpty(Iterable<S> source, Function<S, Optional<T>> function) {
|
||||
|
||||
Assert.notNull(source, "Source must not be null!");
|
||||
Assert.notNull(function, "Function must not be null!");
|
||||
Assert.notNull(source, "Source must not be null");
|
||||
Assert.notNull(function, "Function must not be null");
|
||||
|
||||
return Streamable.of(source).stream()//
|
||||
.map(function::apply)//
|
||||
@@ -89,8 +89,8 @@ public interface Optionals {
|
||||
*/
|
||||
public static <S, T> T firstNonEmpty(Iterable<S> source, Function<S, T> function, T defaultValue) {
|
||||
|
||||
Assert.notNull(source, "Source must not be null!");
|
||||
Assert.notNull(function, "Function must not be null!");
|
||||
Assert.notNull(source, "Source must not be null");
|
||||
Assert.notNull(function, "Function must not be null");
|
||||
|
||||
return Streamable.of(source).stream()//
|
||||
.map(function::apply)//
|
||||
@@ -107,7 +107,7 @@ public interface Optionals {
|
||||
@SafeVarargs
|
||||
public static <T> Optional<T> firstNonEmpty(Supplier<Optional<T>>... suppliers) {
|
||||
|
||||
Assert.notNull(suppliers, "Suppliers must not be null!");
|
||||
Assert.notNull(suppliers, "Suppliers must not be null");
|
||||
|
||||
return firstNonEmpty(Streamable.of(suppliers));
|
||||
}
|
||||
@@ -120,7 +120,7 @@ public interface Optionals {
|
||||
*/
|
||||
public static <T> Optional<T> firstNonEmpty(Iterable<Supplier<Optional<T>>> suppliers) {
|
||||
|
||||
Assert.notNull(suppliers, "Suppliers must not be null!");
|
||||
Assert.notNull(suppliers, "Suppliers must not be null");
|
||||
|
||||
return Streamable.of(suppliers).stream()//
|
||||
.map(Supplier::get)//
|
||||
@@ -137,7 +137,7 @@ public interface Optionals {
|
||||
*/
|
||||
public static <T> Optional<T> next(Iterator<T> iterator) {
|
||||
|
||||
Assert.notNull(iterator, "Iterator must not be null!");
|
||||
Assert.notNull(iterator, "Iterator must not be null");
|
||||
|
||||
return iterator.hasNext() ? Optional.of(iterator.next()) : Optional.empty();
|
||||
}
|
||||
@@ -163,9 +163,9 @@ public interface Optionals {
|
||||
*/
|
||||
public static <T, S> void ifAllPresent(Optional<T> left, Optional<S> right, BiConsumer<T, S> consumer) {
|
||||
|
||||
Assert.notNull(left, "Optional must not be null!");
|
||||
Assert.notNull(right, "Optional must not be null!");
|
||||
Assert.notNull(consumer, "Consumer must not be null!");
|
||||
Assert.notNull(left, "Optional must not be null");
|
||||
Assert.notNull(right, "Optional must not be null");
|
||||
Assert.notNull(consumer, "Consumer must not be null");
|
||||
|
||||
mapIfAllPresent(left, right, (l, r) -> {
|
||||
consumer.accept(l, r);
|
||||
@@ -184,9 +184,9 @@ public interface Optionals {
|
||||
public static <T, S, R> Optional<R> mapIfAllPresent(Optional<T> left, Optional<S> right,
|
||||
BiFunction<T, S, R> function) {
|
||||
|
||||
Assert.notNull(left, "Optional must not be null!");
|
||||
Assert.notNull(right, "Optional must not be null!");
|
||||
Assert.notNull(function, "BiFunctionmust not be null!");
|
||||
Assert.notNull(left, "Optional must not be null");
|
||||
Assert.notNull(right, "Optional must not be null");
|
||||
Assert.notNull(function, "BiFunction must not be null");
|
||||
|
||||
return left.flatMap(l -> right.map(r -> function.apply(l, r)));
|
||||
}
|
||||
@@ -200,9 +200,9 @@ public interface Optionals {
|
||||
*/
|
||||
public static <T> void ifPresentOrElse(Optional<T> optional, Consumer<? super T> consumer, Runnable runnable) {
|
||||
|
||||
Assert.notNull(optional, "Optional must not be null!");
|
||||
Assert.notNull(consumer, "Consumer must not be null!");
|
||||
Assert.notNull(runnable, "Runnable must not be null!");
|
||||
Assert.notNull(optional, "Optional must not be null");
|
||||
Assert.notNull(consumer, "Consumer must not be null");
|
||||
Assert.notNull(runnable, "Runnable must not be null");
|
||||
|
||||
if (optional.isPresent()) {
|
||||
optional.ifPresent(consumer);
|
||||
|
||||
@@ -41,8 +41,8 @@ public final class Pair<S, T> {
|
||||
|
||||
private Pair(S first, T second) {
|
||||
|
||||
Assert.notNull(first, "First must not be null!");
|
||||
Assert.notNull(second, "Second must not be null!");
|
||||
Assert.notNull(first, "First must not be null");
|
||||
Assert.notNull(second, "Second must not be null");
|
||||
|
||||
this.first = first;
|
||||
this.second = second;
|
||||
|
||||
@@ -74,7 +74,7 @@ public class ParameterTypes {
|
||||
*/
|
||||
public static ParameterTypes of(List<TypeDescriptor> types) {
|
||||
|
||||
Assert.notNull(types, "Types must not be null!");
|
||||
Assert.notNull(types, "Types must not be null");
|
||||
|
||||
return cache.computeIfAbsent(types, ParameterTypes::new);
|
||||
}
|
||||
@@ -87,8 +87,8 @@ public class ParameterTypes {
|
||||
*/
|
||||
static ParameterTypes of(Class<?>... types) {
|
||||
|
||||
Assert.notNull(types, "Types must not be null!");
|
||||
Assert.noNullElements(types, "Types must not have null elements!");
|
||||
Assert.notNull(types, "Types must not be null");
|
||||
Assert.noNullElements(types, "Types must not have null elements");
|
||||
|
||||
return of(Arrays.stream(types) //
|
||||
.map(TypeDescriptor::valueOf) //
|
||||
@@ -104,7 +104,7 @@ public class ParameterTypes {
|
||||
*/
|
||||
public boolean areValidFor(Method method) {
|
||||
|
||||
Assert.notNull(method, "Method must not be null!");
|
||||
Assert.notNull(method, "Method must not be null");
|
||||
|
||||
// Direct matches
|
||||
if (areValidTypes(method)) {
|
||||
@@ -150,7 +150,7 @@ public class ParameterTypes {
|
||||
*/
|
||||
boolean hasTypes(Class<?>... types) {
|
||||
|
||||
Assert.notNull(types, "Types must not be null!");
|
||||
Assert.notNull(types, "Types must not be null");
|
||||
|
||||
return Arrays.stream(types) //
|
||||
.map(TypeDescriptor::valueOf) //
|
||||
@@ -253,7 +253,7 @@ public class ParameterTypes {
|
||||
*/
|
||||
private boolean areValidTypes(Method method) {
|
||||
|
||||
Assert.notNull(method, "Method must not be null!");
|
||||
Assert.notNull(method, "Method must not be null");
|
||||
|
||||
if (method.getParameterCount() != types.size()) {
|
||||
return false;
|
||||
|
||||
@@ -70,15 +70,15 @@ public abstract class ParsingUtils {
|
||||
*/
|
||||
public static String reconcatenateCamelCase(String source, String delimiter) {
|
||||
|
||||
Assert.notNull(source, "Source string must not be null!");
|
||||
Assert.notNull(delimiter, "Delimiter must not be null!");
|
||||
Assert.notNull(source, "Source string must not be null");
|
||||
Assert.notNull(delimiter, "Delimiter must not be null");
|
||||
|
||||
return StringUtils.collectionToDelimitedString(splitCamelCaseToLower(source), delimiter);
|
||||
}
|
||||
|
||||
private static List<String> split(String source, boolean toLower) {
|
||||
|
||||
Assert.notNull(source, "Source string must not be null!");
|
||||
Assert.notNull(source, "Source string must not be null");
|
||||
|
||||
String[] parts = CAMEL_CASE.split(source);
|
||||
List<String> result = new ArrayList<>(parts.length);
|
||||
|
||||
@@ -52,7 +52,7 @@ public interface Predicates {
|
||||
*/
|
||||
static <T> Predicate<T> negate(Predicate<T> predicate) {
|
||||
|
||||
Assert.notNull(predicate, "Predicate must not be null!");
|
||||
Assert.notNull(predicate, "Predicate must not be null");
|
||||
return predicate.negate();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ public abstract class ProxyUtils {
|
||||
*/
|
||||
public static Class<?> getUserClass(Class<?> type) {
|
||||
|
||||
Assert.notNull(type, "Type must not be null!");
|
||||
Assert.notNull(type, "Type must not be null");
|
||||
|
||||
return USER_TYPES.computeIfAbsent(type, it -> {
|
||||
|
||||
@@ -73,7 +73,7 @@ public abstract class ProxyUtils {
|
||||
*/
|
||||
public static Class<?> getUserClass(Object source) {
|
||||
|
||||
Assert.notNull(source, "Source object must not be null!");
|
||||
Assert.notNull(source, "Source object must not be null");
|
||||
|
||||
return getUserClass(AopUtils.getTargetClass(source));
|
||||
}
|
||||
|
||||
@@ -180,8 +180,8 @@ public final class ReflectionUtils {
|
||||
@Nullable
|
||||
public static Field findField(Class<?> type, DescribedFieldFilter filter, boolean enforceUniqueness) {
|
||||
|
||||
Assert.notNull(type, "Type must not be null!");
|
||||
Assert.notNull(filter, "Filter must not be null!");
|
||||
Assert.notNull(type, "Type must not be null");
|
||||
Assert.notNull(filter, "Filter must not be null");
|
||||
|
||||
Class<?> targetClass = type;
|
||||
Field foundField = null;
|
||||
@@ -252,8 +252,8 @@ public final class ReflectionUtils {
|
||||
*/
|
||||
public static Optional<Constructor<?>> findConstructor(Class<?> type, Object... constructorArguments) {
|
||||
|
||||
Assert.notNull(type, "Target type must not be null!");
|
||||
Assert.notNull(constructorArguments, "Constructor arguments must not be null!");
|
||||
Assert.notNull(type, "Target type must not be null");
|
||||
Assert.notNull(constructorArguments, "Constructor arguments must not be null");
|
||||
|
||||
return Arrays.stream(type.getDeclaredConstructors())//
|
||||
.filter(constructor -> argumentsMatch(constructor.getParameterTypes(), constructorArguments))//
|
||||
@@ -297,7 +297,7 @@ public final class ReflectionUtils {
|
||||
.collect(Collectors.joining(", "));
|
||||
|
||||
throw new IllegalArgumentException(
|
||||
String.format("Unable to find method %s(%s)on %s!", name, parameterTypeNames, type));
|
||||
String.format("Unable to find method %s(%s) on %s", name, parameterTypeNames, type));
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -316,7 +316,7 @@ public final class ReflectionUtils {
|
||||
*/
|
||||
public static Stream<Class<?>> returnTypeAndParameters(Method method) {
|
||||
|
||||
Assert.notNull(method, "Method must not be null!");
|
||||
Assert.notNull(method, "Method must not be null");
|
||||
|
||||
Stream<Class<?>> returnType = Stream.of(method.getReturnType());
|
||||
Stream<Class<?>> parameterTypes = Arrays.stream(method.getParameterTypes());
|
||||
@@ -335,9 +335,9 @@ public final class ReflectionUtils {
|
||||
*/
|
||||
public static Optional<Method> getMethod(Class<?> type, String name, ResolvableType... parameterTypes) {
|
||||
|
||||
Assert.notNull(type, "Type must not be null!");
|
||||
Assert.hasText(name, "Name must not be null or empty!");
|
||||
Assert.notNull(parameterTypes, "Parameter types must not be null!");
|
||||
Assert.notNull(type, "Type must not be null");
|
||||
Assert.hasText(name, "Name must not be null or empty");
|
||||
Assert.notNull(parameterTypes, "Parameter types must not be null");
|
||||
|
||||
List<Class<?>> collect = Arrays.stream(parameterTypes)//
|
||||
.map(ResolvableType::getRawClass)//
|
||||
|
||||
@@ -66,7 +66,7 @@ public interface StreamUtils {
|
||||
*/
|
||||
static <T> Stream<T> createStreamFromIterator(CloseableIterator<T> iterator) {
|
||||
|
||||
Assert.notNull(iterator, "Iterator must not be null!");
|
||||
Assert.notNull(iterator, "Iterator must not be null");
|
||||
|
||||
return createStreamFromIterator((Iterator<T>) iterator).onClose(() -> iterator.close());
|
||||
}
|
||||
@@ -124,9 +124,9 @@ public interface StreamUtils {
|
||||
*/
|
||||
static <L, R, T> Stream<T> zip(Stream<L> left, Stream<R> right, BiFunction<L, R, T> combiner) {
|
||||
|
||||
Assert.notNull(left, "Left stream must not be null!");
|
||||
Assert.notNull(right, "Right must not be null!");
|
||||
Assert.notNull(combiner, "Combiner must not be null!");
|
||||
Assert.notNull(left, "Left stream must not be null");
|
||||
Assert.notNull(right, "Right must not be null");
|
||||
Assert.notNull(combiner, "Combiner must not be null");
|
||||
|
||||
Spliterator<L> lefts = left.spliterator();
|
||||
Spliterator<R> rights = right.spliterator();
|
||||
|
||||
@@ -69,7 +69,7 @@ public interface Streamable<T> extends Iterable<T>, Supplier<Stream<T>> {
|
||||
*/
|
||||
static <T> Streamable<T> of(Iterable<T> iterable) {
|
||||
|
||||
Assert.notNull(iterable, "Iterable must not be null!");
|
||||
Assert.notNull(iterable, "Iterable must not be null");
|
||||
|
||||
return iterable::iterator;
|
||||
}
|
||||
@@ -96,7 +96,7 @@ public interface Streamable<T> extends Iterable<T>, Supplier<Stream<T>> {
|
||||
*/
|
||||
default <R> Streamable<R> map(Function<? super T, ? extends R> mapper) {
|
||||
|
||||
Assert.notNull(mapper, "Mapping function must not be null!");
|
||||
Assert.notNull(mapper, "Mapping function must not be null");
|
||||
|
||||
return Streamable.of(() -> stream().map(mapper));
|
||||
}
|
||||
@@ -110,7 +110,7 @@ public interface Streamable<T> extends Iterable<T>, Supplier<Stream<T>> {
|
||||
*/
|
||||
default <R> Streamable<R> flatMap(Function<? super T, ? extends Stream<? extends R>> mapper) {
|
||||
|
||||
Assert.notNull(mapper, "Mapping function must not be null!");
|
||||
Assert.notNull(mapper, "Mapping function must not be null");
|
||||
|
||||
return Streamable.of(() -> stream().flatMap(mapper));
|
||||
}
|
||||
@@ -124,7 +124,7 @@ public interface Streamable<T> extends Iterable<T>, Supplier<Stream<T>> {
|
||||
*/
|
||||
default Streamable<T> filter(Predicate<? super T> predicate) {
|
||||
|
||||
Assert.notNull(predicate, "Filter predicate must not be null!");
|
||||
Assert.notNull(predicate, "Filter predicate must not be null");
|
||||
|
||||
return Streamable.of(() -> stream().filter(predicate));
|
||||
}
|
||||
@@ -147,7 +147,7 @@ public interface Streamable<T> extends Iterable<T>, Supplier<Stream<T>> {
|
||||
*/
|
||||
default Streamable<T> and(Supplier<? extends Stream<? extends T>> stream) {
|
||||
|
||||
Assert.notNull(stream, "Stream must not be null!");
|
||||
Assert.notNull(stream, "Stream must not be null");
|
||||
|
||||
return Streamable.of(() -> Stream.concat(this.stream(), stream.get()));
|
||||
}
|
||||
@@ -162,7 +162,7 @@ public interface Streamable<T> extends Iterable<T>, Supplier<Stream<T>> {
|
||||
@SuppressWarnings("unchecked")
|
||||
default Streamable<T> and(T... others) {
|
||||
|
||||
Assert.notNull(others, "Other values must not be null!");
|
||||
Assert.notNull(others, "Other values must not be null");
|
||||
|
||||
return Streamable.of(() -> Stream.concat(this.stream(), Arrays.stream(others)));
|
||||
}
|
||||
@@ -176,7 +176,7 @@ public interface Streamable<T> extends Iterable<T>, Supplier<Stream<T>> {
|
||||
*/
|
||||
default Streamable<T> and(Iterable<? extends T> iterable) {
|
||||
|
||||
Assert.notNull(iterable, "Iterable must not be null!");
|
||||
Assert.notNull(iterable, "Iterable must not be null");
|
||||
|
||||
return Streamable.of(() -> Stream.concat(this.stream(), StreamSupport.stream(iterable.spliterator(), false)));
|
||||
}
|
||||
|
||||
@@ -72,8 +72,8 @@ class TypeDiscoverer<S> implements TypeInformation<S> {
|
||||
*/
|
||||
protected TypeDiscoverer(Type type, Map<TypeVariable<?>, Type> typeVariableMap) {
|
||||
|
||||
Assert.notNull(type, "Type must not be null!");
|
||||
Assert.notNull(typeVariableMap, "TypeVariableMap must not be null!");
|
||||
Assert.notNull(type, "Type must not be null");
|
||||
Assert.notNull(typeVariableMap, "TypeVariableMap must not be null");
|
||||
|
||||
this.type = type;
|
||||
this.resolvedType = Lazy.of(() -> resolveType(type));
|
||||
@@ -101,7 +101,7 @@ class TypeDiscoverer<S> implements TypeInformation<S> {
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
protected TypeInformation<?> createInfo(Type fieldType) {
|
||||
|
||||
Assert.notNull(fieldType, "Field type must not be null!");
|
||||
Assert.notNull(fieldType, "Field type must not be null");
|
||||
|
||||
if (fieldType.equals(this.type)) {
|
||||
return this;
|
||||
@@ -160,7 +160,7 @@ class TypeDiscoverer<S> implements TypeInformation<S> {
|
||||
|
||||
public List<TypeInformation<?>> getParameterTypes(Constructor<?> constructor) {
|
||||
|
||||
Assert.notNull(constructor, "Constructor must not be null!");
|
||||
Assert.notNull(constructor, "Constructor must not be null");
|
||||
|
||||
List<TypeInformation<?>> parameterTypes = new ArrayList<>(constructor.getParameterCount());
|
||||
for (Parameter parameter : constructor.getParameters()) {
|
||||
@@ -354,13 +354,13 @@ class TypeDiscoverer<S> implements TypeInformation<S> {
|
||||
|
||||
public TypeInformation<?> getReturnType(Method method) {
|
||||
|
||||
Assert.notNull(method, "Method must not be null!");
|
||||
Assert.notNull(method, "Method must not be null");
|
||||
return createInfo(method.getGenericReturnType());
|
||||
}
|
||||
|
||||
public List<TypeInformation<?>> getParameterTypes(Method method) {
|
||||
|
||||
Assert.notNull(method, "Method most not be null!");
|
||||
Assert.notNull(method, "Method most not be null");
|
||||
|
||||
return Streamable.of(method.getGenericParameterTypes()).stream()//
|
||||
.map(this::createInfo)//
|
||||
@@ -423,7 +423,7 @@ class TypeDiscoverer<S> implements TypeInformation<S> {
|
||||
@SuppressWarnings("unchecked")
|
||||
public TypeInformation<? extends S> specialize(ClassTypeInformation<?> type) {
|
||||
|
||||
Assert.notNull(type, "Type must not be null!");
|
||||
Assert.notNull(type, "Type must not be null");
|
||||
Assert.isTrue(getType().isAssignableFrom(type.getType()),
|
||||
() -> String.format("%s must be assignable from %s", getType(), type.getType()));
|
||||
|
||||
|
||||
@@ -198,7 +198,7 @@ public interface TypeInformation<S> {
|
||||
|
||||
if (result == null) {
|
||||
throw new IllegalStateException(
|
||||
"Expected to be able to resolve a type but got null! This usually stems from types implementing raw Map or Collection interfaces");
|
||||
"Expected to be able to resolve a type but got null; This usually stems from types implementing raw Map or Collection interfaces");
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -245,7 +245,7 @@ public interface TypeInformation<S> {
|
||||
|
||||
if (result == null) {
|
||||
throw new IllegalArgumentException(String.format(
|
||||
"Can't retrieve super type information for %s! Does current type really implement the given one",
|
||||
"Can't retrieve super type information for %s; Does current type really implement the given one",
|
||||
superType));
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ class TypeVariableTypeInformation<T> extends ParentTypeAwareTypeInformation<T> {
|
||||
|
||||
super(variable, parent);
|
||||
|
||||
Assert.notNull(variable, "TypeVariable must not be null!");
|
||||
Assert.notNull(variable, "TypeVariable must not be null");
|
||||
|
||||
this.variable = variable;
|
||||
this.parameters = Lazy.of(() -> {
|
||||
|
||||
@@ -29,7 +29,7 @@ import org.springframework.util.StringUtils;
|
||||
*/
|
||||
public class Version implements Comparable<Version> {
|
||||
|
||||
private static final String VERSION_PARSE_ERROR = "Invalid version string! Could not parse segment %s within %s.";
|
||||
private static final String VERSION_PARSE_ERROR = "Invalid version string; Could not parse segment %s within %s";
|
||||
|
||||
private final int major;
|
||||
private final int minor;
|
||||
@@ -43,19 +43,19 @@ public class Version implements Comparable<Version> {
|
||||
*/
|
||||
public Version(int... parts) {
|
||||
|
||||
Assert.notNull(parts, "Parts must not be null!");
|
||||
Assert.notNull(parts, "Parts must not be null");
|
||||
Assert.isTrue(parts.length > 0 && parts.length < 5,
|
||||
String.format("Invalid parts length. 0 < %s < 5", parts.length));
|
||||
String.format("Invalid parts length: 0 < %s < 5", parts.length));
|
||||
|
||||
this.major = parts[0];
|
||||
this.minor = parts.length > 1 ? parts[1] : 0;
|
||||
this.bugfix = parts.length > 2 ? parts[2] : 0;
|
||||
this.build = parts.length > 3 ? parts[3] : 0;
|
||||
|
||||
Assert.isTrue(major >= 0, "Major version must be greater or equal zero!");
|
||||
Assert.isTrue(minor >= 0, "Minor version must be greater or equal zero!");
|
||||
Assert.isTrue(bugfix >= 0, "Bugfix version must be greater or equal zero!");
|
||||
Assert.isTrue(build >= 0, "Build version must be greater or equal zero!");
|
||||
Assert.isTrue(major >= 0, "Major version must be greater or equal zero");
|
||||
Assert.isTrue(minor >= 0, "Minor version must be greater or equal zero");
|
||||
Assert.isTrue(bugfix >= 0, "Bugfix version must be greater or equal zero");
|
||||
Assert.isTrue(build >= 0, "Build version must be greater or equal zero");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -66,7 +66,7 @@ public class Version implements Comparable<Version> {
|
||||
*/
|
||||
public static Version parse(String version) {
|
||||
|
||||
Assert.hasText(version, "Version must not be null o empty!");
|
||||
Assert.hasText(version, "Version must not be null o empty");
|
||||
|
||||
String[] parts = version.trim().split("\\.");
|
||||
int[] intParts = new int[parts.length];
|
||||
|
||||
Reference in New Issue
Block a user