Skip to content

Commit

Permalink
Polishing.
Browse files Browse the repository at this point in the history
Add missing Override annotations, consistently use literal tags for boolean values.
  • Loading branch information
mp911de committed Nov 4, 2024
1 parent e15ea58 commit df6ca3d
Show file tree
Hide file tree
Showing 20 changed files with 39 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public AuditingHandlerSupport(PersistentEntities entities) {
/**
* 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
*/
Expand All @@ -71,7 +71,7 @@ public void setDateTimeForNow(boolean dateTimeForNow) {

/**
* 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
*/
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/org/springframework/data/domain/Window.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ static <T> Window<T> from(List<T> items, IntFunction<? extends ScrollPosition> p
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();
Expand Down Expand Up @@ -102,7 +102,7 @@ default boolean isLast() {
* 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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ default ExpressionDependencies getExpressionDependencies() {
/**
* 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();
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/springframework/data/mapping/Alias.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

/**
* 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()}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ default P getPersistentProperty(Class<? extends Annotation> annotationType) {
* 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
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,10 +264,10 @@ public <A extends Annotation> A findPropertyOrOwnerAnnotation(Class<A> annotatio
}

/**
* 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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ public Class<?> getParameterType() {
}

/**
* @return {@code true} if the value hierarchy applies boxing.
* @return {@literal true} if the value hierarchy applies boxing.
*/
public boolean appliesBoxing() {
return applyBoxing;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@

/**
* {@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
Expand All @@ -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) {
Expand Down Expand Up @@ -82,4 +75,10 @@ public <T> T getParameterValue(Parameter<T, P> parameter) {

return provider.getPropertyValue(property);
}

@Nullable
private static Object getTransientDefault(Class<?> parameterType) {
return parameterType.isPrimitive() ? ReflectionUtils.getPrimitiveDefault(parameterType) : null;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -158,14 +158,14 @@ public TypeInformation<?> getActualDomainType() {
}

/**
* @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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,13 +222,13 @@ public interface ProjectionPredicate {
*
* @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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}.
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/springframework/data/spel/spi/Function.java
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public int getParameterCount() {
* 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);
Expand All @@ -162,7 +162,7 @@ public boolean supportsExact(List<TypeDescriptor> argumentTypes) {
* 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) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public static Class<?> getReturnType(Method method) {
* 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) {
Expand All @@ -148,7 +148,7 @@ public static boolean isValueClass(KType type) {
* 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) {
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/org/springframework/data/util/Predicates.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ void setsAuditorIfConfigured() {
}

/**
* 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() {
Expand Down

0 comments on commit df6ca3d

Please sign in to comment.