@@ -112,8 +112,8 @@ public class AccessOptions {
|
||||
*/
|
||||
public GetOptions registerHandler(PersistentProperty<?> property, Function<Object, Object> handler) {
|
||||
|
||||
Assert.notNull(property, "Property must not be null!");
|
||||
Assert.notNull(handler, "Handler must not be null!");
|
||||
Assert.notNull(property, "Property must not be null");
|
||||
Assert.notNull(handler, "Handler must not be null");
|
||||
|
||||
Map<PersistentProperty<?>, Function<Object, Object>> newHandlers = new HashMap<>(handlers);
|
||||
newHandlers.put(property, handler);
|
||||
@@ -184,7 +184,7 @@ public class AccessOptions {
|
||||
Function<? super T, Object> handler) {
|
||||
|
||||
Assert.isTrue(type.isAssignableFrom(property.getType()), () -> String
|
||||
.format("Cannot register a property handler for %s on a property of type %s!", type, property.getType()));
|
||||
.format("Cannot register a property handler for %s on a property of type %s", type, property.getType()));
|
||||
|
||||
Function<Object, T> caster = (Function<Object, T>) it -> type.cast(it);
|
||||
|
||||
@@ -333,7 +333,7 @@ public class AccessOptions {
|
||||
*/
|
||||
public SetOptions withCollectionAndMapPropagation(Propagation propagation) {
|
||||
|
||||
Assert.notNull(propagation, "Propagation must not be null!");
|
||||
Assert.notNull(propagation, "Propagation must not be null");
|
||||
|
||||
return withCollectionPropagation(propagation) //
|
||||
.withMapPropagation(propagation);
|
||||
|
||||
@@ -54,7 +54,7 @@ public final class Alias {
|
||||
*/
|
||||
public static Alias of(Object alias) {
|
||||
|
||||
Assert.notNull(alias, "Alias must not be null!");
|
||||
Assert.notNull(alias, "Alias must not be null");
|
||||
|
||||
return new Alias(alias);
|
||||
}
|
||||
@@ -87,7 +87,7 @@ public final class Alias {
|
||||
*/
|
||||
public boolean isPresentButDifferent(Alias other) {
|
||||
|
||||
Assert.notNull(other, "Other alias must not be null!");
|
||||
Assert.notNull(other, "Other alias must not be null");
|
||||
|
||||
return isPresent() && !this.value.equals(other.value);
|
||||
}
|
||||
|
||||
@@ -46,8 +46,8 @@ class InstanceCreatorMetadataSupport<T, P extends PersistentProperty<P>> impleme
|
||||
@SafeVarargs
|
||||
public InstanceCreatorMetadataSupport(Executable executable, Parameter<Object, P>... parameters) {
|
||||
|
||||
Assert.notNull(executable, "Executable must not be null!");
|
||||
Assert.notNull(parameters, "Parameters must not be null!");
|
||||
Assert.notNull(executable, "Executable must not be null");
|
||||
Assert.notNull(parameters, "Parameters must not be null");
|
||||
|
||||
this.executable = executable;
|
||||
this.parameters = Arrays.asList(parameters);
|
||||
@@ -85,7 +85,7 @@ class InstanceCreatorMetadataSupport<T, P extends PersistentProperty<P>> impleme
|
||||
@Override
|
||||
public boolean isCreatorParameter(PersistentProperty<?> property) {
|
||||
|
||||
Assert.notNull(property, "Property must not be null!");
|
||||
Assert.notNull(property, "Property must not be null");
|
||||
|
||||
Boolean cached = isPropertyParameterCache.get(property);
|
||||
|
||||
|
||||
@@ -56,8 +56,8 @@ public class Parameter<T, P extends PersistentProperty<P>> {
|
||||
public Parameter(@Nullable String name, TypeInformation<T> type, Annotation[] annotations,
|
||||
@Nullable PersistentEntity<T, P> entity) {
|
||||
|
||||
Assert.notNull(type, "Type must not be null!");
|
||||
Assert.notNull(annotations, "Annotations must not be null!");
|
||||
Assert.notNull(type, "Type must not be null");
|
||||
Assert.notNull(annotations, "Annotations must not be null");
|
||||
|
||||
this.name = name;
|
||||
this.type = type;
|
||||
|
||||
@@ -279,7 +279,7 @@ public interface PersistentEntity<T, P extends PersistentProperty<P>> extends It
|
||||
*/
|
||||
default void doWithAll(PropertyHandler<P> handler) {
|
||||
|
||||
Assert.notNull(handler, "PropertyHandler must not be null!");
|
||||
Assert.notNull(handler, "PropertyHandler must not be null");
|
||||
|
||||
doWithProperties(handler);
|
||||
doWithAssociations(
|
||||
|
||||
@@ -341,7 +341,7 @@ public interface PersistentProperty<P extends PersistentProperty<P>> {
|
||||
}
|
||||
|
||||
throw new IllegalStateException(
|
||||
String.format("Required annotation %s not found for %s!", annotationType, getName()));
|
||||
String.format("Required annotation %s not found for %s", annotationType, getName()));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -380,7 +380,7 @@ public interface PersistentProperty<P extends PersistentProperty<P>> {
|
||||
*/
|
||||
default boolean hasActualTypeAnnotation(Class<? extends Annotation> annotationType) {
|
||||
|
||||
Assert.notNull(annotationType, "Annotation type must not be null!");
|
||||
Assert.notNull(annotationType, "Annotation type must not be null");
|
||||
|
||||
return AnnotatedElementUtils.hasAnnotation(getActualType(), annotationType);
|
||||
}
|
||||
@@ -420,7 +420,7 @@ public interface PersistentProperty<P extends PersistentProperty<P>> {
|
||||
*/
|
||||
default <T> PersistentPropertyAccessor<T> getAccessorForOwner(T owner) {
|
||||
|
||||
Assert.notNull(owner, "Owner must not be null!");
|
||||
Assert.notNull(owner, "Owner must not be null");
|
||||
|
||||
return getOwner().getPropertyAccessor(owner);
|
||||
}
|
||||
|
||||
@@ -59,8 +59,8 @@ public interface PersistentPropertyAccessor<T> {
|
||||
@Deprecated
|
||||
default void setProperty(PersistentPropertyPath<? extends PersistentProperty<?>> path, @Nullable Object value) {
|
||||
|
||||
Assert.notNull(path, "PersistentPropertyPath must not be null!");
|
||||
Assert.isTrue(!path.isEmpty(), "PersistentPropertyPath must not be empty!");
|
||||
Assert.notNull(path, "PersistentPropertyPath must not be null");
|
||||
Assert.isTrue(!path.isEmpty(), "PersistentPropertyPath must not be empty");
|
||||
|
||||
PersistentPropertyPath<? extends PersistentProperty<?>> parentPath = path.getParentPath();
|
||||
PersistentProperty<? extends PersistentProperty<?>> leafProperty = path.getRequiredLeafProperty();
|
||||
@@ -76,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()));
|
||||
@@ -152,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()));
|
||||
|
||||
@@ -108,7 +108,7 @@ public final class PreferredConstructor<T, P extends PersistentProperty<P>> exte
|
||||
*/
|
||||
public boolean isEnclosingClassParameter(Parameter<?, P> parameter) {
|
||||
|
||||
Assert.notNull(parameter, "Parameter must not be null!");
|
||||
Assert.notNull(parameter, "Parameter must not be null");
|
||||
|
||||
if (parameters.isEmpty() || !parameter.isEnclosingClassParameter()) {
|
||||
return false;
|
||||
@@ -116,5 +116,4 @@ public final class PreferredConstructor<T, P extends PersistentProperty<P>> exte
|
||||
|
||||
return parameters.get(0).equals(parameter);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ import org.springframework.util.StringUtils;
|
||||
*/
|
||||
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));
|
||||
@@ -80,9 +80,9 @@ public class PropertyPath implements Streamable<PropertyPath> {
|
||||
*/
|
||||
PropertyPath(String name, TypeInformation<?> owningType, List<PropertyPath> base) {
|
||||
|
||||
Assert.hasText(name, "Name must not be null or empty!");
|
||||
Assert.notNull(owningType, "Owning type must not be null!");
|
||||
Assert.notNull(base, "Previously found properties must not be null!");
|
||||
Assert.hasText(name, "Name must not be null or empty");
|
||||
Assert.notNull(owningType, "Owning type must not be null");
|
||||
Assert.notNull(base, "Previously found properties must not be null");
|
||||
|
||||
String propertyName = Introspector.decapitalize(name);
|
||||
TypeInformation<?> propertyType = owningType.getProperty(propertyName);
|
||||
@@ -208,7 +208,7 @@ public class PropertyPath implements Streamable<PropertyPath> {
|
||||
*/
|
||||
public PropertyPath nested(String path) {
|
||||
|
||||
Assert.hasText(path, "Path must not be null or empty!");
|
||||
Assert.hasText(path, "Path must not be null or empty");
|
||||
|
||||
String lookup = toDotPath().concat(".").concat(path);
|
||||
|
||||
@@ -301,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;
|
||||
@@ -329,8 +329,8 @@ public class PropertyPath implements Streamable<PropertyPath> {
|
||||
*/
|
||||
public static PropertyPath from(String source, TypeInformation<?> type) {
|
||||
|
||||
Assert.hasText(source, "Source must not be null or empty!");
|
||||
Assert.notNull(type, "TypeInformation must not be null or empty!");
|
||||
Assert.hasText(source, "Source must not be null or empty");
|
||||
Assert.notNull(type, "TypeInformation must not be null or empty");
|
||||
|
||||
return cache.computeIfAbsent(Key.of(type, source), it -> {
|
||||
|
||||
|
||||
@@ -37,8 +37,8 @@ import org.springframework.util.StringUtils;
|
||||
public class PropertyReferenceException extends RuntimeException {
|
||||
|
||||
private static final long serialVersionUID = -5254424051438976570L;
|
||||
private static final String ERROR_TEMPLATE = "No property '%s' found for type '%s'!";
|
||||
private static final String HINTS_TEMPLATE = " Did you mean '%s'?";
|
||||
private static final String ERROR_TEMPLATE = "No property '%s' found for type '%s'";
|
||||
private static final String HINTS_TEMPLATE = " Did you mean '%s'";
|
||||
|
||||
private final String propertyName;
|
||||
private final TypeInformation<?> type;
|
||||
@@ -55,9 +55,9 @@ public class PropertyReferenceException extends RuntimeException {
|
||||
public PropertyReferenceException(String propertyName, TypeInformation<?> type,
|
||||
List<PropertyPath> alreadyResolvedPah) {
|
||||
|
||||
Assert.hasText(propertyName, "Property name must not be null!");
|
||||
Assert.notNull(type, "Type must not be null!");
|
||||
Assert.notNull(alreadyResolvedPah, "Already resolved paths must not be null!");
|
||||
Assert.hasText(propertyName, "Property name must not be null");
|
||||
Assert.notNull(type, "Type must not be null");
|
||||
Assert.notNull(alreadyResolvedPah, "Already resolved paths must not be null");
|
||||
|
||||
this.propertyName = propertyName;
|
||||
this.type = type;
|
||||
|
||||
@@ -49,8 +49,8 @@ public class TraversalContext {
|
||||
*/
|
||||
public TraversalContext registerHandler(PersistentProperty<?> property, Function<Object, Object> handler) {
|
||||
|
||||
Assert.notNull(property, "Property must not be null!");
|
||||
Assert.notNull(handler, "Handler must not be null!");
|
||||
Assert.notNull(property, "Property must not be null");
|
||||
Assert.notNull(handler, "Handler must not be null");
|
||||
|
||||
handlers.put(property, handler);
|
||||
|
||||
@@ -122,7 +122,7 @@ public class TraversalContext {
|
||||
Function<? super T, Object> handler) {
|
||||
|
||||
Assert.isTrue(type.isAssignableFrom(property.getType()), () -> String
|
||||
.format("Cannot register a property handler for %s on a property of type %s!", type, property.getType()));
|
||||
.format("Cannot register a property handler for %s on a property of type %s", type, property.getType()));
|
||||
|
||||
Function<Object, T> caster = (Function<Object, T>) it -> type.cast(it);
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ class DefaultEntityCallbacks implements EntityCallbacks {
|
||||
@Override
|
||||
public <T> T callback(Class<? extends EntityCallback> callbackType, T entity, Object... args) {
|
||||
|
||||
Assert.notNull(entity, "Entity must not be null!");
|
||||
Assert.notNull(entity, "Entity must not be null");
|
||||
|
||||
Class<T> entityType = (Class<T>) (entity != null ? ClassUtils.getUserClass(entity.getClass())
|
||||
: callbackDiscoverer.resolveDeclaredEntityType(callbackType).getRawClass());
|
||||
|
||||
@@ -64,7 +64,7 @@ class DefaultReactiveEntityCallbacks implements ReactiveEntityCallbacks {
|
||||
@Override
|
||||
public <T> Mono<T> callback(Class<? extends EntityCallback> callbackType, T entity, Object... args) {
|
||||
|
||||
Assert.notNull(entity, "Entity must not be null!");
|
||||
Assert.notNull(entity, "Entity must not be null");
|
||||
|
||||
Class<T> entityType = (Class<T>) (entity != null ? ClassUtils.getUserClass(entity.getClass())
|
||||
: callbackDiscoverer.resolveDeclaredEntityType(callbackType).getRawClass());
|
||||
|
||||
@@ -74,7 +74,7 @@ class EntityCallbackDiscoverer {
|
||||
|
||||
void addEntityCallback(EntityCallback<?> callback) {
|
||||
|
||||
Assert.notNull(callback, "Callback must not be null!");
|
||||
Assert.notNull(callback, "Callback must not be null");
|
||||
|
||||
synchronized (this.retrievalMutex) {
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ public interface EntityCallbacks {
|
||||
*/
|
||||
static EntityCallbacks create(BeanFactory beanFactory) {
|
||||
|
||||
Assert.notNull(beanFactory, "Context must not be null!");
|
||||
Assert.notNull(beanFactory, "Context must not be null");
|
||||
return new DefaultEntityCallbacks(beanFactory);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ public interface ReactiveEntityCallbacks {
|
||||
*/
|
||||
static ReactiveEntityCallbacks create(BeanFactory beanFactory) {
|
||||
|
||||
Assert.notNull(beanFactory, "Context must not be null!");
|
||||
Assert.notNull(beanFactory, "Context must not be null");
|
||||
return new DefaultReactiveEntityCallbacks(beanFactory);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -166,7 +166,7 @@ public abstract class AbstractMappingContext<E extends MutablePersistentEntity<?
|
||||
*/
|
||||
public void setSimpleTypeHolder(SimpleTypeHolder simpleTypes) {
|
||||
|
||||
Assert.notNull(simpleTypes, "SimpleTypeHolder must not be null!");
|
||||
Assert.notNull(simpleTypes, "SimpleTypeHolder must not be null");
|
||||
|
||||
this.simpleTypeHolder = simpleTypes;
|
||||
}
|
||||
@@ -195,7 +195,7 @@ public abstract class AbstractMappingContext<E extends MutablePersistentEntity<?
|
||||
@Override
|
||||
public boolean hasPersistentEntityFor(Class<?> type) {
|
||||
|
||||
Assert.notNull(type, "Type must not be null!");
|
||||
Assert.notNull(type, "Type must not be null");
|
||||
|
||||
TypeInformation<?> typeInformation = ClassTypeInformation.from(type);
|
||||
|
||||
@@ -231,7 +231,7 @@ public abstract class AbstractMappingContext<E extends MutablePersistentEntity<?
|
||||
@Override
|
||||
public E getPersistentEntity(TypeInformation<?> type) {
|
||||
|
||||
Assert.notNull(type, "Type must not be null!");
|
||||
Assert.notNull(type, "Type must not be null");
|
||||
|
||||
try {
|
||||
|
||||
@@ -270,7 +270,7 @@ public abstract class AbstractMappingContext<E extends MutablePersistentEntity<?
|
||||
@Override
|
||||
public E getPersistentEntity(P persistentProperty) {
|
||||
|
||||
Assert.notNull(persistentProperty, "PersistentProperty must not be null!");
|
||||
Assert.notNull(persistentProperty, "PersistentProperty must not be null");
|
||||
|
||||
if (!persistentProperty.isEntity()) {
|
||||
return null;
|
||||
@@ -293,8 +293,8 @@ public abstract class AbstractMappingContext<E extends MutablePersistentEntity<?
|
||||
@Override
|
||||
public <T> PersistentPropertyPaths<T, P> findPersistentPropertyPaths(Class<T> type, Predicate<? super P> predicate) {
|
||||
|
||||
Assert.notNull(type, "Type must not be null!");
|
||||
Assert.notNull(predicate, "Selection predicate must not be null!");
|
||||
Assert.notNull(type, "Type must not be null");
|
||||
Assert.notNull(predicate, "Selection predicate must not be null");
|
||||
|
||||
return doFindPersistentPropertyPaths(type, predicate, it -> !it.isAssociation());
|
||||
}
|
||||
@@ -333,7 +333,7 @@ public abstract class AbstractMappingContext<E extends MutablePersistentEntity<?
|
||||
*/
|
||||
protected Optional<E> addPersistentEntity(TypeInformation<?> typeInformation) {
|
||||
|
||||
Assert.notNull(typeInformation, "TypeInformation must not be null!");
|
||||
Assert.notNull(typeInformation, "TypeInformation must not be null");
|
||||
|
||||
try {
|
||||
|
||||
@@ -698,7 +698,7 @@ public abstract class AbstractMappingContext<E extends MutablePersistentEntity<?
|
||||
*/
|
||||
public boolean matches(Property property) {
|
||||
|
||||
Assert.notNull(property, "Property must not be null!");
|
||||
Assert.notNull(property, "Property must not be null");
|
||||
|
||||
if (!property.hasAccessor()) {
|
||||
return false;
|
||||
@@ -728,7 +728,7 @@ public abstract class AbstractMappingContext<E extends MutablePersistentEntity<?
|
||||
*/
|
||||
public PropertyMatch(@Nullable String namePattern, @Nullable String typeName) {
|
||||
|
||||
Assert.isTrue(!(namePattern == null && typeName == null), "Either name pattern or type name must be given!");
|
||||
Assert.isTrue(!(namePattern == null && typeName == null), "Either name pattern or type name must be given");
|
||||
|
||||
this.namePattern = namePattern;
|
||||
this.typeName = typeName;
|
||||
@@ -743,8 +743,8 @@ public abstract class AbstractMappingContext<E extends MutablePersistentEntity<?
|
||||
*/
|
||||
public boolean matches(String name, Class<?> type) {
|
||||
|
||||
Assert.notNull(name, "Name must not be null!");
|
||||
Assert.notNull(type, "Type must not be null!");
|
||||
Assert.notNull(name, "Name must not be null");
|
||||
Assert.notNull(type, "Type must not be null");
|
||||
|
||||
if (namePattern != null && !name.matches(namePattern)) {
|
||||
return false;
|
||||
|
||||
@@ -50,7 +50,7 @@ class DefaultPersistentPropertyPath<P extends PersistentProperty<P>> implements
|
||||
*/
|
||||
public DefaultPersistentPropertyPath(List<P> properties) {
|
||||
|
||||
Assert.notNull(properties, "Properties must not be null!");
|
||||
Assert.notNull(properties, "Properties must not be null");
|
||||
|
||||
this.properties = properties;
|
||||
}
|
||||
@@ -73,7 +73,7 @@ class DefaultPersistentPropertyPath<P extends PersistentProperty<P>> implements
|
||||
*/
|
||||
public DefaultPersistentPropertyPath<P> append(P property) {
|
||||
|
||||
Assert.notNull(property, "Property must not be null!");
|
||||
Assert.notNull(property, "Property must not be null");
|
||||
|
||||
if (isEmpty()) {
|
||||
return new DefaultPersistentPropertyPath<>(Collections.singletonList(property));
|
||||
@@ -83,7 +83,7 @@ class DefaultPersistentPropertyPath<P extends PersistentProperty<P>> implements
|
||||
Class<?> leafPropertyType = getLeafProperty().getActualType();
|
||||
|
||||
Assert.isTrue(property.getOwner().getType().equals(leafPropertyType),
|
||||
() -> String.format("Cannot append property %s to type %s!", property.getName(), leafPropertyType.getName()));
|
||||
() -> String.format("Cannot append property %s to type %s", property.getName(), leafPropertyType.getName()));
|
||||
|
||||
List<P> properties = new ArrayList<>(this.properties);
|
||||
properties.add(property);
|
||||
@@ -109,8 +109,8 @@ class DefaultPersistentPropertyPath<P extends PersistentProperty<P>> implements
|
||||
@Nullable
|
||||
public String toPath(String delimiter, Converter<? super P, String> converter) {
|
||||
|
||||
Assert.hasText(delimiter, "Delimiter must not be null or empty!");
|
||||
Assert.notNull(converter, "Converter must not be null!");
|
||||
Assert.hasText(delimiter, "Delimiter must not be null or empty");
|
||||
Assert.notNull(converter, "Converter must not be null");
|
||||
|
||||
String result = properties.stream() //
|
||||
.map(converter::convert) //
|
||||
@@ -132,7 +132,7 @@ class DefaultPersistentPropertyPath<P extends PersistentProperty<P>> implements
|
||||
|
||||
public boolean isBasePathOf(PersistentPropertyPath<P> path) {
|
||||
|
||||
Assert.notNull(path, "PersistentPropertyPath must not be null!");
|
||||
Assert.notNull(path, "PersistentPropertyPath must not be null");
|
||||
|
||||
Iterator<P> iterator = path.iterator();
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ import org.springframework.util.StringUtils;
|
||||
public class InvalidPersistentPropertyPath extends MappingException {
|
||||
|
||||
private static final long serialVersionUID = 2805815643641094488L;
|
||||
private static final String DEFAULT_MESSAGE = "No property '%s' found on %s! Did you mean: %s?";
|
||||
private static final String DEFAULT_MESSAGE = "No property '%s' found on %s; Did you mean: %s";
|
||||
|
||||
private final String source;
|
||||
private final String unresolvableSegment;
|
||||
@@ -57,9 +57,9 @@ public class InvalidPersistentPropertyPath extends MappingException {
|
||||
super(createMessage(resolvedPath.isEmpty() ? type : resolvedPath.getRequiredLeafProperty().getTypeInformation(),
|
||||
unresolvableSegment));
|
||||
|
||||
Assert.notNull(source, "Source property path must not be null!");
|
||||
Assert.notNull(type, "Type must not be null!");
|
||||
Assert.notNull(unresolvableSegment, "Unresolvable segment must not be null!");
|
||||
Assert.notNull(source, "Source property path must not be null");
|
||||
Assert.notNull(type, "Type must not be null");
|
||||
Assert.notNull(unresolvableSegment, "Unresolvable segment must not be null");
|
||||
|
||||
this.source = source;
|
||||
this.type = type;
|
||||
|
||||
@@ -46,8 +46,8 @@ public class MappingContextEvent<E extends PersistentEntity<?, P>, P extends Per
|
||||
|
||||
super(source);
|
||||
|
||||
Assert.notNull(source, "Source MappingContext must not be null!");
|
||||
Assert.notNull(entity, "Entity must not be null!");
|
||||
Assert.notNull(source, "Source MappingContext must not be null");
|
||||
Assert.notNull(entity, "Entity must not be null");
|
||||
|
||||
this.source = source;
|
||||
this.entity = entity;
|
||||
|
||||
@@ -56,7 +56,7 @@ public class PersistentEntities implements Streamable<PersistentEntity<?, ? exte
|
||||
@SuppressWarnings("unchecked")
|
||||
public PersistentEntities(Iterable<? extends MappingContext<?, ?>> contexts) {
|
||||
|
||||
Assert.notNull(contexts, "MappingContexts must not be null!");
|
||||
Assert.notNull(contexts, "MappingContexts must not be null");
|
||||
|
||||
this.contexts = contexts instanceof Collection
|
||||
? (Collection<? extends MappingContext<?, ? extends PersistentProperty<?>>>) contexts
|
||||
@@ -71,7 +71,7 @@ public class PersistentEntities implements Streamable<PersistentEntity<?, ? exte
|
||||
*/
|
||||
public static PersistentEntities of(MappingContext<?, ?>... contexts) {
|
||||
|
||||
Assert.notNull(contexts, "MappingContexts must not be null!");
|
||||
Assert.notNull(contexts, "MappingContexts must not be null");
|
||||
|
||||
return new PersistentEntities(Arrays.asList(contexts));
|
||||
}
|
||||
@@ -110,7 +110,7 @@ public class PersistentEntities implements Streamable<PersistentEntity<?, ? exte
|
||||
*/
|
||||
public PersistentEntity<?, ? extends PersistentProperty<?>> getRequiredPersistentEntity(Class<?> type) {
|
||||
|
||||
Assert.notNull(type, "Domain type must not be null!");
|
||||
Assert.notNull(type, "Domain type must not be null");
|
||||
|
||||
if (contexts.size() == 1) {
|
||||
return contexts.iterator().next().getRequiredPersistentEntity(type);
|
||||
@@ -118,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()));
|
||||
});
|
||||
}
|
||||
@@ -135,8 +135,8 @@ public class PersistentEntities implements Streamable<PersistentEntity<?, ? exte
|
||||
public <T> Optional<T> mapOnContext(Class<?> type,
|
||||
BiFunction<MappingContext<?, ? extends PersistentProperty<?>>, PersistentEntity<?, ?>, T> combiner) {
|
||||
|
||||
Assert.notNull(type, "Type must not be null!");
|
||||
Assert.notNull(combiner, "Combining BiFunction must not be null!");
|
||||
Assert.notNull(type, "Type must not be null");
|
||||
Assert.notNull(combiner, "Combining BiFunction must not be null");
|
||||
|
||||
if (contexts.size() == 1) {
|
||||
return contexts.stream() //
|
||||
@@ -215,7 +215,7 @@ public class PersistentEntities implements Streamable<PersistentEntity<?, ? exte
|
||||
*/
|
||||
public TypeInformation<?> getTypeUltimatelyReferredToBy(PersistentProperty<?> property) {
|
||||
|
||||
Assert.notNull(property, "PersistentProperty must not be null!");
|
||||
Assert.notNull(property, "PersistentProperty must not be null");
|
||||
|
||||
PersistentEntity<?, ? extends PersistentProperty<?>> entity = getEntityUltimatelyReferredToBy(property);
|
||||
|
||||
@@ -254,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);
|
||||
}
|
||||
|
||||
@@ -65,8 +65,8 @@ class PersistentPropertyPathFactory<E extends PersistentEntity<?, P>, P extends
|
||||
*/
|
||||
public PersistentPropertyPath<P> from(Class<?> type, String propertyPath) {
|
||||
|
||||
Assert.notNull(type, "Type must not be null!");
|
||||
Assert.notNull(propertyPath, "Property path must not be null!");
|
||||
Assert.notNull(type, "Type must not be null");
|
||||
Assert.notNull(propertyPath, "Property path must not be null");
|
||||
|
||||
return getPersistentPropertyPath(ClassTypeInformation.from(type), propertyPath);
|
||||
}
|
||||
@@ -80,8 +80,8 @@ class PersistentPropertyPathFactory<E extends PersistentEntity<?, P>, P extends
|
||||
*/
|
||||
public PersistentPropertyPath<P> from(TypeInformation<?> type, String propertyPath) {
|
||||
|
||||
Assert.notNull(type, "Type must not be null!");
|
||||
Assert.notNull(propertyPath, "Property path must not be null!");
|
||||
Assert.notNull(type, "Type must not be null");
|
||||
Assert.notNull(propertyPath, "Property path must not be null");
|
||||
|
||||
return getPersistentPropertyPath(type, propertyPath);
|
||||
}
|
||||
@@ -94,7 +94,7 @@ class PersistentPropertyPathFactory<E extends PersistentEntity<?, P>, P extends
|
||||
*/
|
||||
public PersistentPropertyPath<P> from(PropertyPath path) {
|
||||
|
||||
Assert.notNull(path, "Property path must not be null!");
|
||||
Assert.notNull(path, "Property path must not be null");
|
||||
|
||||
return from(path.getOwningType(), path.toDotPath());
|
||||
}
|
||||
@@ -109,8 +109,8 @@ class PersistentPropertyPathFactory<E extends PersistentEntity<?, P>, P extends
|
||||
*/
|
||||
public <T> PersistentPropertyPaths<T, P> from(Class<T> type, Predicate<? super P> propertyFilter) {
|
||||
|
||||
Assert.notNull(type, "Type must not be null!");
|
||||
Assert.notNull(propertyFilter, "Property filter must not be null!");
|
||||
Assert.notNull(type, "Type must not be null");
|
||||
Assert.notNull(propertyFilter, "Property filter must not be null");
|
||||
|
||||
return from(ClassTypeInformation.from(type), propertyFilter);
|
||||
}
|
||||
@@ -127,9 +127,9 @@ class PersistentPropertyPathFactory<E extends PersistentEntity<?, P>, P extends
|
||||
public <T> PersistentPropertyPaths<T, P> from(Class<T> type, Predicate<? super P> propertyFilter,
|
||||
Predicate<P> traversalGuard) {
|
||||
|
||||
Assert.notNull(type, "Type must not be null!");
|
||||
Assert.notNull(propertyFilter, "Property filter must not be null!");
|
||||
Assert.notNull(traversalGuard, "Traversal guard must not be null!");
|
||||
Assert.notNull(type, "Type must not be null");
|
||||
Assert.notNull(propertyFilter, "Property filter must not be null");
|
||||
Assert.notNull(traversalGuard, "Traversal guard must not be null");
|
||||
|
||||
return from(ClassTypeInformation.from(type), propertyFilter, traversalGuard);
|
||||
}
|
||||
@@ -158,9 +158,9 @@ class PersistentPropertyPathFactory<E extends PersistentEntity<?, P>, P extends
|
||||
public <T> PersistentPropertyPaths<T, P> from(TypeInformation<T> type, Predicate<? super P> propertyFilter,
|
||||
Predicate<P> traversalGuard) {
|
||||
|
||||
Assert.notNull(type, "Type must not be null!");
|
||||
Assert.notNull(propertyFilter, "Property filter must not be null!");
|
||||
Assert.notNull(traversalGuard, "Traversal guard must not be null!");
|
||||
Assert.notNull(type, "Type must not be null");
|
||||
Assert.notNull(propertyFilter, "Property filter must not be null");
|
||||
Assert.notNull(traversalGuard, "Traversal guard must not be null");
|
||||
|
||||
return DefaultPersistentPropertyPaths.of(type,
|
||||
from(type, propertyFilter, traversalGuard, DefaultPersistentPropertyPath.empty()));
|
||||
@@ -369,7 +369,7 @@ class PersistentPropertyPathFactory<E extends PersistentEntity<?, P>, P extends
|
||||
@Override
|
||||
public boolean contains(PropertyPath path) {
|
||||
|
||||
Assert.notNull(path, "PropertyPath must not be null!");
|
||||
Assert.notNull(path, "PropertyPath must not be null");
|
||||
|
||||
if (!path.getOwningType().equals(type)) {
|
||||
return false;
|
||||
@@ -388,7 +388,7 @@ class PersistentPropertyPathFactory<E extends PersistentEntity<?, P>, P extends
|
||||
@Override
|
||||
public PersistentPropertyPaths<T, P> dropPathIfSegmentMatches(Predicate<? super P> predicate) {
|
||||
|
||||
Assert.notNull(predicate, "Predicate must not be null!");
|
||||
Assert.notNull(predicate, "Predicate must not be null");
|
||||
|
||||
List<PersistentPropertyPath<P>> paths = this.stream() //
|
||||
.filter(it -> !it.stream().anyMatch(predicate)) //
|
||||
|
||||
@@ -75,8 +75,8 @@ public abstract class AbstractPersistentProperty<P extends PersistentProperty<P>
|
||||
public AbstractPersistentProperty(Property property, PersistentEntity<?, P> owner,
|
||||
SimpleTypeHolder simpleTypeHolder) {
|
||||
|
||||
Assert.notNull(simpleTypeHolder, "SimpleTypeHolder must not be null!");
|
||||
Assert.notNull(owner, "Owner entity must not be null!");
|
||||
Assert.notNull(simpleTypeHolder, "SimpleTypeHolder must not be null");
|
||||
Assert.notNull(owner, "Owner entity must not be null");
|
||||
|
||||
this.name = property.getName();
|
||||
this.information = owner.getTypeInformation().getRequiredProperty(getName());
|
||||
|
||||
@@ -128,8 +128,8 @@ public abstract class AnnotationBasedPersistentProperty<P extends PersistentProp
|
||||
Annotation mergedAnnotation = AnnotatedElementUtils.getMergedAnnotation(it, annotationType);
|
||||
|
||||
validateAnnotation(mergedAnnotation,
|
||||
"Ambiguous mapping! Annotation %s configured "
|
||||
+ "multiple times on accessor methods of property %s in class %s!",
|
||||
"Ambiguous mapping; Annotation %s configured "
|
||||
+ "multiple times on accessor methods of property %s in class %s",
|
||||
annotationType.getSimpleName(), getName(), getOwner().getType().getSimpleName());
|
||||
|
||||
annotationCache.put(annotationType, Optional.of(mergedAnnotation));
|
||||
@@ -144,7 +144,7 @@ public abstract class AnnotationBasedPersistentProperty<P extends PersistentProp
|
||||
Annotation mergedAnnotation = AnnotatedElementUtils.getMergedAnnotation(it, annotationType);
|
||||
|
||||
validateAnnotation(mergedAnnotation,
|
||||
"Ambiguous mapping! Annotation %s configured " + "on field %s and one of its accessor methods in class %s!",
|
||||
"Ambiguous mapping; Annotation %s configured " + "on field %s and one of its accessor methods in class %s",
|
||||
annotationType.getSimpleName(), it.getName(), getOwner().getType().getSimpleName());
|
||||
|
||||
annotationCache.put(annotationType, Optional.of(mergedAnnotation));
|
||||
@@ -229,7 +229,7 @@ public abstract class AnnotationBasedPersistentProperty<P extends PersistentProp
|
||||
@Nullable
|
||||
public <A extends Annotation> A findAnnotation(Class<A> annotationType) {
|
||||
|
||||
Assert.notNull(annotationType, "Annotation type must not be null!");
|
||||
Assert.notNull(annotationType, "Annotation type must not be null");
|
||||
|
||||
return doFindAnnotation(annotationType).orElse(null);
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ import org.springframework.util.StringUtils;
|
||||
*/
|
||||
public class BasicPersistentEntity<T, P extends PersistentProperty<P>> implements MutablePersistentEntity<T, P> {
|
||||
|
||||
private static final String TYPE_MISMATCH = "Target bean of type %s is not of type of the persistent entity (%s)!";
|
||||
private static final String TYPE_MISMATCH = "Target bean of type %s is not of type of the persistent entity (%s)";
|
||||
|
||||
private final @Nullable InstanceCreatorMetadata<P> creator;
|
||||
private final TypeInformation<T> information;
|
||||
@@ -104,7 +104,7 @@ public class BasicPersistentEntity<T, P extends PersistentProperty<P>> implement
|
||||
*/
|
||||
public BasicPersistentEntity(TypeInformation<T> information, @Nullable Comparator<P> comparator) {
|
||||
|
||||
Assert.notNull(information, "Information must not be null!");
|
||||
Assert.notNull(information, "Information must not be null");
|
||||
|
||||
this.information = information;
|
||||
this.properties = new ArrayList<>();
|
||||
@@ -178,7 +178,7 @@ public class BasicPersistentEntity<T, P extends PersistentProperty<P>> implement
|
||||
|
||||
public void addPersistentProperty(P property) {
|
||||
|
||||
Assert.notNull(property, "Property must not be null!");
|
||||
Assert.notNull(property, "Property must not be null");
|
||||
|
||||
if (properties.contains(property)) {
|
||||
return;
|
||||
@@ -207,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()));
|
||||
}
|
||||
|
||||
@@ -237,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;
|
||||
@@ -245,7 +245,7 @@ public class BasicPersistentEntity<T, P extends PersistentProperty<P>> implement
|
||||
|
||||
public void addAssociation(Association<P> association) {
|
||||
|
||||
Assert.notNull(association, "Association must not be null!");
|
||||
Assert.notNull(association, "Association must not be null");
|
||||
|
||||
associations.add(association);
|
||||
}
|
||||
@@ -259,7 +259,7 @@ public class BasicPersistentEntity<T, P extends PersistentProperty<P>> implement
|
||||
@Override
|
||||
public Iterable<P> getPersistentProperties(Class<? extends Annotation> annotationType) {
|
||||
|
||||
Assert.notNull(annotationType, "Annotation type must not be null!");
|
||||
Assert.notNull(annotationType, "Annotation type must not be null");
|
||||
return propertyAnnotationCache.computeIfAbsent(annotationType, this::doFindPersistentProperty);
|
||||
}
|
||||
|
||||
@@ -292,7 +292,7 @@ public class BasicPersistentEntity<T, P extends PersistentProperty<P>> implement
|
||||
|
||||
public void doWithProperties(PropertyHandler<P> handler) {
|
||||
|
||||
Assert.notNull(handler, "PropertyHandler must not be null!");
|
||||
Assert.notNull(handler, "PropertyHandler must not be null");
|
||||
|
||||
for (P property : persistentPropertiesCache) {
|
||||
handler.doWithPersistentProperty(property);
|
||||
@@ -302,7 +302,7 @@ public class BasicPersistentEntity<T, P extends PersistentProperty<P>> implement
|
||||
@Override
|
||||
public void doWithProperties(SimplePropertyHandler handler) {
|
||||
|
||||
Assert.notNull(handler, "Handler must not be null!");
|
||||
Assert.notNull(handler, "Handler must not be null");
|
||||
|
||||
for (PersistentProperty<?> property : persistentPropertiesCache) {
|
||||
handler.doWithPersistentProperty(property);
|
||||
@@ -311,7 +311,7 @@ public class BasicPersistentEntity<T, P extends PersistentProperty<P>> implement
|
||||
|
||||
public void doWithAssociations(AssociationHandler<P> handler) {
|
||||
|
||||
Assert.notNull(handler, "Handler must not be null!");
|
||||
Assert.notNull(handler, "Handler must not be null");
|
||||
|
||||
for (Association<P> association : associations) {
|
||||
handler.doWithAssociation(association);
|
||||
@@ -320,7 +320,7 @@ public class BasicPersistentEntity<T, P extends PersistentProperty<P>> implement
|
||||
|
||||
public void doWithAssociations(SimpleAssociationHandler handler) {
|
||||
|
||||
Assert.notNull(handler, "Handler must not be null!");
|
||||
Assert.notNull(handler, "Handler must not be null");
|
||||
|
||||
for (Association<? extends PersistentProperty<?>> association : associations) {
|
||||
handler.doWithAssociation(association);
|
||||
@@ -462,7 +462,7 @@ public class BasicPersistentEntity<T, P extends PersistentProperty<P>> implement
|
||||
*/
|
||||
private void verifyBeanType(Object bean) {
|
||||
|
||||
Assert.notNull(bean, "Target bean must not be null!");
|
||||
Assert.notNull(bean, "Target bean must not be null");
|
||||
Assert.isInstanceOf(getType(), bean,
|
||||
() -> String.format(TYPE_MISMATCH, bean.getClass().getName(), getType().getName()));
|
||||
}
|
||||
|
||||
@@ -52,14 +52,14 @@ class BeanWrapper<T> implements PersistentPropertyAccessor<T> {
|
||||
*/
|
||||
protected BeanWrapper(T bean) {
|
||||
|
||||
Assert.notNull(bean, "Bean must not be null!");
|
||||
Assert.notNull(bean, "Bean must not be null");
|
||||
this.bean = bean;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void setProperty(PersistentProperty<?> property, @Nullable Object value) {
|
||||
|
||||
Assert.notNull(property, "PersistentProperty must not be null!");
|
||||
Assert.notNull(property, "PersistentProperty must not be null");
|
||||
|
||||
try {
|
||||
|
||||
@@ -120,7 +120,7 @@ class BeanWrapper<T> implements PersistentPropertyAccessor<T> {
|
||||
@Nullable
|
||||
public <S> Object getProperty(PersistentProperty<?> property, Class<? extends S> type) {
|
||||
|
||||
Assert.notNull(property, "PersistentProperty must not be null!");
|
||||
Assert.notNull(property, "PersistentProperty must not be null");
|
||||
|
||||
try {
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ public class CamelCaseSplittingFieldNamingStrategy implements FieldNamingStrateg
|
||||
*/
|
||||
public CamelCaseSplittingFieldNamingStrategy(String delimiter) {
|
||||
|
||||
Assert.notNull(delimiter, "Delimiter must not be null!");
|
||||
Assert.notNull(delimiter, "Delimiter must not be null");
|
||||
this.delimiter = delimiter;
|
||||
}
|
||||
|
||||
|
||||
@@ -143,7 +143,7 @@ class ClassGeneratingEntityInstantiator implements EntityInstantiator {
|
||||
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug(
|
||||
String.format("Cannot create entity instantiator for %s. Falling back to ReflectionEntityInstantiator.",
|
||||
String.format("Cannot create entity instantiator for %s; Falling back to ReflectionEntityInstantiator",
|
||||
entity.getName()),
|
||||
ex);
|
||||
}
|
||||
@@ -172,7 +172,7 @@ class ClassGeneratingEntityInstantiator implements EntityInstantiator {
|
||||
if (NativeDetector.inNativeImage()) {
|
||||
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug(String.format("graalvm.nativeimage - fall back to reflection for %s.", entity.getName()));
|
||||
LOGGER.debug(String.format("graalvm.nativeimage - fall back to reflection for %s", entity.getName()));
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -575,7 +575,7 @@ class ClassGeneratingEntityInstantiator implements EntityInstantiator {
|
||||
private static void insertAssertNotNull(MethodVisitor mv, String parameterName) {
|
||||
|
||||
// Assert.notNull(property)
|
||||
mv.visitLdcInsn(String.format("Parameter %s must not be null!", parameterName));
|
||||
mv.visitLdcInsn(String.format("Parameter %s must not be null", parameterName));
|
||||
mv.visitMethodInsn(INVOKESTATIC, Type.getInternalName(Assert.class), "notNull", String.format("(%s%s)V",
|
||||
BytecodeUtil.referenceName(JAVA_LANG_OBJECT), BytecodeUtil.referenceName(String.class)), false);
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ public class ClassGeneratingPropertyAccessorFactory implements PersistentPropert
|
||||
@Override
|
||||
public boolean isSupported(PersistentEntity<?, ?> entity) {
|
||||
|
||||
Assert.notNull(entity, "PersistentEntity must not be null!");
|
||||
Assert.notNull(entity, "PersistentEntity must not be null");
|
||||
|
||||
return isClassLoaderDefineClassAvailable(entity) && isTypeInjectable(entity) && hasUniquePropertyHashCodes(entity);
|
||||
}
|
||||
@@ -260,7 +260,7 @@ public class ClassGeneratingPropertyAccessorFactory implements PersistentPropert
|
||||
* // …
|
||||
* }
|
||||
* throw new UnsupportedOperationException(
|
||||
* String.format("No accessor to set property %s!", new Object[] { property }));
|
||||
* String.format("No accessor to set property %s", new Object[] { property }));
|
||||
* }
|
||||
*
|
||||
* public Object getProperty(PersistentProperty<?> property) {
|
||||
@@ -275,7 +275,7 @@ public class ClassGeneratingPropertyAccessorFactory implements PersistentPropert
|
||||
* return bean.field;
|
||||
* // …
|
||||
* throw new UnsupportedOperationException(
|
||||
* String.format("No accessor to get property %s!", new Object[] { property }));
|
||||
* String.format("No accessor to get property %s", new Object[] { property }));
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
@@ -446,7 +446,7 @@ public class ClassGeneratingPropertyAccessorFactory implements PersistentPropert
|
||||
|
||||
// Assert.notNull(bean)
|
||||
mv.visitVarInsn(ALOAD, 1);
|
||||
mv.visitLdcInsn("Bean must not be null!");
|
||||
mv.visitLdcInsn("Bean must not be null");
|
||||
mv.visitMethodInsn(INVOKESTATIC, "org/springframework/util/Assert", "notNull",
|
||||
String.format("(%s%s)V", referenceName(JAVA_LANG_OBJECT), referenceName(JAVA_LANG_STRING)), false);
|
||||
|
||||
@@ -911,7 +911,7 @@ public class ClassGeneratingPropertyAccessorFactory implements PersistentPropert
|
||||
* // …
|
||||
* }
|
||||
* throw new UnsupportedOperationException(
|
||||
* String.format("No accessor to set property %s!", new Object[] { property }));
|
||||
* String.format("No accessor to set property %s", new Object[] { property }));
|
||||
* }
|
||||
* </pre>
|
||||
*/
|
||||
@@ -1240,7 +1240,7 @@ public class ClassGeneratingPropertyAccessorFactory implements PersistentPropert
|
||||
|
||||
// Assert.notNull(property)
|
||||
mv.visitVarInsn(ALOAD, 1);
|
||||
mv.visitLdcInsn("Property must not be null!");
|
||||
mv.visitLdcInsn("Property must not be null");
|
||||
mv.visitMethodInsn(INVOKESTATIC, "org/springframework/util/Assert", "notNull",
|
||||
String.format("(%s%s)V", referenceName(JAVA_LANG_OBJECT), referenceName(JAVA_LANG_STRING)), false);
|
||||
}
|
||||
|
||||
@@ -48,8 +48,8 @@ public class ConvertingPropertyAccessor<T> extends SimplePersistentPropertyPathA
|
||||
|
||||
super(accessor);
|
||||
|
||||
Assert.notNull(accessor, "PersistentPropertyAccessor must not be null!");
|
||||
Assert.notNull(conversionService, "ConversionService must not be null!");
|
||||
Assert.notNull(accessor, "PersistentPropertyAccessor must not be null");
|
||||
Assert.notNull(conversionService, "ConversionService must not be null");
|
||||
|
||||
this.accessor = accessor;
|
||||
this.conversionService = conversionService;
|
||||
@@ -78,8 +78,8 @@ public class ConvertingPropertyAccessor<T> extends SimplePersistentPropertyPathA
|
||||
@Nullable
|
||||
public <S> S getProperty(PersistentProperty<?> property, Class<S> targetType) {
|
||||
|
||||
Assert.notNull(property, "PersistentProperty must not be null!");
|
||||
Assert.notNull(targetType, "Target type must not be null!");
|
||||
Assert.notNull(property, "PersistentProperty must not be null");
|
||||
Assert.notNull(targetType, "Target type must not be null");
|
||||
|
||||
return convertIfNecessary(getProperty(property), targetType);
|
||||
}
|
||||
|
||||
@@ -36,8 +36,8 @@ public class DefaultSpELExpressionEvaluator implements SpELExpressionEvaluator {
|
||||
|
||||
public DefaultSpELExpressionEvaluator(Object source, SpELContext factory) {
|
||||
|
||||
Assert.notNull(source, "Source must not be null!");
|
||||
Assert.notNull(factory, "SpELContext must not be null!");
|
||||
Assert.notNull(source, "Source must not be null");
|
||||
Assert.notNull(factory, "SpELContext must not be null");
|
||||
|
||||
this.source = source;
|
||||
this.factory = factory;
|
||||
|
||||
@@ -71,8 +71,8 @@ public class EntityInstantiators {
|
||||
public EntityInstantiators(EntityInstantiator defaultInstantiator,
|
||||
Map<Class<?>, EntityInstantiator> customInstantiators) {
|
||||
|
||||
Assert.notNull(defaultInstantiator, "DefaultInstantiator must not be null!");
|
||||
Assert.notNull(customInstantiators, "CustomInstantiators must not be null!");
|
||||
Assert.notNull(defaultInstantiator, "DefaultInstantiator must not be null");
|
||||
Assert.notNull(customInstantiators, "CustomInstantiators must not be null");
|
||||
|
||||
this.fallback = defaultInstantiator;
|
||||
this.customInstantiators = customInstantiators;
|
||||
@@ -86,7 +86,7 @@ public class EntityInstantiators {
|
||||
*/
|
||||
public EntityInstantiator getInstantiatorFor(PersistentEntity<?, ?> entity) {
|
||||
|
||||
Assert.notNull(entity, "Entity must not be null!");
|
||||
Assert.notNull(entity, "Entity must not be null");
|
||||
Class<?> type = entity.getType();
|
||||
|
||||
if (!customInstantiators.containsKey(type)) {
|
||||
|
||||
@@ -46,9 +46,9 @@ public class IdPropertyIdentifierAccessor extends TargetAwareIdentifierAccessor
|
||||
|
||||
super(target);
|
||||
|
||||
Assert.notNull(entity, "PersistentEntity must not be null!");
|
||||
Assert.isTrue(entity.hasIdProperty(), "PersistentEntity must have an identifier property!");
|
||||
Assert.notNull(target, "Target bean must not be null!");
|
||||
Assert.notNull(entity, "PersistentEntity must not be null");
|
||||
Assert.isTrue(entity.hasIdProperty(), "PersistentEntity must have an identifier property");
|
||||
Assert.notNull(target, "Target bean must not be null");
|
||||
|
||||
this.idProperty = entity.getRequiredIdProperty();
|
||||
this.accessor = entity.getPropertyAccessor(target);
|
||||
|
||||
@@ -65,7 +65,7 @@ class InstanceCreatorMetadataDiscoverer {
|
||||
|
||||
if (hasAnnotatedConstructor && hasAnnotatedFactoryMethod) {
|
||||
throw new MappingException(
|
||||
"Invalid usage of @Factory and @PersistenceConstructor on %s. Only one annotation type permitted to indicate how entity instances should be created."
|
||||
"Invalid usage of @Factory and @PersistenceConstructor on %s; Only one annotation type permitted to indicate how entity instances should be created"
|
||||
.formatted(entity.getType().getName()));
|
||||
}
|
||||
|
||||
@@ -130,7 +130,7 @@ class InstanceCreatorMetadataDiscoverer {
|
||||
|
||||
if (!Modifier.isStatic(method.getModifiers())) {
|
||||
throw new MappingException(
|
||||
"@PersistenceCreator can only be used on static methods. Offending method: %s".formatted(method));
|
||||
"@PersistenceCreator can only be used on static methods; Offending method: %s".formatted(method));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,8 +39,8 @@ import org.springframework.util.Assert;
|
||||
*/
|
||||
public class InstantiationAwarePropertyAccessor<T> implements PersistentPropertyAccessor<T> {
|
||||
|
||||
private static final String NO_SETTER_OR_CONSTRUCTOR = "Cannot set property %s because no setter, wither or copy constructor exists for %s!";
|
||||
private static final String NO_CONSTRUCTOR_PARAMETER = "Cannot set property %s because no setter, no wither and it's not part of the persistence constructor %s!";
|
||||
private static final String NO_SETTER_OR_CONSTRUCTOR = "Cannot set property %s because no setter, wither or copy constructor exists for %s";
|
||||
private static final String NO_CONSTRUCTOR_PARAMETER = "Cannot set property %s because no setter, no wither and it's not part of the persistence constructor %s";
|
||||
|
||||
private final Function<T, PersistentPropertyAccessor<T>> delegateFunction;
|
||||
private final EntityInstantiators instantiators;
|
||||
@@ -60,9 +60,9 @@ public class InstantiationAwarePropertyAccessor<T> implements PersistentProperty
|
||||
public InstantiationAwarePropertyAccessor(T bean, Function<T, PersistentPropertyAccessor<T>> accessorFunction,
|
||||
EntityInstantiators instantiators) {
|
||||
|
||||
Assert.notNull(bean, "Bean must not be null!");
|
||||
Assert.notNull(accessorFunction, "PersistentPropertyAccessor function must not be null!");
|
||||
Assert.notNull(instantiators, "EntityInstantiators must not be null!");
|
||||
Assert.notNull(bean, "Bean must not be null");
|
||||
Assert.notNull(accessorFunction, "PersistentPropertyAccessor function must not be null");
|
||||
Assert.notNull(instantiators, "EntityInstantiators must not be null");
|
||||
|
||||
this.delegateFunction = accessorFunction;
|
||||
this.instantiators = instantiators;
|
||||
|
||||
@@ -76,7 +76,7 @@ class KotlinCopyMethod {
|
||||
*/
|
||||
public static Optional<KotlinCopyMethod> findCopyMethod(Class<?> type) {
|
||||
|
||||
Assert.notNull(type, "Type must not be null!");
|
||||
Assert.notNull(type, "Type must not be null");
|
||||
|
||||
Optional<Method> syntheticCopyMethod = findSyntheticCopyMethod(type);
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ class PersistentEntityIsNewStrategy implements IsNewStrategy {
|
||||
*/
|
||||
private PersistentEntityIsNewStrategy(PersistentEntity<?, ?> entity, boolean idOnly) {
|
||||
|
||||
Assert.notNull(entity, "PersistentEntity must not be null!");
|
||||
Assert.notNull(entity, "PersistentEntity must not be null");
|
||||
|
||||
this.valueLookup = entity.hasVersionProperty() && !idOnly //
|
||||
? source -> entity.getPropertyAccessor(source).getProperty(entity.getRequiredVersionProperty())
|
||||
@@ -61,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));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -105,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));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ public interface PreferredConstructorDiscoverer<T, P extends PersistentProperty<
|
||||
@Nullable
|
||||
static <T, P extends PersistentProperty<P>> PreferredConstructor<T, P> discover(Class<T> type) {
|
||||
|
||||
Assert.notNull(type, "Type must not be null!");
|
||||
Assert.notNull(type, "Type must not be null");
|
||||
|
||||
return Discoverers.findDiscoverer(type) //
|
||||
.discover(ClassTypeInformation.from(type), null);
|
||||
@@ -75,7 +75,7 @@ public interface PreferredConstructorDiscoverer<T, P extends PersistentProperty<
|
||||
@Nullable
|
||||
static <T, P extends PersistentProperty<P>> PreferredConstructor<T, P> discover(PersistentEntity<T, P> entity) {
|
||||
|
||||
Assert.notNull(entity, "PersistentEntity must not be null!");
|
||||
Assert.notNull(entity, "PersistentEntity must not be null");
|
||||
|
||||
return Discoverers.findDiscoverer(entity.getType()) //
|
||||
.discover(entity.getTypeInformation(), entity);
|
||||
|
||||
@@ -54,8 +54,8 @@ public class Property {
|
||||
|
||||
private Property(TypeInformation<?> type, Optional<Field> field, Optional<PropertyDescriptor> descriptor) {
|
||||
|
||||
Assert.notNull(type, "Type must not be null!");
|
||||
Assert.isTrue(Optionals.isAnyPresent(field, descriptor), "Either field or descriptor has to be given!");
|
||||
Assert.notNull(type, "Type must not be null");
|
||||
Assert.isTrue(Optionals.isAnyPresent(field, descriptor), "Either field or descriptor has to be given");
|
||||
|
||||
this.field = field;
|
||||
this.descriptor = descriptor;
|
||||
@@ -89,7 +89,7 @@ public class Property {
|
||||
*/
|
||||
public static Property of(TypeInformation<?> type, Field field) {
|
||||
|
||||
Assert.notNull(field, "Field must not be null!");
|
||||
Assert.notNull(field, "Field must not be null");
|
||||
|
||||
return new Property(type, Optional.of(field), Optional.empty());
|
||||
}
|
||||
@@ -104,8 +104,8 @@ public class Property {
|
||||
*/
|
||||
public static Property of(TypeInformation<?> type, Field field, PropertyDescriptor descriptor) {
|
||||
|
||||
Assert.notNull(field, "Field must not be null!");
|
||||
Assert.notNull(descriptor, "PropertyDescriptor must not be null!");
|
||||
Assert.notNull(field, "Field must not be null");
|
||||
Assert.notNull(descriptor, "PropertyDescriptor must not be null");
|
||||
|
||||
return new Property(type, Optional.of(field), Optional.of(descriptor));
|
||||
}
|
||||
@@ -121,7 +121,7 @@ public class Property {
|
||||
*/
|
||||
public static Property of(TypeInformation<?> type, PropertyDescriptor descriptor) {
|
||||
|
||||
Assert.notNull(descriptor, "PropertyDescriptor must not be null!");
|
||||
Assert.notNull(descriptor, "PropertyDescriptor must not be null");
|
||||
|
||||
return new Property(type, Optional.empty(), Optional.of(descriptor));
|
||||
}
|
||||
@@ -135,7 +135,7 @@ public class Property {
|
||||
*/
|
||||
public static boolean supportsStandalone(PropertyDescriptor descriptor) {
|
||||
|
||||
Assert.notNull(descriptor, "PropertyDescriptor must not be null!");
|
||||
Assert.notNull(descriptor, "PropertyDescriptor must not be null");
|
||||
|
||||
return descriptor.getPropertyType() != null;
|
||||
}
|
||||
@@ -259,7 +259,7 @@ public class Property {
|
||||
return Optionals.firstNonEmpty(//
|
||||
() -> this.field.map(field), //
|
||||
() -> this.descriptor.map(descriptor))//
|
||||
.orElseThrow(() -> new IllegalStateException("Should not occur! Either field or descriptor has to be given"));
|
||||
.orElseThrow(() -> new IllegalStateException("Should not occur; Either field or descriptor has to be given"));
|
||||
}
|
||||
|
||||
private static Optional<Method> findWither(TypeInformation<?> owner, String propertyName, Class<?> rawType) {
|
||||
|
||||
@@ -66,7 +66,7 @@ enum ReflectionEntityInstantiator implements EntityInstantiator {
|
||||
T t = (T) ReflectionUtils.invokeMethod(method.getFactoryMethod(), null, params);
|
||||
|
||||
if (t == null) {
|
||||
throw new IllegalStateException("Method %s returned null!".formatted(method.getFactoryMethod()));
|
||||
throw new IllegalStateException("Method %s returned null".formatted(method.getFactoryMethod()));
|
||||
}
|
||||
return t;
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -119,8 +119,8 @@ class SimplePersistentPropertyPathAccessor<T> implements PersistentPropertyPathA
|
||||
public void setProperty(PersistentPropertyPath<? extends PersistentProperty<?>> path, @Nullable Object value,
|
||||
SetOptions options) {
|
||||
|
||||
Assert.notNull(path, "PersistentPropertyPath must not be null!");
|
||||
Assert.isTrue(!path.isEmpty(), "PersistentPropertyPath must not be empty!");
|
||||
Assert.notNull(path, "PersistentPropertyPath must not be null");
|
||||
Assert.isTrue(!path.isEmpty(), "PersistentPropertyPath must not be empty");
|
||||
|
||||
PersistentPropertyPath<? extends PersistentProperty<?>> parentPath = path.getParentPath();
|
||||
PersistentProperty<? extends PersistentProperty<?>> leafProperty = path.getRequiredLeafProperty();
|
||||
@@ -199,7 +199,7 @@ class SimplePersistentPropertyPathAccessor<T> implements PersistentPropertyPathA
|
||||
return 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";
|
||||
|
||||
if (SetNulls.SKIP_AND_LOG.equals(handling)) {
|
||||
logger.info(nullIntermediateMessage);
|
||||
@@ -240,8 +240,8 @@ class SimplePersistentPropertyPathAccessor<T> implements PersistentPropertyPathA
|
||||
@Nullable
|
||||
protected <S> S getTypedProperty(PersistentProperty<?> property, Class<S> type) {
|
||||
|
||||
Assert.notNull(property, "Property must not be null!");
|
||||
Assert.notNull(type, "Type must not be null!");
|
||||
Assert.notNull(property, "Property must not be null");
|
||||
Assert.notNull(type, "Type must not be null");
|
||||
|
||||
Object value = getProperty(property);
|
||||
|
||||
@@ -250,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()));
|
||||
}
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ public class SimpleTypeHolder {
|
||||
*/
|
||||
public SimpleTypeHolder(Set<? extends Class<?>> customSimpleTypes, boolean registerDefaults) {
|
||||
|
||||
Assert.notNull(customSimpleTypes, "CustomSimpleTypes must not be null!");
|
||||
Assert.notNull(customSimpleTypes, "CustomSimpleTypes must not be null");
|
||||
|
||||
this.simpleTypes = new WeakHashMap<>(customSimpleTypes.size() + DEFAULTS.size());
|
||||
|
||||
@@ -111,8 +111,8 @@ public class SimpleTypeHolder {
|
||||
*/
|
||||
public SimpleTypeHolder(Set<? extends Class<?>> customSimpleTypes, SimpleTypeHolder source) {
|
||||
|
||||
Assert.notNull(customSimpleTypes, "CustomSimpleTypes must not be null!");
|
||||
Assert.notNull(source, "SourceTypeHolder must not be null!");
|
||||
Assert.notNull(customSimpleTypes, "CustomSimpleTypes must not be null");
|
||||
Assert.notNull(source, "SourceTypeHolder must not be null");
|
||||
|
||||
this.simpleTypes = new WeakHashMap<>(customSimpleTypes.size() + source.simpleTypes.size());
|
||||
|
||||
@@ -140,7 +140,7 @@ public class SimpleTypeHolder {
|
||||
*/
|
||||
public boolean isSimpleType(Class<?> type) {
|
||||
|
||||
Assert.notNull(type, "Type must not be null!");
|
||||
Assert.notNull(type, "Type must not be null");
|
||||
|
||||
Map<Class<?>, Boolean> localSimpleTypes = this.simpleTypes;
|
||||
Boolean isSimpleType = localSimpleTypes.get(type);
|
||||
|
||||
@@ -79,7 +79,7 @@ public class SpELContext {
|
||||
*/
|
||||
private SpELContext(PropertyAccessor accessor, @Nullable SpelExpressionParser parser, @Nullable BeanFactory factory) {
|
||||
|
||||
Assert.notNull(accessor, "PropertyAccessor must not be null!");
|
||||
Assert.notNull(accessor, "PropertyAccessor must not be null");
|
||||
|
||||
this.parser = parser == null ? new SpelExpressionParser() : parser;
|
||||
this.accessor = accessor;
|
||||
|
||||
Reference in New Issue
Block a user