Browse Source

Polishing.

Add missing Override annotations, consistently use literal tags for boolean values.
issues/transient
Mark Paluch 1 year ago
parent
commit
df6ca3de37
No known key found for this signature in database
GPG Key ID: 55BC6374BAA9D973
  1. 4
      src/main/java/org/springframework/data/auditing/AuditingHandlerSupport.java
  2. 6
      src/main/java/org/springframework/data/domain/Window.java
  3. 2
      src/main/java/org/springframework/data/expression/ValueExpression.java
  4. 2
      src/main/java/org/springframework/data/mapping/Alias.java
  5. 2
      src/main/java/org/springframework/data/mapping/PersistentEntity.java
  6. 4
      src/main/java/org/springframework/data/mapping/model/AnnotationBasedPersistentProperty.java
  7. 2
      src/main/java/org/springframework/data/mapping/model/KotlinValueUtils.java
  8. 17
      src/main/java/org/springframework/data/mapping/model/PersistentEntityParameterValueProvider.java
  9. 4
      src/main/java/org/springframework/data/projection/EntityProjection.java
  10. 4
      src/main/java/org/springframework/data/projection/EntityProjectionIntrospector.java
  11. 2
      src/main/java/org/springframework/data/repository/config/PropertiesBasedNamedQueriesFactoryBean.java
  12. 2
      src/main/java/org/springframework/data/repository/core/RepositoryMethodContextHolder.java
  13. 4
      src/main/java/org/springframework/data/repository/core/support/MethodLookup.java
  14. 4
      src/main/java/org/springframework/data/spel/spi/Function.java
  15. 4
      src/main/java/org/springframework/data/util/KotlinReflectionUtils.java
  16. 8
      src/main/java/org/springframework/data/util/Predicates.java
  17. 2
      src/main/java/org/springframework/data/web/OffsetScrollPositionArgumentResolver.java
  18. 2
      src/main/java/org/springframework/data/web/PageableArgumentResolver.java
  19. 2
      src/main/java/org/springframework/data/web/SortArgumentResolver.java
  20. 2
      src/test/java/org/springframework/data/auditing/AuditingHandlerUnitTests.java

4
src/main/java/org/springframework/data/auditing/AuditingHandlerSupport.java

@ -61,7 +61,7 @@ public abstract class AuditingHandlerSupport { @@ -61,7 +61,7 @@ public abstract class AuditingHandlerSupport {
/**
* Setter do determine if {@link Auditable#setCreatedDate(TemporalAccessor)}} and
* {@link Auditable#setLastModifiedDate(TemporalAccessor)} shall be filled with the current Java time. Defaults to
* {@code true}. One might set this to {@code false} to use database features to set entity time.
* {@literal true}. One might set this to {@literal false} to use database features to set entity time.
*
* @param dateTimeForNow the dateTimeForNow to set
*/
@ -71,7 +71,7 @@ public abstract class AuditingHandlerSupport { @@ -71,7 +71,7 @@ public abstract class AuditingHandlerSupport {
/**
* Set this to true if you want to treat entity creation as modification and thus setting the current date as
* modification date during creation, too. Defaults to {@code true}.
* modification date during creation, too. Defaults to {@literal true}.
*
* @param modifyOnCreation if modification information shall be set on creation, too
*/

6
src/main/java/org/springframework/data/domain/Window.java

@ -68,9 +68,9 @@ public interface Window<T> extends Streamable<T> { @@ -68,9 +68,9 @@ public interface Window<T> extends Streamable<T> {
int size();
/**
* Returns {@code true} if this window contains no elements.
* Returns {@literal true} if this window contains no elements.
*
* @return {@code true} if this window contains no elements
* @return {@literal true} if this window contains no elements
*/
@Override
boolean isEmpty();
@ -102,7 +102,7 @@ public interface Window<T> extends Streamable<T> { @@ -102,7 +102,7 @@ public interface Window<T> extends Streamable<T> {
* Returns whether the underlying scroll mechanism can provide a {@link ScrollPosition} at {@code index}.
*
* @param index
* @return {@code true} if a {@link ScrollPosition} can be created; {@code false} otherwise.
* @return {@literal true} if a {@link ScrollPosition} can be created; {@literal false} otherwise.
* @see #positionAt(int)
*/
default boolean hasPosition(int index) {

2
src/main/java/org/springframework/data/expression/ValueExpression.java

@ -48,7 +48,7 @@ public interface ValueExpression { @@ -48,7 +48,7 @@ public interface ValueExpression {
/**
* Returns whether the expression is a literal expression (that doesn't actually require evaluation).
*
* @return {@code true} if the expression is a literal expression; {@code false} if the expression can yield a
* @return {@literal true} if the expression is a literal expression; {@literal false} if the expression can yield a
* different result upon {@link #evaluate(ValueEvaluationContext) evaluation}.
*/
boolean isLiteral();

2
src/main/java/org/springframework/data/mapping/Alias.java

@ -22,7 +22,7 @@ import org.springframework.util.Assert; @@ -22,7 +22,7 @@ import org.springframework.util.Assert;
/**
* A container object which may or may not contain a type alias value. If a value is present, {@code isPresent()} will
* return {@code true} and {@link #getValue()} will return the value.
* return {@literal true} and {@link #getValue()} will return the value.
* <p>
* Additional methods that depend on the presence or absence of a contained value are provided, such as
* {@link #hasValue(Object)} or {@link #isPresent()}

2
src/main/java/org/springframework/data/mapping/PersistentEntity.java

@ -229,7 +229,7 @@ public interface PersistentEntity<T, P extends PersistentProperty<P>> extends It @@ -229,7 +229,7 @@ public interface PersistentEntity<T, P extends PersistentProperty<P>> extends It
* Returns whether the property is transient.
*
* @param property name of the property.
* @return {@code true} if the property is transient. Applies only for existing properties. {@code false} if the
* @return {@literal true} if the property is transient. Applies only for existing properties. {@literal false} if the
* property does not exist or is not transient.
* @since 3.3
*/

4
src/main/java/org/springframework/data/mapping/model/AnnotationBasedPersistentProperty.java

@ -264,10 +264,10 @@ public abstract class AnnotationBasedPersistentProperty<P extends PersistentProp @@ -264,10 +264,10 @@ public abstract class AnnotationBasedPersistentProperty<P extends PersistentProp
}
/**
* Returns whether the property carries the an annotation of the given type.
* Returns whether the property carries the annotation of the given type.
*
* @param annotationType the annotation type to look up.
* @return
* @return {@literal true} if the annotation is present, {@literal false} otherwise.
*/
@Override
public boolean isAnnotationPresent(Class<? extends Annotation> annotationType) {

2
src/main/java/org/springframework/data/mapping/model/KotlinValueUtils.java

@ -348,7 +348,7 @@ class KotlinValueUtils { @@ -348,7 +348,7 @@ class KotlinValueUtils {
}
/**
* @return {@code true} if the value hierarchy applies boxing.
* @return {@literal true} if the value hierarchy applies boxing.
*/
public boolean appliesBoxing() {
return applyBoxing;

17
src/main/java/org/springframework/data/mapping/model/PersistentEntityParameterValueProvider.java

@ -26,9 +26,7 @@ import org.springframework.lang.Nullable; @@ -26,9 +26,7 @@ import org.springframework.lang.Nullable;
/**
* {@link ParameterValueProvider} based on a {@link PersistentEntity} to use a {@link PropertyValueProvider} to look up
* the value of the property referenced by the given {@link Parameter}. Additionally, a
* {@link DefaultSpELExpressionEvaluator} can be configured to get property value resolution trumped by a SpEL
* expression evaluation.
* the value of the property referenced by the given {@link Parameter}.
*
* @author Oliver Gierke
* @author Johannes Englmeier
@ -42,18 +40,13 @@ public class PersistentEntityParameterValueProvider<P extends PersistentProperty @@ -42,18 +40,13 @@ public class PersistentEntityParameterValueProvider<P extends PersistentProperty
private final @Nullable Object parent;
public PersistentEntityParameterValueProvider(PersistentEntity<?, P> entity, PropertyValueProvider<P> provider,
Object parent) {
@Nullable Object parent) {
this.entity = entity;
this.provider = provider;
this.parent = parent;
}
@Override
@Nullable
private static Object getTransientDefault(Class<?> parameterType) {
return parameterType.isPrimitive() ? ReflectionUtils.getPrimitiveDefault(parameterType) : null;
}
@Nullable
@SuppressWarnings("unchecked")
public <T> T getParameterValue(Parameter<T, P> parameter) {
@ -82,4 +75,10 @@ public class PersistentEntityParameterValueProvider<P extends PersistentProperty @@ -82,4 +75,10 @@ public class PersistentEntityParameterValueProvider<P extends PersistentProperty
return provider.getPropertyValue(property);
}
@Nullable
private static Object getTransientDefault(Class<?> parameterType) {
return parameterType.isPrimitive() ? ReflectionUtils.getPrimitiveDefault(parameterType) : null;
}
}

4
src/main/java/org/springframework/data/projection/EntityProjection.java

@ -158,14 +158,14 @@ public class EntityProjection<M, D> implements Streamable<EntityProjection.Prope @@ -158,14 +158,14 @@ public class EntityProjection<M, D> implements Streamable<EntityProjection.Prope
}
/**
* @return {@code true} if the {@link #getMappedType()} is a projection.
* @return {@literal true} if the {@link #getMappedType()} is a projection.
*/
public boolean isProjection() {
return projection;
}
/**
* @return {@code true} if the {@link #getMappedType()} is a closed projection.
* @return {@literal true} if the {@link #getMappedType()} is a closed projection.
*/
public boolean isClosedProjection() {
return isProjection()

4
src/main/java/org/springframework/data/projection/EntityProjectionIntrospector.java

@ -222,13 +222,13 @@ public class EntityProjectionIntrospector { @@ -222,13 +222,13 @@ public class EntityProjectionIntrospector {
*
* @param target the target type.
* @param underlyingType the underlying type.
* @return {@code true} if the input argument matches the predicate, otherwise {@code false}.
* @return {@literal true} if the input argument matches the predicate, otherwise {@literal false}.
*/
boolean test(Class<?> target, Class<?> underlyingType);
/**
* Return a composed predicate that represents a short-circuiting logical AND of this predicate and another. When
* evaluating the composed predicate, if this predicate is {@code false}, then the {@code other} predicate is not
* evaluating the composed predicate, if this predicate is {@literal false}, then the {@code other} predicate is not
* evaluated.
* <p>
* Any exceptions thrown during evaluation of either predicate are relayed to the caller; if evaluation of this

2
src/main/java/org/springframework/data/repository/config/PropertiesBasedNamedQueriesFactoryBean.java

@ -47,7 +47,7 @@ public class PropertiesBasedNamedQueriesFactoryBean extends PropertiesLoaderSupp @@ -47,7 +47,7 @@ public class PropertiesBasedNamedQueriesFactoryBean extends PropertiesLoaderSupp
* Set whether a shared singleton {@code PropertiesBasedNamedQueries} instance should be created, or rather a new
* {@code PropertiesBasedNamedQueries} instance on each request.
* <p>
* Default is {@code true} (a shared singleton).
* Default is {@literal true} (a shared singleton).
*/
public void setSingleton(boolean singleton) {
this.singleton = singleton;

2
src/main/java/org/springframework/data/repository/core/RepositoryMethodContextHolder.java

@ -34,7 +34,7 @@ public class RepositoryMethodContextHolder { @@ -34,7 +34,7 @@ public class RepositoryMethodContextHolder {
/**
* ThreadLocal holder for repository method associated with this thread. Will contain {@code null} unless the
* "exposeMetadata" property on the controlling repository factory configuration has been set to {@code true}.
* "exposeMetadata" property on the controlling repository factory configuration has been set to {@literal true}.
*/
private static final ThreadLocal<RepositoryMethodContext> currentMethod = new NamedThreadLocal<>(
"Current Repository Method");

4
src/main/java/org/springframework/data/repository/core/support/MethodLookup.java

@ -49,8 +49,8 @@ public interface MethodLookup { @@ -49,8 +49,8 @@ public interface MethodLookup {
/**
* Returns a composed {@link MethodLookup} that represents a concatenation of this predicate and another. When
* evaluating the composed method lookup, if this lookup evaluates {@code true}, then the {@code other} method lookup
* is not evaluated.
* evaluating the composed method lookup, if this lookup evaluates {@literal true}, then the {@code other} method
* lookup is not evaluated.
*
* @param other must not be {@literal null}.
* @return the composed {@link MethodLookup}.

4
src/main/java/org/springframework/data/spel/spi/Function.java

@ -152,7 +152,7 @@ public class Function { @@ -152,7 +152,7 @@ public class Function {
* Checks if the encapsulated method has exactly the argument types as those passed as an argument.
*
* @param argumentTypes a list of {@link TypeDescriptor}s to compare with the argument types of the method
* @return {@code true} if the types are equal, {@code false} otherwise.
* @return {@literal true} if the types are equal, {@literal false} otherwise.
*/
public boolean supportsExact(List<TypeDescriptor> argumentTypes) {
return ParameterTypes.of(argumentTypes).exactlyMatchParametersOf(method);
@ -162,7 +162,7 @@ public class Function { @@ -162,7 +162,7 @@ public class Function {
* Checks whether this {@code Function} has the same signature as another {@code Function}.
*
* @param other the {@code Function} to compare {@code this} with.
* @return {@code true} if name and argument list are the same.
* @return {@literal true} if name and argument list are the same.
*/
public boolean isSignatureEqual(Function other) {

4
src/main/java/org/springframework/data/util/KotlinReflectionUtils.java

@ -136,7 +136,7 @@ public final class KotlinReflectionUtils { @@ -136,7 +136,7 @@ public final class KotlinReflectionUtils {
* Returns whether the given {@link KType} is a {@link KClass#isValue() value} class.
*
* @param type the kotlin type to inspect.
* @return {@code true} the type is a value class.
* @return {@literal true} the type is a value class.
* @since 3.2
*/
public static boolean isValueClass(KType type) {
@ -148,7 +148,7 @@ public final class KotlinReflectionUtils { @@ -148,7 +148,7 @@ public final class KotlinReflectionUtils {
* Returns whether the given class makes uses Kotlin {@link KClass#isValue() value} classes.
*
* @param type the kotlin type to inspect.
* @return {@code true} when at least one property uses Kotlin value classes.
* @return {@literal true} when at least one property uses Kotlin value classes.
* @since 3.2
*/
public static boolean hasValueClassProperty(Class<?> type) {

8
src/main/java/org/springframework/data/util/Predicates.java

@ -52,18 +52,18 @@ public interface Predicates { @@ -52,18 +52,18 @@ public interface Predicates {
Predicate<Method> IS_BRIDGE_METHOD = Method::isBridge;
/**
* A {@link Predicate} that yields always {@code true}.
* A {@link Predicate} that yields always {@literal true}.
*
* @return a {@link Predicate} that yields always {@code true}.
* @return a {@link Predicate} that yields always {@literal true}.
*/
static <T> Predicate<T> isTrue() {
return t -> true;
}
/**
* A {@link Predicate} that yields always {@code false}.
* A {@link Predicate} that yields always {@literal false}.
*
* @return a {@link Predicate} that yields always {@code false}.
* @return a {@link Predicate} that yields always {@literal false}.
*/
static <T> Predicate<T> isFalse() {
return t -> false;

2
src/main/java/org/springframework/data/web/OffsetScrollPositionArgumentResolver.java

@ -42,7 +42,7 @@ public interface OffsetScrollPositionArgumentResolver extends HandlerMethodArgum @@ -42,7 +42,7 @@ public interface OffsetScrollPositionArgumentResolver extends HandlerMethodArgum
* wrapped arguments in {@link java.util.Optional}.
*
* @param parameter the method parameter to resolve. This parameter must have previously been passed to
* {@link #supportsParameter} which must have returned {@code true}.
* {@link #supportsParameter} which must have returned {@literal true}.
* @param mavContainer the ModelAndViewContainer for the current request
* @param webRequest the current request
* @param binderFactory a factory for creating {@link WebDataBinder} instances

2
src/main/java/org/springframework/data/web/PageableArgumentResolver.java

@ -40,7 +40,7 @@ public interface PageableArgumentResolver extends HandlerMethodArgumentResolver @@ -40,7 +40,7 @@ public interface PageableArgumentResolver extends HandlerMethodArgumentResolver
* Resolves a {@link Pageable} method parameter into an argument value from a given request.
*
* @param parameter the method parameter to resolve. This parameter must have previously been passed to
* {@link #supportsParameter} which must have returned {@code true}.
* {@link #supportsParameter} which must have returned {@literal true}.
* @param mavContainer the ModelAndViewContainer for the current request
* @param webRequest the current request
* @param binderFactory a factory for creating {@link WebDataBinder} instances

2
src/main/java/org/springframework/data/web/SortArgumentResolver.java

@ -40,7 +40,7 @@ public interface SortArgumentResolver extends HandlerMethodArgumentResolver { @@ -40,7 +40,7 @@ public interface SortArgumentResolver extends HandlerMethodArgumentResolver {
* Resolves a {@link Sort} method parameter into an argument value from a given request.
*
* @param parameter the method parameter to resolve. This parameter must have previously been passed to
* {@link #supportsParameter} which must have returned {@code true}.
* {@link #supportsParameter} which must have returned {@literal true}.
* @param mavContainer the ModelAndViewContainer for the current request
* @param webRequest the current request
* @param binderFactory a factory for creating {@link WebDataBinder} instances

2
src/test/java/org/springframework/data/auditing/AuditingHandlerUnitTests.java

@ -96,7 +96,7 @@ class AuditingHandlerUnitTests { @@ -96,7 +96,7 @@ class AuditingHandlerUnitTests {
}
/**
* Checks that the advice does not set modification information on creation if the falg is set to {@code false}.
* Checks that the advice does not set modification information on creation if the falg is set to {@literal false}.
*/
@Test
void honoursModifiedOnCreationFlag() {

Loading…
Cancel
Save