@@ -41,6 +41,7 @@ import org.springframework.util.Assert;
|
||||
* @author Ranie Jade Ramiso
|
||||
* @author Oliver Gierke
|
||||
* @author Christoph Strobl
|
||||
* @author Johannes Englmeier
|
||||
* @since 1.5
|
||||
*/
|
||||
final class AnnotationAuditingMetadata {
|
||||
@@ -108,7 +109,7 @@ final class AnnotationAuditingMetadata {
|
||||
}
|
||||
|
||||
throw new IllegalStateException(String.format(
|
||||
"Found created/modified date field with type %s but only %s as well as java.time types are supported!", type,
|
||||
"Found created/modified date field with type %s but only %s as well as java.time types are supported", type,
|
||||
SUPPORTED_DATE_TYPES));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@ import org.springframework.util.Assert;
|
||||
* @author Christoph Strobl
|
||||
* @author Jens Schauder
|
||||
* @author Pavel Horal
|
||||
* @author Johannes Englmeier
|
||||
* @since 1.5
|
||||
*/
|
||||
class DefaultAuditableBeanWrapperFactory implements AuditableBeanWrapperFactory {
|
||||
@@ -187,7 +188,7 @@ class DefaultAuditableBeanWrapperFactory implements AuditableBeanWrapperFactory
|
||||
|
||||
if (!conversionService.canConvert(value.getClass(), Date.class)) {
|
||||
throw new IllegalArgumentException(
|
||||
String.format("Cannot convert date type for member %s! From %s to java.util.Date to %s.", source,
|
||||
String.format("Cannot convert date type for member %s! From %s to java.util.Date to %s", source,
|
||||
value.getClass(), targetType));
|
||||
}
|
||||
|
||||
@@ -227,7 +228,7 @@ class DefaultAuditableBeanWrapperFactory implements AuditableBeanWrapperFactory
|
||||
}
|
||||
|
||||
private static IllegalArgumentException rejectUnsupportedType(Object source) {
|
||||
return new IllegalArgumentException(String.format("Invalid date type %s for member %s! Supported types are %s.",
|
||||
return new IllegalArgumentException(String.format("Invalid date type %s for member %s! Supported types are %s",
|
||||
source.getClass(), source, AnnotationAuditingMetadata.SUPPORTED_DATE_TYPES));
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ import org.springframework.util.Assert;
|
||||
* implementation.
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
* @author Johannes Englmeier
|
||||
* @since 2.0
|
||||
* @soundtrack Richard Spaven - The Self (feat. Jordan Rakei)
|
||||
*/
|
||||
@@ -44,7 +45,7 @@ public interface ConfigurationUtils {
|
||||
ResourceLoader resourceLoader = context.getResourceLoader();
|
||||
|
||||
if (resourceLoader == null) {
|
||||
throw new IllegalArgumentException("Could not obtain ResourceLoader from XmlReaderContext!");
|
||||
throw new IllegalArgumentException("Could not obtain ResourceLoader from XmlReaderContext");
|
||||
}
|
||||
|
||||
return resourceLoader;
|
||||
@@ -75,7 +76,7 @@ public interface ConfigurationUtils {
|
||||
ClassLoader classLoader = resourceLoader.getClassLoader();
|
||||
|
||||
if (classLoader == null) {
|
||||
throw new IllegalArgumentException("Could not obtain ClassLoader from ResourceLoader!");
|
||||
throw new IllegalArgumentException("Could not obtain ClassLoader from ResourceLoader");
|
||||
}
|
||||
|
||||
return classLoader;
|
||||
@@ -96,7 +97,7 @@ public interface ConfigurationUtils {
|
||||
|
||||
if (result == null) {
|
||||
throw new IllegalArgumentException(
|
||||
String.format("Could not obtain required bean class name from BeanDefinition!", beanDefinition));
|
||||
String.format("Could not obtain required bean class name from BeanDefinition", beanDefinition));
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
@@ -33,6 +33,7 @@ import org.springframework.util.Assert;
|
||||
* inspecting the {@link PersistentEntity} instances for type alias information.
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
* @author Johannes Englmeier
|
||||
*/
|
||||
public class ConfigurableTypeInformationMapper implements TypeInformationMapper {
|
||||
|
||||
@@ -58,7 +59,7 @@ public class ConfigurableTypeInformationMapper implements TypeInformationMapper
|
||||
|
||||
if (typeToAlias.containsValue(alias)) {
|
||||
throw new IllegalArgumentException(
|
||||
String.format("Detected mapping ambiguity! String %s cannot be mapped to more than one type!", alias));
|
||||
String.format("Detected mapping ambiguity! String %s cannot be mapped to more than one type", alias));
|
||||
}
|
||||
|
||||
this.typeToAlias.put(type, alias);
|
||||
|
||||
@@ -54,6 +54,7 @@ import org.springframework.util.ObjectUtils;
|
||||
* @author Christoph Strobl
|
||||
* @author Mark Paluch
|
||||
* @author Xeno Amess
|
||||
* @author Johannes Englmeier
|
||||
* @since 2.0
|
||||
*/
|
||||
public class CustomConversions {
|
||||
|
||||
@@ -38,6 +38,7 @@ import org.springframework.util.ObjectUtils;
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
* @author Mark Paluch
|
||||
* @author Johannes Englmeier
|
||||
* @since 2.0
|
||||
* @see ConverterBuilder#writing(Class, Class, Function)
|
||||
* @see ConverterBuilder#reading(Class, Class, Function)
|
||||
@@ -61,13 +62,13 @@ record DefaultConverterBuilder<S, T> (ConvertiblePair convertiblePair,
|
||||
@Override
|
||||
public GenericConverter getReadingConverter() {
|
||||
return getOptionalReadingConverter()
|
||||
.orElseThrow(() -> new IllegalStateException("No reading converter specified!"));
|
||||
.orElseThrow(() -> new IllegalStateException("No reading converter specified"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public GenericConverter getWritingConverter() {
|
||||
return getOptionalWritingConverter()
|
||||
.orElseThrow(() -> new IllegalStateException("No writing converter specified!"));
|
||||
.orElseThrow(() -> new IllegalStateException("No writing converter specified"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -34,6 +34,7 @@ import org.springframework.util.Assert;
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
* @author Christoph Strobl
|
||||
* @author Johannes Englmeier
|
||||
*/
|
||||
public class MappingContextTypeInformationMapper implements TypeInformationMapper {
|
||||
|
||||
@@ -87,7 +88,7 @@ public class MappingContextTypeInformationMapper implements TypeInformationMappe
|
||||
if (existingAlias.isPresentButDifferent(alias)) {
|
||||
|
||||
throw new IllegalArgumentException(
|
||||
String.format("Trying to register alias '%s', but found already registered alias '%s' for type %s!", alias,
|
||||
String.format("Trying to register alias '%s', but found already registered alias '%s' for type %s", alias,
|
||||
existingAlias, key));
|
||||
}
|
||||
|
||||
@@ -100,7 +101,7 @@ public class MappingContextTypeInformationMapper implements TypeInformationMappe
|
||||
.findFirst().ifPresent(it -> {
|
||||
|
||||
throw new IllegalArgumentException(String.format(
|
||||
"Detected existing type mapping of %s to alias '%s' but attempted to bind the same alias to %s!", key,
|
||||
"Detected existing type mapping of %s to alias '%s' but attempted to bind the same alias to %s", key,
|
||||
alias, it.getKey()));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -19,7 +19,9 @@ import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.springframework.transaction.support.TransactionSynchronization;
|
||||
|
||||
/**
|
||||
* @author Johannes Englmeier
|
||||
*/
|
||||
public class ChangeSetBackedTransactionSynchronization implements TransactionSynchronization {
|
||||
|
||||
private static final Log logger = LogFactory.getLog(ChangeSetBackedTransactionSynchronization.class);
|
||||
@@ -63,12 +65,12 @@ public class ChangeSetBackedTransactionSynchronization implements TransactionSyn
|
||||
|
||||
public void resume() {
|
||||
throw new IllegalStateException(
|
||||
"ChangedSetBackedTransactionSynchronization does not support transaction suspension currently.");
|
||||
"ChangedSetBackedTransactionSynchronization does not support transaction suspension currently");
|
||||
}
|
||||
|
||||
public void suspend() {
|
||||
throw new IllegalStateException(
|
||||
"ChangedSetBackedTransactionSynchronization does not support transaction suspension currently.");
|
||||
"ChangedSetBackedTransactionSynchronization does not support transaction suspension currently");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ import java.io.Serializable;
|
||||
* @author Thomas Darimont
|
||||
* @author Oliver Gierke
|
||||
* @author Alex Bondarev
|
||||
* @author Johannes Englmeier
|
||||
*/
|
||||
public abstract class AbstractPageRequest implements Pageable, Serializable {
|
||||
|
||||
@@ -41,11 +42,11 @@ public abstract class AbstractPageRequest implements Pageable, Serializable {
|
||||
public AbstractPageRequest(int page, int size) {
|
||||
|
||||
if (page < 0) {
|
||||
throw new IllegalArgumentException("Page index must not be less than zero!");
|
||||
throw new IllegalArgumentException("Page index must not be less than zero");
|
||||
}
|
||||
|
||||
if (size < 1) {
|
||||
throw new IllegalArgumentException("Page size must not be less than one!");
|
||||
throw new IllegalArgumentException("Page size must not be less than one");
|
||||
}
|
||||
|
||||
this.page = page;
|
||||
|
||||
@@ -40,6 +40,7 @@ import org.springframework.util.StringUtils;
|
||||
* @author Oliver Gierke
|
||||
* @author Thomas Darimont
|
||||
* @author Mark Paluch
|
||||
* @author Johannes Englmeier
|
||||
*/
|
||||
public class Sort implements Streamable<org.springframework.data.domain.Sort.Order>, Serializable {
|
||||
|
||||
@@ -64,7 +65,7 @@ public class Sort implements Streamable<org.springframework.data.domain.Sort.Ord
|
||||
private Sort(Direction direction, List<String> properties) {
|
||||
|
||||
if (properties == null || properties.isEmpty()) {
|
||||
throw new IllegalArgumentException("You have to provide at least one property to sort by!");
|
||||
throw new IllegalArgumentException("You have to provide at least one property to sort by");
|
||||
}
|
||||
|
||||
this.orders = properties.stream() //
|
||||
@@ -304,7 +305,7 @@ public class Sort implements Streamable<org.springframework.data.domain.Sort.Ord
|
||||
return Direction.valueOf(value.toUpperCase(Locale.US));
|
||||
} catch (Exception e) {
|
||||
throw new IllegalArgumentException(String.format(
|
||||
"Invalid value '%s' for orders given! Has to be either 'desc' or 'asc' (case insensitive).", value), e);
|
||||
"Invalid value '%s' for orders given! Has to be either 'desc' or 'asc' (case insensitive)", value), e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -436,7 +437,7 @@ public class Sort implements Streamable<org.springframework.data.domain.Sort.Ord
|
||||
private Order(@Nullable Direction direction, String property, boolean ignoreCase, NullHandling nullHandling) {
|
||||
|
||||
if (!StringUtils.hasText(property)) {
|
||||
throw new IllegalArgumentException("Property must not be null or empty!");
|
||||
throw new IllegalArgumentException("Property must not be null or empty");
|
||||
}
|
||||
|
||||
this.direction = direction == null ? DEFAULT_DIRECTION : direction;
|
||||
|
||||
@@ -36,6 +36,7 @@ import org.springframework.util.ReflectionUtils;
|
||||
* @author Oliver Gierke
|
||||
* @author Jens Schauder
|
||||
* @author Mark Paluch
|
||||
* @author Johannes Englmeier
|
||||
*/
|
||||
public class AnnotationRevisionMetadata<N extends Number & Comparable<N>> implements RevisionMetadata<N> {
|
||||
|
||||
@@ -135,6 +136,6 @@ public class AnnotationRevisionMetadata<N extends Number & Comparable<N>> implem
|
||||
return ((Date) timestamp).toInstant();
|
||||
}
|
||||
|
||||
throw new IllegalArgumentException(String.format("Can't convert %s to Instant!", timestamp));
|
||||
throw new IllegalArgumentException(String.format("Can't convert %s to Instant", timestamp));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ import java.util.Optional;
|
||||
* @author Philipp Huegelmeyer
|
||||
* @author Oliver Gierke
|
||||
* @author Jens Schauder
|
||||
* @author Johannes Englmeier
|
||||
*/
|
||||
public interface RevisionMetadata<N extends Number & Comparable<N>> {
|
||||
|
||||
@@ -43,7 +44,7 @@ public interface RevisionMetadata<N extends Number & Comparable<N>> {
|
||||
default N getRequiredRevisionNumber() {
|
||||
|
||||
return getRevisionNumber().orElseThrow(
|
||||
() -> new IllegalStateException(String.format("No revision number found on %s!", this.<Object> getDelegate())));
|
||||
() -> new IllegalStateException(String.format("No revision number found on %s", this.<Object> getDelegate())));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -62,7 +63,7 @@ public interface RevisionMetadata<N extends Number & Comparable<N>> {
|
||||
default Instant getRequiredRevisionInstant() {
|
||||
|
||||
return getRevisionInstant().orElseThrow(
|
||||
() -> new IllegalStateException(String.format("No revision date found on %s!", this.<Object> getDelegate())));
|
||||
() -> new IllegalStateException(String.format("No revision date found on %s", this.<Object> getDelegate())));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -22,6 +22,7 @@ import org.springframework.lang.Nullable;
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
* @author Mark Paluch
|
||||
* @author Johannes Englmeier
|
||||
* @see TargetAwareIdentifierAccessor
|
||||
*/
|
||||
public interface IdentifierAccessor {
|
||||
@@ -51,6 +52,6 @@ public interface IdentifierAccessor {
|
||||
return identifier;
|
||||
}
|
||||
|
||||
throw new IllegalStateException("Could not obtain identifier!");
|
||||
throw new IllegalStateException("Could not obtain identifier");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ import org.springframework.util.Assert;
|
||||
* @author Patryk Wasik
|
||||
* @author Mark Paluch
|
||||
* @author Christoph Strobl
|
||||
* @author Johannes Englmeier
|
||||
*/
|
||||
public interface PersistentEntity<T, P extends PersistentProperty<P>> extends Iterable<P> {
|
||||
|
||||
@@ -131,7 +132,7 @@ public interface PersistentEntity<T, P extends PersistentProperty<P>> extends It
|
||||
return property;
|
||||
}
|
||||
|
||||
throw new IllegalStateException(String.format("Required identifier property not found for %s!", getType()));
|
||||
throw new IllegalStateException(String.format("Required identifier property not found for %s", getType()));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -159,7 +160,7 @@ public interface PersistentEntity<T, P extends PersistentProperty<P>> extends It
|
||||
return property;
|
||||
}
|
||||
|
||||
throw new IllegalStateException(String.format("Required version property not found for %s!", getType()));
|
||||
throw new IllegalStateException(String.format("Required version property not found for %s", getType()));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -186,7 +187,7 @@ public interface PersistentEntity<T, P extends PersistentProperty<P>> extends It
|
||||
return property;
|
||||
}
|
||||
|
||||
throw new IllegalStateException(String.format("Required property %s not found for %s!", name, getType()));
|
||||
throw new IllegalStateException(String.format("Required property %s not found for %s", name, getType()));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -312,7 +313,7 @@ public interface PersistentEntity<T, P extends PersistentProperty<P>> extends It
|
||||
}
|
||||
|
||||
throw new IllegalStateException(
|
||||
String.format("Required annotation %s not found for %s!", annotationType, getType()));
|
||||
String.format("Required annotation %s not found for %s", annotationType, getType()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -34,6 +34,7 @@ import org.springframework.util.Assert;
|
||||
* @author Mark Paluch
|
||||
* @author Jens Schauder
|
||||
* @author Christoph Strobl
|
||||
* @author Johannes Englmeier
|
||||
*/
|
||||
public interface PersistentProperty<P extends PersistentProperty<P>> {
|
||||
|
||||
@@ -89,7 +90,7 @@ public interface PersistentProperty<P extends PersistentProperty<P>> {
|
||||
Method getter = getGetter();
|
||||
|
||||
if (getter == null) {
|
||||
throw new IllegalArgumentException(String.format("No getter available for persistent property %s!", this));
|
||||
throw new IllegalArgumentException(String.format("No getter available for persistent property %s", this));
|
||||
}
|
||||
|
||||
return getter;
|
||||
@@ -109,7 +110,7 @@ public interface PersistentProperty<P extends PersistentProperty<P>> {
|
||||
Method setter = getSetter();
|
||||
|
||||
if (setter == null) {
|
||||
throw new IllegalArgumentException(String.format("No setter available for persistent property %s!", this));
|
||||
throw new IllegalArgumentException(String.format("No setter available for persistent property %s", this));
|
||||
}
|
||||
|
||||
return setter;
|
||||
@@ -147,7 +148,7 @@ public interface PersistentProperty<P extends PersistentProperty<P>> {
|
||||
Method wither = getWither();
|
||||
|
||||
if (wither == null) {
|
||||
throw new IllegalArgumentException(String.format("No wither available for persistent property %s!", this));
|
||||
throw new IllegalArgumentException(String.format("No wither available for persistent property %s", this));
|
||||
}
|
||||
|
||||
return wither;
|
||||
@@ -161,7 +162,7 @@ public interface PersistentProperty<P extends PersistentProperty<P>> {
|
||||
Field field = getField();
|
||||
|
||||
if (field == null) {
|
||||
throw new IllegalArgumentException(String.format("No field backing persistent property %s!", this));
|
||||
throw new IllegalArgumentException(String.format("No field backing persistent property %s", this));
|
||||
}
|
||||
|
||||
return field;
|
||||
@@ -193,7 +194,7 @@ public interface PersistentProperty<P extends PersistentProperty<P>> {
|
||||
return association;
|
||||
}
|
||||
|
||||
throw new IllegalStateException("No association found!");
|
||||
throw new IllegalStateException("No association found");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -29,6 +29,7 @@ import org.springframework.util.Assert;
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
* @author Mark Paluch
|
||||
* @author Johannes Englmeier
|
||||
* @since 1.10
|
||||
* @see PersistentEntity#getPropertyAccessor(Object)
|
||||
* @see ConvertingPropertyAccessor
|
||||
@@ -75,7 +76,7 @@ public interface PersistentPropertyAccessor<T> {
|
||||
|
||||
if (parent == null) {
|
||||
|
||||
String nullIntermediateMessage = "Cannot lookup property %s on null intermediate! Original path was: %s on %s.";
|
||||
String nullIntermediateMessage = "Cannot lookup property %s on null intermediate! Original path was: %s on %s";
|
||||
|
||||
throw new MappingException(
|
||||
String.format(nullIntermediateMessage, parentProperty, path.toDotPath(), getBean().getClass().getName()));
|
||||
@@ -151,7 +152,7 @@ public interface PersistentPropertyAccessor<T> {
|
||||
|
||||
if (current == null) {
|
||||
|
||||
String nullIntermediateMessage = "Cannot lookup property %s on null intermediate! Original path was: %s on %s.";
|
||||
String nullIntermediateMessage = "Cannot lookup property %s on null intermediate! Original path was: %s on %s";
|
||||
|
||||
throw new MappingException(
|
||||
String.format(nullIntermediateMessage, property, path.toDotPath(), bean.getClass().getName()));
|
||||
|
||||
@@ -23,6 +23,7 @@ import org.springframework.lang.Nullable;
|
||||
* Abstraction of a path of {@link PersistentProperty}s.
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
* @author Johannes Englmeier
|
||||
*/
|
||||
public interface PersistentPropertyPath<P extends PersistentProperty<P>> extends Streamable<P> {
|
||||
|
||||
@@ -79,7 +80,7 @@ public interface PersistentPropertyPath<P extends PersistentProperty<P>> extends
|
||||
P property = getLeafProperty();
|
||||
|
||||
if (property == null) {
|
||||
throw new IllegalStateException("No leaf property found!");
|
||||
throw new IllegalStateException("No leaf property found");
|
||||
}
|
||||
|
||||
return property;
|
||||
|
||||
@@ -41,10 +41,11 @@ import org.springframework.util.StringUtils;
|
||||
* @author Christoph Strobl
|
||||
* @author Mark Paluch
|
||||
* @author Mariusz Mączkowski
|
||||
* @author Johannes Englmeier
|
||||
*/
|
||||
public class PropertyPath implements Streamable<PropertyPath> {
|
||||
|
||||
private static final String PARSE_DEPTH_EXCEEDED = "Trying to parse a path with depth greater than 1000! This has been disabled for security reasons to prevent parsing overflows.";
|
||||
private static final String PARSE_DEPTH_EXCEEDED = "Trying to parse a path with depth greater than 1000! This has been disabled for security reasons to prevent parsing overflows";
|
||||
|
||||
private static final String DELIMITERS = "_\\.";
|
||||
private static final Pattern SPLITTER = Pattern.compile("(?:[%s]?([%s]*?[^%s]+))".replaceAll("%s", DELIMITERS));
|
||||
@@ -300,7 +301,7 @@ public class PropertyPath implements Streamable<PropertyPath> {
|
||||
|
||||
if (result == null) {
|
||||
throw new IllegalStateException(
|
||||
"No next path available! Clients should call hasNext() before invoking this method!");
|
||||
"No next path available! Clients should call hasNext() before invoking this method");
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -358,7 +359,7 @@ public class PropertyPath implements Streamable<PropertyPath> {
|
||||
|
||||
if (result == null) {
|
||||
throw new IllegalStateException(
|
||||
String.format("Expected parsing to yield a PropertyPath from %s but got null!", source));
|
||||
String.format("Expected parsing to yield a PropertyPath from %s but got null", source));
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
@@ -21,6 +21,7 @@ package org.springframework.data.mapping;
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
* @author Mark Paluch
|
||||
* @author Johannes Englmeier
|
||||
* @since 2.0
|
||||
* @soundtrack Anika Nilles - Greenfield (Pikalar)
|
||||
*/
|
||||
@@ -41,6 +42,6 @@ public abstract class TargetAwareIdentifierAccessor implements IdentifierAccesso
|
||||
return identifier;
|
||||
}
|
||||
|
||||
throw new IllegalStateException(String.format("Could not obtain identifier from %s!", target));
|
||||
throw new IllegalStateException(String.format("Could not obtain identifier from %s", target));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,6 +44,7 @@ import org.springframework.util.comparator.Comparators;
|
||||
* @author Mark Paluch
|
||||
* @author Christoph Strobl
|
||||
* @author Myeonghyeon Lee
|
||||
* @author Johannes Englmeier
|
||||
* @since 2.2
|
||||
*/
|
||||
class EntityCallbackDiscoverer {
|
||||
@@ -322,7 +323,7 @@ class EntityCallbackDiscoverer {
|
||||
}
|
||||
|
||||
throw new IllegalStateException(
|
||||
String.format("%s does not define a callback method accepting %s and %s additional arguments.",
|
||||
String.format("%s does not define a callback method accepting %s and %s additional arguments",
|
||||
ClassUtils.getShortName(callbackType), ClassUtils.getShortName(entityType), args.length));
|
||||
}
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@ import org.springframework.lang.Nullable;
|
||||
* @author Graeme Rocher
|
||||
* @author Mark Paluch
|
||||
* @author Christoph Strobl
|
||||
* @author Johannes Englmeier
|
||||
*/
|
||||
public interface MappingContext<E extends PersistentEntity<?, P>, P extends PersistentProperty<P>> {
|
||||
|
||||
@@ -76,7 +77,7 @@ public interface MappingContext<E extends PersistentEntity<?, P>, P extends Pers
|
||||
return entity;
|
||||
}
|
||||
|
||||
throw new MappingException(String.format("Couldn't find PersistentEntity for type %s!", type));
|
||||
throw new MappingException(String.format("Couldn't find PersistentEntity for type %s", type));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -116,7 +117,7 @@ public interface MappingContext<E extends PersistentEntity<?, P>, P extends Pers
|
||||
return entity;
|
||||
}
|
||||
|
||||
throw new MappingException(String.format("Couldn't find PersistentEntity for type %s!", type));
|
||||
throw new MappingException(String.format("Couldn't find PersistentEntity for type %s", type));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -149,7 +150,7 @@ public interface MappingContext<E extends PersistentEntity<?, P>, P extends Pers
|
||||
return entity;
|
||||
}
|
||||
|
||||
throw new MappingException(String.format("Couldn't find PersistentEntity for property %s!", persistentProperty));
|
||||
throw new MappingException(String.format("Couldn't find PersistentEntity for property %s", persistentProperty));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -41,6 +41,7 @@ import org.springframework.util.Assert;
|
||||
* @author Oliver Gierke
|
||||
* @author Christoph Strobl
|
||||
* @author Mark Paluch
|
||||
* @author Johannes Englmeier
|
||||
* @since 1.8
|
||||
*/
|
||||
public class PersistentEntities implements Streamable<PersistentEntity<?, ? extends PersistentProperty<?>>> {
|
||||
@@ -117,7 +118,7 @@ public class PersistentEntities implements Streamable<PersistentEntity<?, ? exte
|
||||
|
||||
return getPersistentEntity(type).orElseThrow(() -> {
|
||||
return new MappingException(String.format(
|
||||
"Cannot get or create PersistentEntity for type %s! PersistentEntities knows about %s MappingContext instances and therefore cannot identify a single responsible one. Please configure the initialEntitySet through an entity scan using the base package in your configuration to pre initialize contexts.",
|
||||
"Cannot get or create PersistentEntity for type %s! PersistentEntities knows about %s MappingContext instances and therefore cannot identify a single responsible one. Please configure the initialEntitySet through an entity scan using the base package in your configuration to pre initialize contexts",
|
||||
type.getName(), contexts.size()));
|
||||
});
|
||||
}
|
||||
@@ -253,7 +254,7 @@ public class PersistentEntities implements Streamable<PersistentEntity<?, ? exte
|
||||
|
||||
String message = "Found multiple entities identified by " + type.getType() + ": ";
|
||||
message += entities.stream().map(it -> it.getType().getName()).collect(Collectors.joining(", "));
|
||||
message += "! Introduce dedicated unique identifier types or explicitly define the target type in @Reference!";
|
||||
message += "! Introduce dedicated unique identifier types or explicitly define the target type in @Reference";
|
||||
|
||||
throw new IllegalStateException(message);
|
||||
}
|
||||
|
||||
@@ -58,6 +58,7 @@ import org.springframework.util.StringUtils;
|
||||
* @author Thomas Darimont
|
||||
* @author Christoph Strobl
|
||||
* @author Mark Paluch
|
||||
* @author Johannes Englmeier
|
||||
*/
|
||||
public class BasicPersistentEntity<T, P extends PersistentProperty<P>> implements MutablePersistentEntity<T, P> {
|
||||
|
||||
@@ -206,7 +207,7 @@ public class BasicPersistentEntity<T, P extends PersistentProperty<P>> implement
|
||||
throw new MappingException(
|
||||
String.format(
|
||||
"Attempt to add version property %s but already have property %s registered "
|
||||
+ "as version. Check your mapping configuration!",
|
||||
+ "as version. Check your mapping configuration",
|
||||
property.getField(), versionProperty.getField()));
|
||||
}
|
||||
|
||||
@@ -236,7 +237,7 @@ public class BasicPersistentEntity<T, P extends PersistentProperty<P>> implement
|
||||
|
||||
if (idProperty != null) {
|
||||
throw new MappingException(String.format("Attempt to add id property %s but already have property %s registered "
|
||||
+ "as id. Check your mapping configuration!", property.getField(), idProperty.getField()));
|
||||
+ "as id. Check your mapping configuration ", property.getField(), idProperty.getField()));
|
||||
}
|
||||
|
||||
return property;
|
||||
@@ -520,11 +521,11 @@ public class BasicPersistentEntity<T, P extends PersistentProperty<P>> implement
|
||||
public int compare(@Nullable Association<P> left, @Nullable Association<P> right) {
|
||||
|
||||
if (left == null) {
|
||||
throw new IllegalArgumentException("Left argument must not be null!");
|
||||
throw new IllegalArgumentException("Left argument must not be null");
|
||||
}
|
||||
|
||||
if (right == null) {
|
||||
throw new IllegalArgumentException("Right argument must not be null!");
|
||||
throw new IllegalArgumentException("Right argument must not be null");
|
||||
}
|
||||
|
||||
return delegate.compare(left.getInverse(), right.getInverse());
|
||||
|
||||
@@ -39,6 +39,7 @@ import org.springframework.util.ReflectionUtils;
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
* @author Mark Paluch
|
||||
* @author Johannes Englmeier
|
||||
*/
|
||||
class BeanWrapper<T> implements PersistentPropertyAccessor<T> {
|
||||
|
||||
@@ -80,7 +81,7 @@ class BeanWrapper<T> implements PersistentPropertyAccessor<T> {
|
||||
}
|
||||
|
||||
throw new UnsupportedOperationException(
|
||||
String.format("Cannot set immutable property %s.%s!", property.getOwner().getName(), property.getName()));
|
||||
String.format("Cannot set immutable property %s.%s ", property.getOwner().getName(), property.getName()));
|
||||
}
|
||||
|
||||
if (!property.usePropertyAccess()) {
|
||||
@@ -98,7 +99,7 @@ class BeanWrapper<T> implements PersistentPropertyAccessor<T> {
|
||||
ReflectionUtils.invokeMethod(setter, bean, value);
|
||||
|
||||
} catch (IllegalStateException e) {
|
||||
throw new MappingException("Could not set object property!", e);
|
||||
throw new MappingException("Could not set object property", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,7 +139,7 @@ class BeanWrapper<T> implements PersistentPropertyAccessor<T> {
|
||||
|
||||
} catch (IllegalStateException e) {
|
||||
throw new MappingException(
|
||||
String.format("Could not read property %s of %s!", property.toString(), bean.toString()), e);
|
||||
String.format("Could not read property %s of %s", property.toString(), bean.toString()), e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -168,7 +169,7 @@ class BeanWrapper<T> implements PersistentPropertyAccessor<T> {
|
||||
|
||||
if (copy == null) {
|
||||
throw new UnsupportedOperationException(String.format(
|
||||
"Kotlin class %s has no .copy(…) method for property %s!", type.getName(), property.getName()));
|
||||
"Kotlin class %s has no .copy(…) method for property %s", type.getName(), property.getName()));
|
||||
}
|
||||
|
||||
return copy.callBy(getCallArgs(copy, property, bean, value));
|
||||
|
||||
@@ -64,6 +64,7 @@ import org.springframework.util.ReflectionUtils;
|
||||
* @author Oliver Gierke
|
||||
* @author Christoph Strobl
|
||||
* @author Jens Schauder
|
||||
* @author Johannes Englmeier
|
||||
* @since 1.13
|
||||
*/
|
||||
public class ClassGeneratingPropertyAccessorFactory implements PersistentPropertyAccessorFactory {
|
||||
@@ -775,7 +776,7 @@ public class ClassGeneratingPropertyAccessorFactory implements PersistentPropert
|
||||
visitGetPropertySwitch(entity, persistentProperties, internalClassName, mv);
|
||||
|
||||
mv.visitLabel(l1);
|
||||
visitThrowUnsupportedOperationException(mv, "No accessor to get property %s!");
|
||||
visitThrowUnsupportedOperationException(mv, "No accessor to get property %s");
|
||||
|
||||
mv.visitLocalVariable(THIS_REF, referenceName(internalClassName), null, l0, l1, 0);
|
||||
mv.visitLocalVariable("property", referenceName(PERSISTENT_PROPERTY),
|
||||
@@ -938,7 +939,7 @@ public class ClassGeneratingPropertyAccessorFactory implements PersistentPropert
|
||||
Label l1 = new Label();
|
||||
mv.visitLabel(l1);
|
||||
|
||||
visitThrowUnsupportedOperationException(mv, "No accessor to set property %s!");
|
||||
visitThrowUnsupportedOperationException(mv, "No accessor to set property %s");
|
||||
|
||||
mv.visitLocalVariable(THIS_REF, referenceName(internalClassName), null, l0, l1, 0);
|
||||
mv.visitLocalVariable("property", "Lorg/springframework/data/mapping/PersistentProperty;",
|
||||
|
||||
@@ -34,6 +34,7 @@ import org.springframework.util.Assert;
|
||||
*
|
||||
* @author Oliver Drotbohm
|
||||
* @author Mark Paluch
|
||||
* @author Johannes Englmeier
|
||||
* @since 2.3
|
||||
*/
|
||||
public class InstantiationAwarePropertyAccessor<T> implements PersistentPropertyAccessor<T> {
|
||||
@@ -98,7 +99,7 @@ public class InstantiationAwarePropertyAccessor<T> implements PersistentProperty
|
||||
|
||||
if (it.getName() == null) {
|
||||
throw new IllegalStateException(
|
||||
String.format("Cannot detect parameter names of copy creator of %s!", owner.getType()));
|
||||
String.format("Cannot detect parameter names of copy creator of %s", owner.getType()));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@ import org.springframework.lang.Nullable;
|
||||
*
|
||||
* @author Mark Paluch
|
||||
* @author Oliver Gierke
|
||||
* @author Johannes Englmeier
|
||||
* @since 2.0
|
||||
*/
|
||||
class KotlinClassGeneratingEntityInstantiator extends ClassGeneratingEntityInstantiator {
|
||||
@@ -205,7 +206,7 @@ class KotlinClassGeneratingEntityInstantiator extends ClassGeneratingEntityInsta
|
||||
@Nullable InstanceCreatorMetadata<P> entityCreator, ParameterValueProvider<P> provider) {
|
||||
|
||||
if (entityCreator == null) {
|
||||
throw new IllegalArgumentException("EntityCreator must not be null!");
|
||||
throw new IllegalArgumentException("EntityCreator must not be null");
|
||||
}
|
||||
|
||||
Object[] params = allocateArguments(synthetic.getParameterCount()
|
||||
|
||||
@@ -28,6 +28,7 @@ import org.springframework.util.ClassUtils;
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
* @author Mark Paluch
|
||||
* @author Johannes Englmeier
|
||||
* @soundtrack Scary Pockets - Crash Into Me (Dave Matthews Band Cover feat. Julia Nunes) -
|
||||
* https://www.youtube.com/watch?v=syGlBNVGEqU
|
||||
*/
|
||||
@@ -60,7 +61,7 @@ class PersistentEntityIsNewStrategy implements IsNewStrategy {
|
||||
if (!ClassUtils.isAssignable(Number.class, type)) {
|
||||
|
||||
throw new IllegalArgumentException(String
|
||||
.format("Only numeric primitives are supported as identifier / version field types! Got: %s.", valueType));
|
||||
.format("Only numeric primitives are supported as identifier / version field types! Got: %s", valueType));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -104,6 +105,6 @@ class PersistentEntityIsNewStrategy implements IsNewStrategy {
|
||||
}
|
||||
|
||||
throw new IllegalArgumentException(
|
||||
String.format("Could not determine whether %s is new! Unsupported identifier or version property!", entity));
|
||||
String.format("Could not determine whether %s is new! Unsupported identifier or version property", entity));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ import org.springframework.lang.Nullable;
|
||||
* expression evaluation.
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
* @author Johannes Englmeier
|
||||
*/
|
||||
public class PersistentEntityParameterValueProvider<P extends PersistentProperty<P>>
|
||||
implements ParameterValueProvider<P> {
|
||||
@@ -57,14 +58,14 @@ public class PersistentEntityParameterValueProvider<P extends PersistentProperty
|
||||
String name = parameter.getName();
|
||||
|
||||
if (name == null) {
|
||||
throw new MappingException(String.format("Parameter %s does not have a name!", parameter));
|
||||
throw new MappingException(String.format("Parameter %s does not have a name", parameter));
|
||||
}
|
||||
|
||||
P property = entity.getPersistentProperty(name);
|
||||
|
||||
if (property == null) {
|
||||
throw new MappingException(
|
||||
String.format("No property %s found on entity %s to bind constructor parameter to!", name, entity.getType()));
|
||||
String.format("No property %s found on entity %s to bind constructor parameter to", name, entity.getType()));
|
||||
}
|
||||
|
||||
return provider.getPropertyValue(property);
|
||||
|
||||
@@ -46,6 +46,7 @@ import org.springframework.util.Assert;
|
||||
* property, the nested property will be set on all collection elements and map values.
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
* @author Johannes Englmeier
|
||||
* @since 2.3
|
||||
* @soundtrack Ron Spielman - Nineth Song (Tip of My Tongue)
|
||||
*/
|
||||
@@ -249,7 +250,7 @@ class SimplePersistentPropertyPathAccessor<T> implements PersistentPropertyPathA
|
||||
}
|
||||
|
||||
if (!type.isInstance(value)) {
|
||||
throw new MappingException(String.format("Invalid property value type! Need %s but got %s!", //
|
||||
throw new MappingException(String.format("Invalid property value type! Need %s but got %s", //
|
||||
type.getName(), value.getClass().getName()));
|
||||
}
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ import org.springframework.util.Assert;
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
* @author Christoph Strobl
|
||||
* @author Johannes Englmeier
|
||||
* @soundtrack Benny Greb - Soulfood (Live)
|
||||
* @since 1.13
|
||||
*/
|
||||
@@ -47,7 +48,7 @@ public final class Accessor {
|
||||
PropertyDescriptor descriptor = BeanUtils.findPropertyForMethod(method);
|
||||
|
||||
if (descriptor == null) {
|
||||
throw new IllegalArgumentException(String.format("Invoked method %s is no accessor method!", method));
|
||||
throw new IllegalArgumentException(String.format("Invoked method %s is no accessor method", method));
|
||||
}
|
||||
|
||||
this.descriptor = descriptor;
|
||||
|
||||
@@ -40,6 +40,7 @@ import org.springframework.util.ReflectionUtils;
|
||||
* @author Oliver Gierke
|
||||
* @author Jens Schauder
|
||||
* @author Mark Paluch
|
||||
* @author Johannes Englmeier
|
||||
*/
|
||||
public class DefaultMethodInvokingMethodInterceptor implements MethodInterceptor {
|
||||
|
||||
@@ -114,7 +115,7 @@ public class DefaultMethodInvokingMethodInterceptor implements MethodInterceptor
|
||||
MethodHandle lookup(Method method) throws ReflectiveOperationException {
|
||||
|
||||
if (privateLookupIn == null) {
|
||||
throw new IllegalStateException("Could not obtain MethodHandles.privateLookupIn!");
|
||||
throw new IllegalStateException("Could not obtain MethodHandles.privateLookupIn");
|
||||
}
|
||||
|
||||
return doLookup(method, getLookup(method.getDeclaringClass(), privateLookupIn));
|
||||
@@ -149,7 +150,7 @@ public class DefaultMethodInvokingMethodInterceptor implements MethodInterceptor
|
||||
MethodHandle lookup(Method method) throws ReflectiveOperationException {
|
||||
|
||||
if (!isAvailable()) {
|
||||
throw new IllegalStateException("Could not obtain MethodHandles.lookup constructor!");
|
||||
throw new IllegalStateException("Could not obtain MethodHandles.lookup constructor");
|
||||
}
|
||||
|
||||
Constructor<Lookup> constructor = this.constructor.get();
|
||||
@@ -222,7 +223,7 @@ public class DefaultMethodInvokingMethodInterceptor implements MethodInterceptor
|
||||
}
|
||||
}
|
||||
|
||||
throw new IllegalStateException("No MethodHandleLookup available!");
|
||||
throw new IllegalStateException("No MethodHandleLookup available");
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -47,6 +47,7 @@ import org.springframework.util.ClassUtils;
|
||||
* @author Oliver Gierke
|
||||
* @author Christoph Strobl
|
||||
* @author Mark Paluch
|
||||
* @author Johannes Englmeier
|
||||
* @since 1.12
|
||||
*/
|
||||
class DefaultProjectionInformation implements ProjectionInformation {
|
||||
@@ -245,7 +246,7 @@ class DefaultProjectionInformation implements ProjectionInformation {
|
||||
.filter(it -> name.equals(it.getName())) //
|
||||
.findFirst()
|
||||
.orElseThrow(() -> new IllegalStateException(
|
||||
String.format("Did not find type %s in %s!", name, Arrays.toString(types))));
|
||||
String.format("Did not find type %s in %s", name, Arrays.toString(types))));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -29,6 +29,7 @@ import org.springframework.util.ReflectionUtils;
|
||||
* {@link MethodInterceptor} to support accessor methods to store and retrieve values from a {@link Map}.
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
* @author Johannes Englmeier
|
||||
* @since 1.10
|
||||
*/
|
||||
class MapAccessingMethodInterceptor implements MethodInterceptor {
|
||||
@@ -61,6 +62,6 @@ class MapAccessingMethodInterceptor implements MethodInterceptor {
|
||||
return null;
|
||||
}
|
||||
|
||||
throw new IllegalStateException("Should never get here!");
|
||||
throw new IllegalStateException("Should never get here");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,6 +45,7 @@ import org.springframework.util.ObjectUtils;
|
||||
* @author Oliver Gierke
|
||||
* @author Mark Paluch
|
||||
* @author Christoph Strobl
|
||||
* @author Johannes Englmeier
|
||||
* @since 1.10
|
||||
*/
|
||||
class ProjectingMethodInterceptor implements MethodInterceptor {
|
||||
@@ -108,7 +109,7 @@ class ProjectingMethodInterceptor implements MethodInterceptor {
|
||||
return getProjection(result, targetType);
|
||||
} else {
|
||||
throw new UnsupportedOperationException(
|
||||
String.format("Cannot project %s to %s. Target type is not an interface and no matching Converter found!",
|
||||
String.format("Cannot project %s to %s. Target type is not an interface and no matching Converter found",
|
||||
ClassUtils.getDescriptiveType(result), ClassUtils.getQualifiedName(targetType)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ import org.springframework.util.ReflectionUtils;
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
* @author Mark Paluch
|
||||
* @author Johannes Englmeier
|
||||
* @since 1.10
|
||||
*/
|
||||
class PropertyAccessingMethodInterceptor implements MethodInterceptor {
|
||||
@@ -62,7 +63,7 @@ class PropertyAccessingMethodInterceptor implements MethodInterceptor {
|
||||
PropertyDescriptor descriptor = BeanUtils.findPropertyForMethod(method);
|
||||
|
||||
if (descriptor == null) {
|
||||
throw new IllegalStateException("Invoked method is not a property accessor!");
|
||||
throw new IllegalStateException("Invoked method is not a property accessor");
|
||||
}
|
||||
|
||||
if (!isSetterMethod(method, descriptor)) {
|
||||
@@ -70,7 +71,7 @@ class PropertyAccessingMethodInterceptor implements MethodInterceptor {
|
||||
}
|
||||
|
||||
if (invocation.getArguments().length != 1) {
|
||||
throw new IllegalStateException("Invoked setter method requires exactly one argument!");
|
||||
throw new IllegalStateException("Invoked setter method requires exactly one argument");
|
||||
}
|
||||
|
||||
target.setPropertyValue(descriptor.getName(), invocation.getArguments()[0]);
|
||||
|
||||
@@ -47,6 +47,7 @@ import org.springframework.util.StringUtils;
|
||||
* @author Thomas Darimont
|
||||
* @author Christoph Strobl
|
||||
* @author Xeno Amess
|
||||
* @author Johannes Englmeier
|
||||
* @see 1.10
|
||||
*/
|
||||
class SpelEvaluatingMethodInterceptor implements MethodInterceptor {
|
||||
@@ -116,7 +117,7 @@ class SpelEvaluatingMethodInterceptor implements MethodInterceptor {
|
||||
}
|
||||
|
||||
if (!StringUtils.hasText(value.value())) {
|
||||
throw new IllegalStateException(String.format("@Value annotation on %s contains empty expression!", method));
|
||||
throw new IllegalStateException(String.format("@Value annotation on %s contains empty expression", method));
|
||||
}
|
||||
|
||||
expressions.put(method.hashCode(), parser.parseExpression(value.value(), PARSER_CONTEXT));
|
||||
|
||||
@@ -60,6 +60,7 @@ import com.querydsl.core.types.Path;
|
||||
* @author Christoph Strobl
|
||||
* @author Oliver Gierke
|
||||
* @author Mark Paluch
|
||||
* @author Johannes Englmeier
|
||||
* @since 1.11
|
||||
* @see QuerydslBinderCustomizer
|
||||
*/
|
||||
@@ -357,7 +358,7 @@ public class QuerydslBindings {
|
||||
Path<?> rootPath = path.getMetadata().getRootPath();
|
||||
|
||||
if (rootPath == null) {
|
||||
throw new IllegalStateException(String.format("Couldn't find root path on path %s!", path));
|
||||
throw new IllegalStateException(String.format("Couldn't find root path on path %s", path));
|
||||
}
|
||||
|
||||
return path.toString().substring(rootPath.getMetadata().getName().length() + 1);
|
||||
|
||||
@@ -38,6 +38,7 @@ import com.querydsl.core.types.dsl.SimpleExpression;
|
||||
* @author Christoph Strobl
|
||||
* @author Oliver Gierke
|
||||
* @author Colin Gao
|
||||
* @author Johannes Englmeier
|
||||
* @since 1.11
|
||||
*/
|
||||
class QuerydslDefaultBinding implements MultiValueBinding<Path<? extends Object>, Object> {
|
||||
@@ -78,6 +79,6 @@ class QuerydslDefaultBinding implements MultiValueBinding<Path<? extends Object>
|
||||
}
|
||||
|
||||
throw new IllegalArgumentException(
|
||||
String.format("Cannot create predicate for path '%s' with type '%s'.", path, path.getMetadata().getPathType()));
|
||||
String.format("Cannot create predicate for path '%s' with type '%s'", path, path.getMetadata().getPathType()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ import com.querydsl.core.types.Path;
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
* @author Mark Paluch
|
||||
* @author Johannes Englmeier
|
||||
* @since 1.13
|
||||
*/
|
||||
class QuerydslPathInformation implements PathInformation {
|
||||
@@ -60,7 +61,7 @@ class QuerydslPathInformation implements PathInformation {
|
||||
Path<?> parent = path.getMetadata().getParent();
|
||||
|
||||
if (parent == null) {
|
||||
throw new IllegalStateException(String.format("Could not obtain metadata for parent node of %s!", path));
|
||||
throw new IllegalStateException(String.format("Could not obtain metadata for parent node of %s", path));
|
||||
}
|
||||
|
||||
return parent.getType();
|
||||
|
||||
@@ -47,6 +47,7 @@ import com.querydsl.core.types.Predicate;
|
||||
* @author Christoph Strobl
|
||||
* @author Oliver Gierke
|
||||
* @author Mark Paluch
|
||||
* @author Johannes Englmeier
|
||||
* @since 1.11
|
||||
*/
|
||||
public class QuerydslPredicateBuilder {
|
||||
@@ -224,7 +225,7 @@ public class QuerydslPredicateBuilder {
|
||||
.nested(new Property(owningType, descriptor.getReadMethod(), descriptor.getWriteMethod(), leafProperty), 0);
|
||||
|
||||
if (result == null) {
|
||||
throw new IllegalStateException(String.format("Could not obtain TypeDescriptor for PathInformation %s!", path));
|
||||
throw new IllegalStateException(String.format("Could not obtain TypeDescriptor for PathInformation %s", path));
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
@@ -63,6 +63,7 @@ import org.springframework.util.StringUtils;
|
||||
* @author Christoph Strobl
|
||||
* @author Ariel Carrera
|
||||
* @author Xeno Amess
|
||||
* @author Johannes Englmeier
|
||||
*/
|
||||
public abstract class CdiRepositoryBean<T> implements Bean<T>, PassivationCapable {
|
||||
|
||||
@@ -108,7 +109,7 @@ public abstract class CdiRepositoryBean<T> implements Bean<T>, PassivationCapabl
|
||||
this.repositoryType = repositoryType;
|
||||
this.beanManager = beanManager;
|
||||
this.context = new CdiRepositoryContext(getClass().getClassLoader(), detector
|
||||
.orElseThrow(() -> new IllegalArgumentException("CustomRepositoryImplementationDetector must be present!")));
|
||||
.orElseThrow(() -> new IllegalArgumentException("CustomRepositoryImplementationDetector must be present")));
|
||||
this.passivationId = createPassivationId(qualifiers, repositoryType);
|
||||
}
|
||||
|
||||
@@ -356,7 +357,7 @@ public abstract class CdiRepositoryBean<T> implements Bean<T>, PassivationCapabl
|
||||
return Arrays.stream(repositoryType.getInterfaces()) //
|
||||
.filter(it -> it.getName().equals(interfaceName)) //
|
||||
.findFirst() //
|
||||
.orElseThrow(() -> new IllegalArgumentException(String.format("Did not find type %s in %s!", interfaceName,
|
||||
.orElseThrow(() -> new IllegalArgumentException(String.format("Did not find type %s in %s", interfaceName,
|
||||
Arrays.asList(repositoryType.getInterfaces()))));
|
||||
}
|
||||
|
||||
|
||||
@@ -57,6 +57,7 @@ import org.springframework.util.StringUtils;
|
||||
* @author Peter Rietzler
|
||||
* @author Jens Schauder
|
||||
* @author Mark Paluch
|
||||
* @author Johannes Englmeier
|
||||
*/
|
||||
public class AnnotationRepositoryConfigurationSource extends RepositoryConfigurationSourceSupport {
|
||||
|
||||
@@ -118,7 +119,7 @@ public class AnnotationRepositoryConfigurationSource extends RepositoryConfigura
|
||||
Map<String, Object> annotationAttributes = metadata.getAnnotationAttributes(annotation.getName());
|
||||
|
||||
if (annotationAttributes == null) {
|
||||
throw new IllegalStateException(String.format("Unable to obtain annotation attributes for %s!", annotation));
|
||||
throw new IllegalStateException(String.format("Unable to obtain annotation attributes for %s", annotation));
|
||||
}
|
||||
|
||||
this.attributes = new AnnotationAttributes(annotationAttributes);
|
||||
@@ -228,7 +229,7 @@ public class AnnotationRepositoryConfigurationSource extends RepositoryConfigura
|
||||
public <T> Optional<T> getAttribute(String name, Class<T> type) {
|
||||
|
||||
if (!attributes.containsKey(name)) {
|
||||
throw new IllegalArgumentException(String.format("No attribute named %s found!", name));
|
||||
throw new IllegalArgumentException(String.format("No attribute named %s found", name));
|
||||
}
|
||||
|
||||
Object value = attributes.get(name);
|
||||
@@ -238,7 +239,7 @@ public class AnnotationRepositoryConfigurationSource extends RepositoryConfigura
|
||||
}
|
||||
|
||||
Assert.isInstanceOf(type, value,
|
||||
() -> String.format("Attribute value for %s is of type %s but was expected to be of type %s!", name,
|
||||
() -> String.format("Attribute value for %s is of type %s but was expected to be of type %s", name,
|
||||
value.getClass(), type));
|
||||
|
||||
Object result = value instanceof String //
|
||||
|
||||
@@ -34,6 +34,7 @@ import org.springframework.util.StringUtils;
|
||||
* @author Oliver Gierke
|
||||
* @author Jens Schauder
|
||||
* @author Mark Paluch
|
||||
* @author Johannes Englmeier
|
||||
*/
|
||||
public class DefaultRepositoryConfiguration<T extends RepositoryConfigurationSource>
|
||||
implements RepositoryConfiguration<T> {
|
||||
@@ -55,7 +56,7 @@ public class DefaultRepositoryConfiguration<T extends RepositoryConfigurationSou
|
||||
|
||||
public String getBeanId() {
|
||||
return StringUtils.uncapitalize(ClassUtils.getShortName(getRepositoryBaseClassName().orElseThrow(
|
||||
() -> new IllegalStateException("Can't create bean identifier without a repository base class defined!"))));
|
||||
() -> new IllegalStateException("Can't create bean identifier without a repository base class defined"))));
|
||||
}
|
||||
|
||||
public Object getQueryLookupStrategyKey() {
|
||||
|
||||
@@ -31,6 +31,7 @@ import org.springframework.util.Assert;
|
||||
*
|
||||
* @author Mark Paluch
|
||||
* @author Oliver Gierke
|
||||
* @author Johannes Englmeier
|
||||
* @since 2.1
|
||||
*/
|
||||
public class FragmentMetadata {
|
||||
@@ -76,7 +77,7 @@ public class FragmentMetadata {
|
||||
try {
|
||||
return factory.getMetadataReader(className).getAnnotationMetadata();
|
||||
} catch (IOException e) {
|
||||
throw new BeanDefinitionStoreException(String.format("Cannot parse %s metadata.", className), e);
|
||||
throw new BeanDefinitionStoreException(String.format("Cannot parse %s metadata", className), e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,7 +86,7 @@ public class FragmentMetadata {
|
||||
try {
|
||||
return factory.getMetadataReader(className).getClassMetadata();
|
||||
} catch (IOException e) {
|
||||
throw new BeanDefinitionStoreException(String.format("Cannot parse %s metadata.", className), e);
|
||||
throw new BeanDefinitionStoreException(String.format("Cannot parse %s metadata", className), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ import org.springframework.util.ClassUtils;
|
||||
* Expresses configuration to be used to detect implementation classes for repositories and repository fragments.
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
* @author Johannes Englmeier
|
||||
* @since 2.1
|
||||
*/
|
||||
public interface ImplementationDetectionConfiguration {
|
||||
@@ -73,7 +74,7 @@ public interface ImplementationDetectionConfiguration {
|
||||
String beanName = definition.getBeanClassName();
|
||||
|
||||
if (beanName == null) {
|
||||
throw new IllegalStateException("Cannot generate bean name for BeanDefinition without bean class name!");
|
||||
throw new IllegalStateException("Cannot generate bean name for BeanDefinition without bean class name");
|
||||
}
|
||||
|
||||
return Introspector.decapitalize(ClassUtils.getShortName(beanName));
|
||||
|
||||
@@ -33,6 +33,7 @@ import org.springframework.util.ClassUtils;
|
||||
* @author Oliver Gierke
|
||||
* @author Jens Schauder
|
||||
* @author Mark Paluch
|
||||
* @author Johannes Englmeier
|
||||
*/
|
||||
class RepositoryBeanNameGenerator {
|
||||
|
||||
@@ -91,7 +92,7 @@ class RepositoryBeanNameGenerator {
|
||||
|
||||
if (argumentValue == null) {
|
||||
throw new IllegalStateException(
|
||||
String.format("Failed to obtain first constructor parameter value of BeanDefinition %s!", beanDefinition));
|
||||
String.format("Failed to obtain first constructor parameter value of BeanDefinition %s", beanDefinition));
|
||||
}
|
||||
|
||||
Object value = argumentValue.getValue();
|
||||
@@ -99,7 +100,7 @@ class RepositoryBeanNameGenerator {
|
||||
if (value == null) {
|
||||
|
||||
throw new IllegalStateException(
|
||||
String.format("Value of first constructor parameter value of BeanDefinition %s is null!", beanDefinition));
|
||||
String.format("Value of first constructor parameter value of BeanDefinition %s is null", beanDefinition));
|
||||
|
||||
} else if (value instanceof Class<?>) {
|
||||
|
||||
|
||||
@@ -50,6 +50,7 @@ import org.springframework.util.StringUtils;
|
||||
* @author Oliver Gierke
|
||||
* @author Mark Paluch
|
||||
* @author Christoph Strobl
|
||||
* @author Johannes Englmeier
|
||||
*/
|
||||
public abstract class RepositoryConfigurationExtensionSupport implements RepositoryConfigurationExtension {
|
||||
|
||||
@@ -333,7 +334,7 @@ public abstract class RepositoryConfigurationExtensionSupport implements Reposit
|
||||
|
||||
if (metadata.isReactiveRepository()) {
|
||||
throw new InvalidDataAccessApiUsageException(
|
||||
String.format("Reactive Repositories are not supported by %s. Offending repository is %s!", getModuleName(),
|
||||
String.format("Reactive Repositories are not supported by %s. Offending repository is %s", getModuleName(),
|
||||
metadata.getRepositoryInterface().getName()));
|
||||
}
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ import org.springframework.util.Assert;
|
||||
* @author Peter Rietzler
|
||||
* @author Jens Schauder
|
||||
* @author Mark Paluch
|
||||
* @author Johannes Englmeier
|
||||
*/
|
||||
public interface RepositoryConfigurationSource {
|
||||
|
||||
@@ -126,7 +127,7 @@ public interface RepositoryConfigurationSource {
|
||||
Assert.hasText(name, "Attribute name must not be null or empty!");
|
||||
|
||||
return getAttribute(name, type)
|
||||
.orElseThrow(() -> new IllegalArgumentException(String.format("No attribute named %s found!", name)));
|
||||
.orElseThrow(() -> new IllegalArgumentException(String.format("No attribute named %s found", name)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -31,6 +31,7 @@ import org.w3c.dom.Element;
|
||||
* {@link BeanDefinitionParser} to parse repository initializers.
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
* @author Johannes Englmeier
|
||||
*/
|
||||
public class ResourceReaderRepositoryPopulatorBeanDefinitionParser extends AbstractSingleBeanDefinitionParser {
|
||||
|
||||
@@ -46,7 +47,7 @@ public class ResourceReaderRepositoryPopulatorBeanDefinitionParser extends Abstr
|
||||
return Jackson2RepositoryPopulatorFactoryBean.class.getName();
|
||||
}
|
||||
|
||||
throw new IllegalStateException("Unsupported populator type " + name + "!");
|
||||
throw new IllegalStateException("Unsupported populator type " + name);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -27,6 +27,7 @@ import java.util.stream.Collectors;
|
||||
*
|
||||
* @author Jens Schauder
|
||||
* @author Oliver Gierke
|
||||
* @author Johannes Englmeier
|
||||
* @since 2.0
|
||||
*/
|
||||
class SelectionSet<T> {
|
||||
@@ -82,7 +83,7 @@ class SelectionSet<T> {
|
||||
if (c.isEmpty()) {
|
||||
return Optional.empty();
|
||||
} else {
|
||||
throw new IllegalStateException("More then one element in collection.");
|
||||
throw new IllegalStateException("More then one element in collection");
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ import org.springframework.util.Assert;
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
* @author Mark Paluch
|
||||
* @author Johannes Englmeier
|
||||
* @see org.springframework.data.repository.core.support.PersistentEntityInformation
|
||||
*/
|
||||
public interface EntityInformation<T, ID> extends EntityMetadata<T> {
|
||||
@@ -62,7 +63,7 @@ public interface EntityInformation<T, ID> extends EntityMetadata<T> {
|
||||
return id;
|
||||
}
|
||||
|
||||
throw new IllegalArgumentException(String.format("Could not obtain required identifier from entity %s!", entity));
|
||||
throw new IllegalArgumentException(String.format("Could not obtain required identifier from entity %s", entity));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -26,6 +26,7 @@ import org.springframework.util.Assert;
|
||||
* @author Oliver Gierke
|
||||
* @author Nick Williams
|
||||
* @author Mark Paluch
|
||||
* @author Johannes Englmeier
|
||||
*/
|
||||
public abstract class AbstractEntityInformation<T, ID> implements EntityInformation<T, ID> {
|
||||
|
||||
@@ -51,7 +52,7 @@ public abstract class AbstractEntityInformation<T, ID> implements EntityInformat
|
||||
return ((Number) id).longValue() == 0L;
|
||||
}
|
||||
|
||||
throw new IllegalArgumentException(String.format("Unsupported primitive id type %s!", idType));
|
||||
throw new IllegalArgumentException(String.format("Unsupported primitive id type %s", idType));
|
||||
}
|
||||
|
||||
public Class<T> getJavaType() {
|
||||
|
||||
@@ -32,6 +32,7 @@ import org.springframework.util.Assert;
|
||||
* @author Thomas Darimont
|
||||
* @author Xeno Amess
|
||||
* @author Alessandro Nistico
|
||||
* @author Johannes Englmeier
|
||||
*/
|
||||
public class AnnotationRepositoryMetadata extends AbstractRepositoryMetadata {
|
||||
|
||||
@@ -74,7 +75,7 @@ public class AnnotationRepositoryMetadata extends AbstractRepositoryMetadata {
|
||||
RepositoryDefinition annotation = AnnotationUtils.findAnnotation(repositoryInterface, RepositoryDefinition.class);
|
||||
|
||||
if ((annotation == null) || (extractor.apply(annotation) == null)) {
|
||||
throw new IllegalArgumentException(String.format("Could not resolve domain type of %s!", repositoryInterface));
|
||||
throw new IllegalArgumentException(String.format("Could not resolve domain type of %s", repositoryInterface));
|
||||
}
|
||||
|
||||
return ClassTypeInformation.from(extractor.apply(annotation));
|
||||
|
||||
@@ -40,6 +40,7 @@ import org.springframework.util.ObjectUtils;
|
||||
* Supports Kotlin nullability markers and JSR-305 Non-null annotations.
|
||||
*
|
||||
* @author Mark Paluch
|
||||
* @author Johannes Englmeier
|
||||
* @since 2.0
|
||||
* @see org.springframework.lang.NonNull
|
||||
* @see ReflectionUtils#isNullable(MethodParameter)
|
||||
@@ -86,7 +87,7 @@ public class MethodInvocationValidator implements MethodInterceptor {
|
||||
|
||||
if (arguments.length < i || arguments[i] == null) {
|
||||
throw new IllegalArgumentException(
|
||||
String.format("Parameter %s in %s.%s must not be null!", nullability.getMethodParameterName(i),
|
||||
String.format("Parameter %s in %s.%s must not be null", nullability.getMethodParameterName(i),
|
||||
ClassUtils.getShortName(method.getDeclaringClass()), method.getName()));
|
||||
}
|
||||
}
|
||||
@@ -94,7 +95,7 @@ public class MethodInvocationValidator implements MethodInterceptor {
|
||||
Object result = invocation.proceed();
|
||||
|
||||
if (result == null && !nullability.isNullableReturn()) {
|
||||
throw new EmptyResultDataAccessException("Result must not be null!", 1);
|
||||
throw new EmptyResultDataAccessException("Result must not be null", 1);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
@@ -26,6 +26,7 @@ import org.springframework.util.Assert;
|
||||
* repository proxy.
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
* @author Johannes Englmeier
|
||||
*/
|
||||
public class PersistenceExceptionTranslationRepositoryProxyPostProcessor implements RepositoryProxyPostProcessor {
|
||||
|
||||
@@ -39,7 +40,7 @@ public class PersistenceExceptionTranslationRepositoryProxyPostProcessor impleme
|
||||
*/
|
||||
public PersistenceExceptionTranslationRepositoryProxyPostProcessor(ListableBeanFactory beanFactory) {
|
||||
|
||||
Assert.notNull(beanFactory, "BeanFactory must not be null!");
|
||||
Assert.notNull(beanFactory, "BeanFactory must not be null");
|
||||
|
||||
this.interceptor = new PersistenceExceptionTranslationInterceptor();
|
||||
this.interceptor.setBeanFactory(beanFactory);
|
||||
|
||||
@@ -47,6 +47,7 @@ import org.springframework.util.ConcurrentReferenceHashMap;
|
||||
* @author Mark Paluch
|
||||
* @author Christoph Strobl
|
||||
* @author John Blum
|
||||
* @author Johannes Englmeier
|
||||
*/
|
||||
class QueryExecutorMethodInterceptor implements MethodInterceptor {
|
||||
|
||||
@@ -79,7 +80,7 @@ class QueryExecutorMethodInterceptor implements MethodInterceptor {
|
||||
|
||||
throw new IllegalStateException("You have defined query methods in the repository"
|
||||
+ " but do not have any query lookup strategy defined."
|
||||
+ " The infrastructure apparently does not support query methods!");
|
||||
+ " The infrastructure apparently does not support query methods");
|
||||
}
|
||||
|
||||
this.queries = queryLookupStrategy //
|
||||
|
||||
@@ -34,6 +34,7 @@ import org.springframework.util.ClassUtils;
|
||||
*
|
||||
* @author Mark Paluch
|
||||
* @author Oliver Gierke
|
||||
* @author Johannes Englmeier
|
||||
* @since 2.0
|
||||
*/
|
||||
public abstract class ReactiveRepositoryFactorySupport extends RepositoryFactorySupport {
|
||||
@@ -44,7 +45,7 @@ public abstract class ReactiveRepositoryFactorySupport extends RepositoryFactory
|
||||
if (!ReactiveWrappers.isAvailable()) {
|
||||
|
||||
throw new InvalidDataAccessApiUsageException(
|
||||
String.format("Cannot implement repository %s without reactive library support.",
|
||||
String.format("Cannot implement repository %s without reactive library support",
|
||||
repositoryMetadata.getRepositoryInterface().getName()));
|
||||
}
|
||||
|
||||
@@ -94,7 +95,7 @@ public abstract class ReactiveRepositoryFactorySupport extends RepositoryFactory
|
||||
&& !ReactiveWrapperConverters.supports(method.getReturnType())) {
|
||||
|
||||
throw new InvalidDataAccessApiUsageException(
|
||||
String.format("No reactive type converter found for type %s used in %s, method %s.",
|
||||
String.format("No reactive type converter found for type %s used in %s, method %s",
|
||||
method.getReturnType().getName(), method.getDeclaringClass().getName(), method));
|
||||
}
|
||||
|
||||
@@ -104,7 +105,7 @@ public abstract class ReactiveRepositoryFactorySupport extends RepositoryFactory
|
||||
.filter(parameterType -> !ReactiveWrapperConverters.supports(parameterType)) //
|
||||
.forEach(parameterType -> {
|
||||
throw new InvalidDataAccessApiUsageException(
|
||||
String.format("No reactive type converter found for type %s used in %s, method %s.",
|
||||
String.format("No reactive type converter found for type %s used in %s, method %s",
|
||||
parameterType.getName(), method.getDeclaringClass().getName(), method));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -59,6 +59,7 @@ import org.springframework.util.ReflectionUtils;
|
||||
*
|
||||
* @author Mark Paluch
|
||||
* @author Christoph Strobl
|
||||
* @author Johannes Englmeier
|
||||
* @soundtrack Masterboy - Anybody (Fj Gauder Mix)
|
||||
* @since 2.0
|
||||
* @see RepositoryFragment
|
||||
@@ -317,7 +318,7 @@ public class RepositoryComposition {
|
||||
fragments.stream().forEach(it -> it.getImplementation() //
|
||||
.orElseThrow(() -> {
|
||||
Class<?> repositoryInterface = metadata != null ? metadata.getRepositoryInterface() : Object.class;
|
||||
return new FragmentNotImplementedException(String.format("Fragment %s used in %s has no implementation.",
|
||||
return new FragmentNotImplementedException(String.format("Fragment %s used in %s has no implementation",
|
||||
ClassUtils.getQualifiedName(it.getSignatureContributor()),
|
||||
ClassUtils.getQualifiedName(repositoryInterface)), repositoryInterface, it);
|
||||
}));
|
||||
|
||||
@@ -53,6 +53,7 @@ import org.springframework.util.Assert;
|
||||
* @author Oliver Gierke
|
||||
* @author Thomas Darimont
|
||||
* @author Mark Paluch
|
||||
* @author Johannes Englmeier
|
||||
*/
|
||||
public abstract class RepositoryFactoryBeanSupport<T extends Repository<S, ID>, S, ID>
|
||||
implements InitializingBean, RepositoryFactoryInformation<S, ID>, FactoryBean<T>, BeanClassLoaderAware,
|
||||
@@ -225,7 +226,7 @@ public abstract class RepositoryFactoryBeanSupport<T extends Repository<S, ID>,
|
||||
|
||||
public PersistentEntity<?, ?> getPersistentEntity() {
|
||||
|
||||
return mappingContext.orElseThrow(() -> new IllegalStateException("No MappingContext available!"))
|
||||
return mappingContext.orElseThrow(() -> new IllegalStateException("No MappingContext available"))
|
||||
.getRequiredPersistentEntity(repositoryMetadata.getDomainType());
|
||||
}
|
||||
|
||||
|
||||
@@ -80,6 +80,7 @@ import org.springframework.util.ObjectUtils;
|
||||
* @author Christoph Strobl
|
||||
* @author Jens Schauder
|
||||
* @author John Blum
|
||||
* @author Johannes Englmeier
|
||||
*/
|
||||
public abstract class RepositoryFactorySupport implements BeanClassLoaderAware, BeanFactoryAware {
|
||||
|
||||
@@ -629,7 +630,7 @@ public abstract class RepositoryFactorySupport implements BeanClassLoaderAware,
|
||||
org.springframework.data.repository.util.ClassUtils.unwrapReflectionException(e);
|
||||
}
|
||||
|
||||
throw new IllegalStateException("Should not occur!");
|
||||
throw new IllegalStateException("Should not occur");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -771,7 +772,7 @@ public abstract class RepositoryFactorySupport implements BeanClassLoaderAware,
|
||||
if (composition.isEmpty()) {
|
||||
|
||||
throw new IncompleteRepositoryCompositionException(
|
||||
String.format("You have custom methods in %s but have not provided a custom implementation!",
|
||||
String.format("You have custom methods in %s but have not provided a custom implementation",
|
||||
org.springframework.util.ClassUtils.getQualifiedName(repositoryInterface)),
|
||||
repositoryInterface);
|
||||
}
|
||||
@@ -788,7 +789,7 @@ public abstract class RepositoryFactorySupport implements BeanClassLoaderAware,
|
||||
|
||||
if (!containsFragmentImplementation(composition, executorInterface)) {
|
||||
throw new UnsupportedFragmentException(
|
||||
String.format("Repository %s implements %s but %s does not support %s!",
|
||||
String.format("Repository %s implements %s but %s does not support %s",
|
||||
ClassUtils.getQualifiedName(repositoryInterface), ClassUtils.getQualifiedName(executorInterface),
|
||||
ClassUtils.getShortName(source), entry.getValue()),
|
||||
repositoryInterface, executorInterface);
|
||||
|
||||
@@ -33,6 +33,7 @@ import org.springframework.util.Assert;
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
* @author Christoph Strobl
|
||||
* @author Johannes Englmeier
|
||||
*/
|
||||
public abstract class AbstractRepositoryPopulatorFactoryBean
|
||||
extends AbstractFactoryBean<ResourceReaderRepositoryPopulator>
|
||||
@@ -83,7 +84,7 @@ public abstract class AbstractRepositoryPopulatorFactoryBean
|
||||
RepositoryPopulator populator = this.populator;
|
||||
|
||||
if (populator == null) {
|
||||
throw new IllegalStateException("RepositoryPopulator was not properly initialized!");
|
||||
throw new IllegalStateException("RepositoryPopulator was not properly initialized");
|
||||
}
|
||||
|
||||
if (event.getApplicationContext().equals(context)) {
|
||||
|
||||
@@ -37,6 +37,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
* @author Oliver Gierke
|
||||
* @author Christoph Strobl
|
||||
* @author Mark Paluch
|
||||
* @author Johannes Englmeier
|
||||
* @since 1.6
|
||||
*/
|
||||
public class Jackson2ResourceReader implements ResourceReader {
|
||||
@@ -112,7 +113,7 @@ public class Jackson2ResourceReader implements ResourceReader {
|
||||
JsonNode typeNode = node.findValue(typeKey);
|
||||
|
||||
if (typeNode == null) {
|
||||
throw new IllegalArgumentException(String.format("Could not find type for type key '%s'!", typeKey));
|
||||
throw new IllegalArgumentException(String.format("Could not find type for type key '%s'", typeKey));
|
||||
}
|
||||
|
||||
String typeName = typeNode.asText();
|
||||
|
||||
@@ -25,6 +25,7 @@ import org.springframework.util.Assert;
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
* @author Christoph Strobl
|
||||
* @author Johannes Englmeier
|
||||
*/
|
||||
public class UnmarshallerRepositoryPopulatorFactoryBean extends AbstractRepositoryPopulatorFactoryBean {
|
||||
|
||||
@@ -45,7 +46,7 @@ public class UnmarshallerRepositoryPopulatorFactoryBean extends AbstractReposito
|
||||
Unmarshaller unmarshaller = this.unmarshaller;
|
||||
|
||||
if (unmarshaller == null) {
|
||||
throw new IllegalStateException("No Unmarshaller configured!");
|
||||
throw new IllegalStateException("No Unmarshaller configured");
|
||||
}
|
||||
|
||||
return new UnmarshallingResourceReader(unmarshaller);
|
||||
|
||||
@@ -36,6 +36,7 @@ import org.springframework.util.StringUtils;
|
||||
* @author Oliver Gierke
|
||||
* @author Christoph Strobl
|
||||
* @author Jens Schauder
|
||||
* @author Johannes Englmeier
|
||||
* @since 1.9
|
||||
*/
|
||||
public class ExtensionAwareQueryMethodEvaluationContextProvider implements QueryMethodEvaluationContextProvider {
|
||||
@@ -110,7 +111,7 @@ public class ExtensionAwareQueryMethodEvaluationContextProvider implements Query
|
||||
parameters.stream()//
|
||||
.filter(Parameter::isNamedParameter)//
|
||||
.forEach(it -> variables.put(//
|
||||
it.getName().orElseThrow(() -> new IllegalStateException("Should never occur!")), //
|
||||
it.getName().orElseThrow(() -> new IllegalStateException("Should never occur")), //
|
||||
arguments[it.getIndex()]));
|
||||
|
||||
return variables;
|
||||
|
||||
@@ -43,6 +43,7 @@ import org.springframework.util.Assert;
|
||||
* @author Mark Paluch
|
||||
* @author Jens Schauder
|
||||
* @author Greg Turnquist
|
||||
* @author Johannes Englmeier
|
||||
*/
|
||||
public class Parameter {
|
||||
|
||||
@@ -213,7 +214,7 @@ public class Parameter {
|
||||
Method method = parameter.getMethod();
|
||||
|
||||
if (method == null) {
|
||||
throw new IllegalStateException(String.format("Method parameter %s is not backed by a method!", parameter));
|
||||
throw new IllegalStateException(String.format("Method parameter %s is not backed by a method", parameter));
|
||||
}
|
||||
|
||||
ClassTypeInformation<?> ownerType = ClassTypeInformation.from(parameter.getDeclaringClass());
|
||||
|
||||
@@ -37,6 +37,7 @@ import org.springframework.util.Assert;
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
* @author Christoph Strobl
|
||||
* @author Johannes Englmeier
|
||||
*/
|
||||
public abstract class Parameters<S extends Parameters<S, T>, T extends Parameter> implements Streamable<T> {
|
||||
|
||||
@@ -236,7 +237,7 @@ public abstract class Parameters<S extends Parameters<S, T>, T extends Parameter
|
||||
return parameters.get(index);
|
||||
} catch (IndexOutOfBoundsException e) {
|
||||
throw new ParameterOutOfBoundsException(
|
||||
"Invalid parameter index! You seem to have declared too little query method parameters!", e);
|
||||
"Invalid parameter index! You seem to have declared too little query method parameters", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -44,6 +44,7 @@ import org.springframework.util.Assert;
|
||||
* @author Christoph Strobl
|
||||
* @author Maciek Opała
|
||||
* @author Mark Paluch
|
||||
* @author Johannes Englmeier
|
||||
*/
|
||||
public class QueryMethod {
|
||||
|
||||
@@ -285,7 +286,7 @@ public class QueryMethod {
|
||||
|
||||
if (componentType == null) {
|
||||
throw new IllegalStateException(
|
||||
String.format("Couldn't find component type for return value of method %s!", method));
|
||||
String.format("Couldn't find component type for return value of method %s", method));
|
||||
}
|
||||
|
||||
return componentType.getType();
|
||||
@@ -311,6 +312,6 @@ public class QueryMethod {
|
||||
}
|
||||
}
|
||||
|
||||
throw new IllegalStateException("Method has to have one of the following return types! " + types);
|
||||
throw new IllegalStateException("Method has to have one of the following return types" + types);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ import org.springframework.util.Assert;
|
||||
* @author Oliver Gierke
|
||||
* @author Mark Paluch
|
||||
* @author Christoph Strobl
|
||||
* @author Johannes Englmeier
|
||||
*/
|
||||
public abstract class AbstractQueryCreator<T, S> {
|
||||
|
||||
@@ -112,7 +113,7 @@ public abstract class AbstractQueryCreator<T, S> {
|
||||
Iterator<Part> parts = node.iterator();
|
||||
|
||||
if (!parts.hasNext()) {
|
||||
throw new IllegalStateException(String.format("No part found in PartTree %s!", tree));
|
||||
throw new IllegalStateException(String.format("No part found in PartTree %s", tree));
|
||||
}
|
||||
|
||||
S criteria = create(parts.next(), iterator);
|
||||
|
||||
@@ -42,6 +42,7 @@ import org.springframework.util.StringUtils;
|
||||
* @author Christoph Strobl
|
||||
* @author Mark Paluch
|
||||
* @author Shaun Chyxion
|
||||
* @author Johannes Englmeier
|
||||
*/
|
||||
public class PartTree implements Streamable<OrPart> {
|
||||
|
||||
@@ -363,7 +364,7 @@ public class PartTree implements Streamable<OrPart> {
|
||||
String[] parts = split(detectAndSetAllIgnoreCase(predicate), ORDER_BY);
|
||||
|
||||
if (parts.length > 2) {
|
||||
throw new IllegalArgumentException("OrderBy must not be used more than once in a method name!");
|
||||
throw new IllegalArgumentException("OrderBy must not be used more than once in a method name");
|
||||
}
|
||||
|
||||
this.nodes = Arrays.stream(split(parts[0], "Or")) //
|
||||
|
||||
@@ -43,6 +43,7 @@ import org.springframework.util.StringUtils;
|
||||
* @author Oliver Gierke
|
||||
* @author Thomas Darimont
|
||||
* @author Alessandro Nistico
|
||||
* @author Johannes Englmeier
|
||||
*/
|
||||
public class DomainClassConverter<T extends ConversionService & ConverterRegistry>
|
||||
implements ConditionalGenericConverter, ApplicationContextAware {
|
||||
@@ -178,7 +179,7 @@ public class DomainClassConverter<T extends ConversionService & ConverterRegistr
|
||||
return sourceType.equals(idTypeDescriptor)
|
||||
|| conversionService.canConvert(sourceType, idTypeDescriptor);
|
||||
}).orElseThrow(
|
||||
() -> new IllegalStateException(String.format("Couldn't find RepositoryInformation for %s!", domainType)));
|
||||
() -> new IllegalStateException(String.format("Couldn't find RepositoryInformation for %s", domainType)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -247,7 +248,7 @@ public class DomainClassConverter<T extends ConversionService & ConverterRegistr
|
||||
|| conversionService.canConvert(idTypeDescriptor, targetType);
|
||||
|
||||
}).orElseThrow(
|
||||
() -> new IllegalStateException(String.format("Couldn't find RepositoryInformation for %s!", domainType)));
|
||||
() -> new IllegalStateException(String.format("Couldn't find RepositoryInformation for %s", domainType)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ import org.springframework.util.Assert;
|
||||
* Exception to represent a failed attempt to convert a source value into a query method parameter.
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
* @author Johannes Englmeier
|
||||
* @soundtrack Dave Matthews Band - The Dreaming Tree (DMB 2009-2018 Europe)
|
||||
* @since 1.11
|
||||
*/
|
||||
@@ -43,10 +44,10 @@ public class QueryMethodParameterConversionException extends RuntimeException {
|
||||
*/
|
||||
public QueryMethodParameterConversionException(Object source, MethodParameter parameter, ConversionException cause) {
|
||||
|
||||
super(String.format("Failed to convert %s into %s!", source, parameter.getParameterType().getName()), cause);
|
||||
super(String.format("Failed to convert %s into %s", source, parameter.getParameterType().getName()), cause);
|
||||
|
||||
Assert.notNull(parameter, "Method parameter must not be null!");
|
||||
Assert.notNull(cause, "ConversionException must not be null!");
|
||||
Assert.notNull(parameter, "Method parameter must not be null");
|
||||
Assert.notNull(cause, "ConversionException must not be null");
|
||||
|
||||
this.parameter = parameter;
|
||||
this.source = source;
|
||||
|
||||
@@ -43,6 +43,7 @@ import org.springframework.util.StringUtils;
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
* @author Alessandro Nistico
|
||||
* @author Johannes Englmeier
|
||||
* @since 1.10
|
||||
*/
|
||||
class ReflectionRepositoryInvoker implements RepositoryInvoker {
|
||||
@@ -101,7 +102,7 @@ class ReflectionRepositoryInvoker implements RepositoryInvoker {
|
||||
public <T> T invokeSave(T object) {
|
||||
|
||||
Method method = methods.getSaveMethod()//
|
||||
.orElseThrow(() -> new IllegalStateException("Repository doesn't have a save-method declared!"));
|
||||
.orElseThrow(() -> new IllegalStateException("Repository doesn't have a save-method declared"));
|
||||
|
||||
return invokeForNonNullResult(method, object);
|
||||
}
|
||||
@@ -115,7 +116,7 @@ class ReflectionRepositoryInvoker implements RepositoryInvoker {
|
||||
public <T> Optional<T> invokeFindById(Object id) {
|
||||
|
||||
Method method = methods.getFindOneMethod()//
|
||||
.orElseThrow(() -> new IllegalStateException("Repository doesn't have a find-one-method declared!"));
|
||||
.orElseThrow(() -> new IllegalStateException("Repository doesn't have a find-one-method declared"));
|
||||
|
||||
return returnAsOptional(invoke(method, convertId(id)));
|
||||
}
|
||||
@@ -131,7 +132,7 @@ class ReflectionRepositoryInvoker implements RepositoryInvoker {
|
||||
Assert.notNull(id, "Identifier must not be null!");
|
||||
|
||||
Method method = methods.getDeleteMethod()
|
||||
.orElseThrow(() -> new IllegalStateException("Repository doesn't have a delete-method declared!"));
|
||||
.orElseThrow(() -> new IllegalStateException("Repository doesn't have a delete-method declared"));
|
||||
|
||||
if (method.getName().endsWith("ById")) {
|
||||
invoke(method, convertId(id));
|
||||
@@ -224,7 +225,7 @@ class ReflectionRepositoryInvoker implements RepositoryInvoker {
|
||||
T result = invoke(method, arguments);
|
||||
|
||||
if (result == null) {
|
||||
throw new IllegalStateException(String.format("Invocation of method %s(%s) on %s unexpectedly returned null!",
|
||||
throw new IllegalStateException(String.format("Invocation of method %s(%s) on %s unexpectedly returned null",
|
||||
method, Arrays.toString(arguments), repository));
|
||||
}
|
||||
|
||||
@@ -258,7 +259,7 @@ class ReflectionRepositoryInvoker implements RepositoryInvoker {
|
||||
|
||||
if (result == null) {
|
||||
throw new IllegalStateException(
|
||||
String.format("Identifier conversion of %s to %s unexpectedly returned null!", id,
|
||||
String.format("Identifier conversion of %s to %s unexpectedly returned null", id,
|
||||
idTypeDescriptor.getType()));
|
||||
}
|
||||
|
||||
@@ -268,7 +269,7 @@ class ReflectionRepositoryInvoker implements RepositoryInvoker {
|
||||
protected Iterable<Object> invokeFindAllReflectively(Pageable pageable) {
|
||||
|
||||
Method method = methods.getFindAllMethod()
|
||||
.orElseThrow(() -> new IllegalStateException("Repository doesn't have a find-all-method declared!"));
|
||||
.orElseThrow(() -> new IllegalStateException("Repository doesn't have a find-all-method declared"));
|
||||
|
||||
if (method.getParameterCount() == 0) {
|
||||
return invokeForNonNullResult(method);
|
||||
@@ -286,7 +287,7 @@ class ReflectionRepositoryInvoker implements RepositoryInvoker {
|
||||
protected Iterable<Object> invokeFindAllReflectively(Sort sort) {
|
||||
|
||||
Method method = methods.getFindAllMethod()
|
||||
.orElseThrow(() -> new IllegalStateException("Repository doesn't have a find-all-method declared!"));
|
||||
.orElseThrow(() -> new IllegalStateException("Repository doesn't have a find-all-method declared"));
|
||||
|
||||
if (method.getParameterCount() == 0) {
|
||||
return invokeForNonNullResult(method);
|
||||
|
||||
@@ -49,6 +49,7 @@ import org.springframework.util.ConcurrentLruCache;
|
||||
* @author Thomas Eizinger
|
||||
* @author Christoph Strobl
|
||||
* @author Alessandro Nistico
|
||||
* @author Johannes Englmeier
|
||||
*/
|
||||
public class Repositories implements Iterable<Class<?>> {
|
||||
|
||||
@@ -223,7 +224,7 @@ public class Repositories implements Iterable<Class<?>> {
|
||||
public RepositoryInformation getRequiredRepositoryInformation(Class<?> domainType) {
|
||||
|
||||
return getRepositoryInformationFor(domainType).orElseThrow(() -> new IllegalArgumentException(
|
||||
"No required RepositoryInformation found for domain type " + domainType.getName() + "!"));
|
||||
"No required RepositoryInformation found for domain type " + domainType.getName()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -35,6 +35,7 @@ import org.springframework.util.StringUtils;
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
* @author Mark Paluch
|
||||
* @author Johannes Englmeier
|
||||
*/
|
||||
public abstract class ClassUtils {
|
||||
|
||||
@@ -146,7 +147,7 @@ public abstract class ClassUtils {
|
||||
Arrays.stream(types)//
|
||||
.filter(it -> it.isAssignableFrom(returnType.getType()))//
|
||||
.findAny().orElseThrow(() -> new IllegalStateException(
|
||||
"Method has to have one of the following return types! " + Arrays.toString(types)));
|
||||
"Method has to have one of the following return types " + Arrays.toString(types)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -34,6 +34,7 @@ import org.springframework.util.Assert;
|
||||
* @author Thomas Darimont
|
||||
* @author Oliver Gierke
|
||||
* @author Jens Schauder
|
||||
* @author Johannes Englmeier
|
||||
* @since 1.9
|
||||
*/
|
||||
public class Function {
|
||||
@@ -107,7 +108,7 @@ public class Function {
|
||||
return method.invoke(target, argumentsToUse.size() == 1 ? argumentsToUse.get(0) : argumentsToUse.toArray());
|
||||
}
|
||||
|
||||
throw new IllegalStateException(String.format("Could not invoke method %s for arguments %s!", method, arguments));
|
||||
throw new IllegalStateException(String.format("Could not invoke method %s for arguments %s", method, arguments));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -22,6 +22,7 @@ import org.springframework.util.Assert;
|
||||
* {@link IsNewStrategy} that invokes {@link Persistable#isNew()} on the given object.
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
* @author Johannes Englmeier
|
||||
*/
|
||||
public enum PersistableIsNewStrategy implements IsNewStrategy {
|
||||
|
||||
@@ -34,7 +35,7 @@ public enum PersistableIsNewStrategy implements IsNewStrategy {
|
||||
|
||||
if (!(entity instanceof Persistable)) {
|
||||
throw new IllegalArgumentException(
|
||||
String.format("Given object of type %s does not implement %s!", entity.getClass(), Persistable.class));
|
||||
String.format("Given object of type %s does not implement %s", entity.getClass(), Persistable.class));
|
||||
}
|
||||
|
||||
return ((Persistable<?>) entity).isNew();
|
||||
|
||||
@@ -36,6 +36,7 @@ import org.springframework.util.ClassUtils;
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
* @author Christoph Strobl
|
||||
* @author Johannes Englmeier
|
||||
*/
|
||||
public class AnnotatedTypeScanner implements ResourceLoaderAware, EnvironmentAware {
|
||||
|
||||
@@ -111,7 +112,7 @@ public class AnnotatedTypeScanner implements ResourceLoaderAware, EnvironmentAwa
|
||||
|
||||
if (beanClassName == null) {
|
||||
throw new IllegalStateException(
|
||||
String.format("Unable to obtain bean class name from bean definition %s!", definition));
|
||||
String.format("Unable to obtain bean class name from bean definition %s", definition));
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
@@ -31,6 +31,7 @@ import org.springframework.util.ReflectionUtils.FieldCallback;
|
||||
* @author Oliver Gierke
|
||||
* @author Christoph Strobl
|
||||
* @author Mark Paluch
|
||||
* @author Johannes Englmeier
|
||||
*/
|
||||
public class AnnotationDetectionFieldCallback implements FieldCallback {
|
||||
|
||||
@@ -81,7 +82,7 @@ public class AnnotationDetectionFieldCallback implements FieldCallback {
|
||||
Field field = this.field;
|
||||
|
||||
if (field == null) {
|
||||
throw new IllegalStateException(String.format("No field found for annotation %s!", annotationType));
|
||||
throw new IllegalStateException(String.format("No field found for annotation %s", annotationType));
|
||||
}
|
||||
|
||||
return field;
|
||||
|
||||
@@ -30,6 +30,7 @@ import org.springframework.util.ReflectionUtils.MethodCallback;
|
||||
* @author Oliver Gierke
|
||||
* @author Christoph Strobl
|
||||
* @author Mark Paluch
|
||||
* @author Johannes Englmeier
|
||||
*/
|
||||
public class AnnotationDetectionMethodCallback<A extends Annotation> implements MethodCallback {
|
||||
|
||||
@@ -83,7 +84,7 @@ public class AnnotationDetectionMethodCallback<A extends Annotation> implements
|
||||
Method method = this.foundMethod;
|
||||
|
||||
if (method == null) {
|
||||
throw new IllegalStateException(String.format("No method with annotation %s found!", annotationType));
|
||||
throw new IllegalStateException(String.format("No method with annotation %s found", annotationType));
|
||||
}
|
||||
|
||||
return method;
|
||||
|
||||
@@ -29,6 +29,7 @@ import org.springframework.lang.Nullable;
|
||||
* wrapped does not use accessor methods.
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
* @author Johannes Englmeier
|
||||
*/
|
||||
public class DirectFieldAccessFallbackBeanWrapper extends BeanWrapperImpl {
|
||||
|
||||
@@ -52,7 +53,7 @@ public class DirectFieldAccessFallbackBeanWrapper extends BeanWrapperImpl {
|
||||
|
||||
if (field == null) {
|
||||
throw new NotReadablePropertyException(getWrappedClass(), propertyName,
|
||||
"Could not find field for property during fallback access!");
|
||||
"Could not find field for property during fallback access");
|
||||
}
|
||||
|
||||
makeAccessible(field);
|
||||
@@ -71,7 +72,7 @@ public class DirectFieldAccessFallbackBeanWrapper extends BeanWrapperImpl {
|
||||
|
||||
if (field == null) {
|
||||
throw new NotWritablePropertyException(getWrappedClass(), propertyName,
|
||||
"Could not find field for property during fallback access!", e);
|
||||
"Could not find field for property during fallback access", e);
|
||||
}
|
||||
|
||||
makeAccessible(field);
|
||||
|
||||
@@ -41,6 +41,7 @@ import org.springframework.lang.Nullable;
|
||||
*
|
||||
* @author Mark Paluch
|
||||
* @author Christoph Strobl
|
||||
* @author Johannes Englmeier
|
||||
* @since 2.3
|
||||
* @see org.springframework.core.KotlinDetector#isKotlinReflectPresent()
|
||||
*/
|
||||
@@ -125,7 +126,7 @@ public final class KotlinReflectionUtils {
|
||||
KFunction<?> kotlinFunction = KotlinReflectionUtils.findKotlinFunction(method);
|
||||
|
||||
if (kotlinFunction == null) {
|
||||
throw new IllegalArgumentException(String.format("Cannot resolve %s to a KFunction!", method));
|
||||
throw new IllegalArgumentException(String.format("Cannot resolve %s to a KFunction", method));
|
||||
}
|
||||
|
||||
return JvmClassMappingKt.getJavaClass(KTypesJvm.getJvmErasure(kotlinFunction.getReturnType()));
|
||||
@@ -143,13 +144,13 @@ public final class KotlinReflectionUtils {
|
||||
Method method = parameter.getMethod();
|
||||
|
||||
if (method == null) {
|
||||
throw new IllegalStateException(String.format("Cannot obtain method from parameter %s!", parameter));
|
||||
throw new IllegalStateException(String.format("Cannot obtain method from parameter %s", parameter));
|
||||
}
|
||||
|
||||
KFunction<?> kotlinFunction = findKotlinFunction(method);
|
||||
|
||||
if (kotlinFunction == null) {
|
||||
throw new IllegalArgumentException(String.format("Cannot resolve %s to a Kotlin function!", parameter));
|
||||
throw new IllegalArgumentException(String.format("Cannot resolve %s to a Kotlin function", parameter));
|
||||
}
|
||||
|
||||
// Special handling for Coroutines
|
||||
|
||||
@@ -31,6 +31,7 @@ import org.springframework.util.ObjectUtils;
|
||||
* @author Oliver Gierke
|
||||
* @author Mark Paluch
|
||||
* @author Henning Rohlfs
|
||||
* @author Johannes Englmeier
|
||||
* @since 2.0
|
||||
*/
|
||||
public class Lazy<T> implements Supplier<T> {
|
||||
@@ -112,7 +113,7 @@ public class Lazy<T> implements Supplier<T> {
|
||||
T value = getNullable();
|
||||
|
||||
if (value == null) {
|
||||
throw new IllegalStateException("Expected lazy evaluation to yield a non-null value but got null!");
|
||||
throw new IllegalStateException("Expected lazy evaluation to yield a non-null value but got null");
|
||||
}
|
||||
|
||||
return value;
|
||||
|
||||
@@ -40,6 +40,7 @@ import org.springframework.util.StringUtils;
|
||||
* API to record method invocations via method references on a proxy.
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
* @author Johannes Englmeier
|
||||
* @since 2.2
|
||||
* @soundtrack The Intersphere - Don't Think Twice (The Grand Delusion)
|
||||
*/
|
||||
@@ -203,7 +204,7 @@ public class MethodInvocationRecorder {
|
||||
.map(it -> it.getPropertyName(invokedMethod)) //
|
||||
.findFirst() //
|
||||
.orElseThrow(() -> new IllegalArgumentException(
|
||||
String.format("No property name found for method %s!", invokedMethod)));
|
||||
String.format("No property name found for method %s", invokedMethod)));
|
||||
}
|
||||
|
||||
public Recorded<?> getRecorded() {
|
||||
|
||||
@@ -43,6 +43,7 @@ import org.springframework.util.ReflectionUtils.FieldFilter;
|
||||
* @author Thomas Darimont
|
||||
* @author Christoph Strobl
|
||||
* @author Mark Paluch
|
||||
* @author Johannes Englmeier
|
||||
* @since 1.5
|
||||
*/
|
||||
public final class ReflectionUtils {
|
||||
@@ -223,7 +224,7 @@ public final class ReflectionUtils {
|
||||
Field result = org.springframework.util.ReflectionUtils.findField(type, name);
|
||||
|
||||
if (result == null) {
|
||||
throw new IllegalArgumentException(String.format("Unable to find field %s on %s!", name, type));
|
||||
throw new IllegalArgumentException(String.format("Unable to find field %s on %s", name, type));
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -440,7 +441,7 @@ public final class ReflectionUtils {
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
|
||||
throw new IllegalArgumentException(String.format("Primitive type %s not supported!", type));
|
||||
throw new IllegalArgumentException(String.format("Primitive type %s not supported", type));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -51,6 +51,7 @@ import org.springframework.util.ReflectionUtils;
|
||||
* @author Mark Paluch
|
||||
* @author Jürgen Diez
|
||||
* @author Alessandro Nistico
|
||||
* @author Johannes Englmeier
|
||||
*/
|
||||
class TypeDiscoverer<S> implements TypeInformation<S> {
|
||||
|
||||
@@ -415,7 +416,7 @@ class TypeDiscoverer<S> implements TypeInformation<S> {
|
||||
|
||||
TypeInformation<?> superTypeInformation = target.getSuperTypeInformation(getType());
|
||||
|
||||
return superTypeInformation == null ? false : superTypeInformation.equals(this);
|
||||
return superTypeInformation != null && superTypeInformation.equals(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -29,6 +29,7 @@ import org.springframework.lang.Nullable;
|
||||
* @author Oliver Gierke
|
||||
* @author Mark Paluch
|
||||
* @author Alessandro Nistico
|
||||
* @author Johannes Englmeier
|
||||
*/
|
||||
public interface TypeInformation<S> {
|
||||
|
||||
@@ -68,7 +69,7 @@ public interface TypeInformation<S> {
|
||||
}
|
||||
|
||||
throw new IllegalArgumentException(
|
||||
String.format("Could not find required property %s on %s!", property, getType()));
|
||||
String.format("Could not find required property %s on %s", property, getType()));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -105,7 +106,7 @@ public interface TypeInformation<S> {
|
||||
return componentType;
|
||||
}
|
||||
|
||||
throw new IllegalStateException(String.format("Can't resolve required component type for %s!", getType()));
|
||||
throw new IllegalStateException(String.format("Can't resolve required component type for %s", getType()));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -141,7 +142,7 @@ public interface TypeInformation<S> {
|
||||
return mapValueType;
|
||||
}
|
||||
|
||||
throw new IllegalStateException(String.format("Can't resolve required map value type for %s!", getType()));
|
||||
throw new IllegalStateException(String.format("Can't resolve required map value type for %s", getType()));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -197,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;
|
||||
@@ -244,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));
|
||||
}
|
||||
|
||||
|
||||
@@ -51,6 +51,7 @@ import org.springframework.web.bind.WebDataBinder;
|
||||
* A {@link WebDataBinder} that automatically binds all properties exposed in the given type using a {@link Map}.
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
* @author Johannes Englmeier
|
||||
* @since 1.10
|
||||
*/
|
||||
class MapDataBinder extends WebDataBinder {
|
||||
@@ -80,7 +81,7 @@ class MapDataBinder extends WebDataBinder {
|
||||
Object target = super.getTarget();
|
||||
|
||||
if (target == null) {
|
||||
throw new IllegalStateException("Target bean should never be null!");
|
||||
throw new IllegalStateException("Target bean should never be null");
|
||||
}
|
||||
|
||||
return (Map<String, Object>) target;
|
||||
@@ -96,6 +97,7 @@ class MapDataBinder extends WebDataBinder {
|
||||
* deeply nested Map structures.
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
* @author Johannes Englmeier
|
||||
* @since 1.10
|
||||
*/
|
||||
private static class MapPropertyAccessor extends AbstractPropertyAccessor {
|
||||
@@ -160,7 +162,7 @@ class MapDataBinder extends WebDataBinder {
|
||||
leafProperty.getSegment());
|
||||
|
||||
if (descriptor == null) {
|
||||
throw new IllegalStateException(String.format("Couldn't find PropertyDescriptor for %s on %s!",
|
||||
throw new IllegalStateException(String.format("Couldn't find PropertyDescriptor for %s on %s",
|
||||
leafProperty.getSegment(), owningType.getType()));
|
||||
}
|
||||
|
||||
@@ -186,7 +188,7 @@ class MapDataBinder extends WebDataBinder {
|
||||
try {
|
||||
expression.setValue(context, value);
|
||||
} catch (SpelEvaluationException o_O) {
|
||||
throw new NotWritablePropertyException(type, propertyName, "Could not write property!", o_O);
|
||||
throw new NotWritablePropertyException(type, propertyName, "Could not write property", o_O);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -41,6 +41,7 @@ import org.springframework.web.method.support.ModelAndViewContainer;
|
||||
* @author Oliver Gierke
|
||||
* @author Nick Williams
|
||||
* @author Christoph Strobl
|
||||
* @author Johannes Englmeier
|
||||
*/
|
||||
public class PagedResourcesAssemblerArgumentResolver implements HandlerMethodArgumentResolver {
|
||||
|
||||
@@ -93,7 +94,7 @@ public class PagedResourcesAssemblerArgumentResolver implements HandlerMethodArg
|
||||
Method method = parameter.getMethod();
|
||||
|
||||
if (method == null) {
|
||||
throw new IllegalArgumentException(String.format("Could not obtain method from parameter %s!", parameter));
|
||||
throw new IllegalArgumentException(String.format("Could not obtain method from parameter %s", parameter));
|
||||
}
|
||||
|
||||
MethodParameters parameters = MethodParameters.of(method);
|
||||
|
||||
@@ -40,6 +40,7 @@ import org.springframework.util.StringUtils;
|
||||
* @see ReactiveSortHandlerMethodArgumentResolver
|
||||
* @author Mark Paluch
|
||||
* @author Vedran Pavic
|
||||
* @author Johannes Englmeier
|
||||
*/
|
||||
public abstract class SortHandlerMethodArgumentResolverSupport {
|
||||
|
||||
@@ -125,7 +126,7 @@ public abstract class SortHandlerMethodArgumentResolverSupport {
|
||||
|
||||
if (annotatedDefault != null && annotatedDefaults != null) {
|
||||
throw new IllegalArgumentException(
|
||||
String.format("Cannot use both @%s and @%s on parameter %s! Move %s into %s to define sorting order!",
|
||||
String.format("Cannot use both @%s and @%s on parameter %s! Move %s into %s to define sorting order",
|
||||
SORT_DEFAULTS_NAME, SORT_DEFAULT_NAME, parameter.toString(), SORT_DEFAULT_NAME, SORT_DEFAULTS_NAME));
|
||||
}
|
||||
|
||||
@@ -273,7 +274,7 @@ public abstract class SortHandlerMethodArgumentResolverSupport {
|
||||
builder = new ExpressionBuilder(direction);
|
||||
} else if (!builder.hasSameDirectionAs(order)) {
|
||||
throw new IllegalArgumentException(String.format(
|
||||
"%s in legacy configuration only supports a single direction to sort by!", getClass().getSimpleName()));
|
||||
"%s in legacy configuration only supports a single direction to sort by", getClass().getSimpleName()));
|
||||
}
|
||||
|
||||
builder.add(order.getProperty());
|
||||
|
||||
@@ -35,6 +35,7 @@ import org.springframework.util.ObjectUtils;
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
* @author Mark Paluch
|
||||
* @author Johannes Englmeier
|
||||
*/
|
||||
abstract class SpringDataAnnotationUtils {
|
||||
|
||||
@@ -50,7 +51,7 @@ abstract class SpringDataAnnotationUtils {
|
||||
Method method = parameter.getMethod();
|
||||
|
||||
if (method == null) {
|
||||
throw new IllegalArgumentException(String.format("Method parameter %s is not backed by a method.", parameter));
|
||||
throw new IllegalArgumentException(String.format("Method parameter %s is not backed by a method", parameter));
|
||||
}
|
||||
|
||||
if (containsMoreThanOnePageableParameter(method)) {
|
||||
@@ -102,7 +103,7 @@ abstract class SpringDataAnnotationUtils {
|
||||
: propertyValue;
|
||||
|
||||
if (result == null) {
|
||||
throw new IllegalStateException("Exepected to be able to look up an annotation property value but failed!");
|
||||
throw new IllegalStateException("Exepected to be able to look up an annotation property value but failed");
|
||||
}
|
||||
|
||||
return (T) result;
|
||||
@@ -151,7 +152,7 @@ abstract class SpringDataAnnotationUtils {
|
||||
}
|
||||
|
||||
if (values.contains(qualifier.value())) {
|
||||
throw new IllegalStateException("Values of the user Qualifiers must be unique!");
|
||||
throw new IllegalStateException("Values of the user Qualifiers must be unique");
|
||||
}
|
||||
|
||||
values.add(qualifier.value());
|
||||
|
||||
@@ -42,6 +42,7 @@ import org.xmlbeam.config.DefaultXMLFactoriesConfig;
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
* @author Christoph Strobl
|
||||
* @author Johannes Englmeier
|
||||
* @see <a href="https://www.xmlbeam.org">https://www.xmlbeam.org</a>
|
||||
* @soundtrack Dr. Kobayashi Maru & The Mothership Connection - Anthem (EPisode One)
|
||||
*/
|
||||
@@ -121,7 +122,7 @@ public class XmlBeamHttpMessageConverter extends AbstractHttpMessageConverter<Ob
|
||||
Throwable cause = o_O.getCause();
|
||||
|
||||
if (SAXParseException.class.isInstance(cause)) {
|
||||
throw new HttpMessageNotReadableException("Cannot read input message!", cause, inputMessage);
|
||||
throw new HttpMessageNotReadableException("Cannot read input message", cause, inputMessage);
|
||||
} else {
|
||||
throw o_O;
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@ import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandl
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
* @author Mark Paluch
|
||||
* @author Johannes Englmeier
|
||||
* @soundtrack Apparat With Soap & Skin - Goodbye (Dark Theme Song - https://www.youtube.com/watch?v=66VnOdk6oto)
|
||||
*/
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@@ -111,7 +112,7 @@ public class ProjectingArgumentResolverRegistrar {
|
||||
|
||||
if (currentResolvers == null) {
|
||||
throw new IllegalStateException(
|
||||
String.format("No HandlerMethodArgumentResolvers found in RequestMappingHandlerAdapter %s!", beanName));
|
||||
String.format("No HandlerMethodArgumentResolvers found in RequestMappingHandlerAdapter %s", beanName));
|
||||
}
|
||||
|
||||
List<HandlerMethodArgumentResolver> newResolvers = new ArrayList<HandlerMethodArgumentResolver>(
|
||||
|
||||
@@ -45,6 +45,7 @@ import com.querydsl.core.types.Predicate;
|
||||
* @author Christoph Strobl
|
||||
* @author Oliver Gierke
|
||||
* @author Matías Hermosilla
|
||||
* @author Johannes Englmeier
|
||||
* @since 2.5
|
||||
*/
|
||||
public abstract class QuerydslPredicateArgumentResolverSupport {
|
||||
@@ -83,7 +84,7 @@ public abstract class QuerydslPredicateArgumentResolverSupport {
|
||||
MergedAnnotations annotations = MergedAnnotations.from(parameter.getParameter());
|
||||
|
||||
if (annotations.isPresent(QuerydslPredicate.class)) {
|
||||
throw new IllegalArgumentException(String.format("Parameter at position %s must be of type Predicate but was %s.",
|
||||
throw new IllegalArgumentException(String.format("Parameter at position %s must be of type Predicate but was %s",
|
||||
parameter.getParameterIndex(), parameter.getParameterType()));
|
||||
}
|
||||
|
||||
@@ -143,7 +144,7 @@ public abstract class QuerydslPredicateArgumentResolverSupport {
|
||||
Method method = parameter.getMethod();
|
||||
|
||||
if (method == null) {
|
||||
throw new IllegalArgumentException("Method parameter is not backed by a method!");
|
||||
throw new IllegalArgumentException("Method parameter is not backed by a method");
|
||||
}
|
||||
|
||||
return detectDomainType(ClassTypeInformation.fromReturnTypeOf(method));
|
||||
@@ -158,7 +159,7 @@ public abstract class QuerydslPredicateArgumentResolverSupport {
|
||||
TypeInformation<?> actualType = source.getActualType();
|
||||
|
||||
if (actualType == null) {
|
||||
throw new IllegalArgumentException(String.format("Could not determine domain type from %s!", source));
|
||||
throw new IllegalArgumentException(String.format("Could not determine domain type from %s", source));
|
||||
}
|
||||
|
||||
if (source != actualType) {
|
||||
|
||||
Reference in New Issue
Block a user