@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user