#1930 - Polish Javadoc and nullability.

This commit is contained in:
Oliver Drotbohm
2023-03-17 11:57:48 +01:00
parent c9dc4d1580
commit 6b7a359d78
5 changed files with 21 additions and 15 deletions

View File

@@ -60,6 +60,7 @@ public class CollectionModel<T> extends RepresentationModel<CollectionModel<T>>
protected CollectionModel(Iterable<T> content, Iterable<Link> links, @Nullable ResolvableType fallbackType) {
Assert.notNull(content, "Content must not be null!");
Assert.notNull(links, "Links must not be null!");
this.content = new ArrayList<>();

View File

@@ -19,6 +19,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
@@ -237,7 +238,7 @@ public class PagedModel<T> extends CollectionModel<T> {
*
* @param content must not be {@literal null}.
* @param metadata can be {@literal null}.
* @param links
* @return will never be {@literal null}.
*/
public static <T> PagedModel<T> of(Collection<T> content, @Nullable PageMetadata metadata) {
return new PagedModel<>(content, metadata);
@@ -248,10 +249,11 @@ public class PagedModel<T> extends CollectionModel<T> {
*
* @param content must not be {@literal null}.
* @param metadata can be {@literal null}.
* @param links
* @param links must not be {@literal null}.
* @return will never be {@literal null}.
*/
public static <T> PagedModel<T> of(Collection<T> content, @Nullable PageMetadata metadata, Link... links) {
return new PagedModel<>(content, metadata, Arrays.asList(links));
return new PagedModel<>(content, metadata, List.of(links));
}
/**
@@ -259,7 +261,7 @@ public class PagedModel<T> extends CollectionModel<T> {
*
* @param content must not be {@literal null}.
* @param metadata can be {@literal null}.
* @param links
* @param links must not be {@literal null}.
*/
public static <T> PagedModel<T> of(Collection<T> content, @Nullable PageMetadata metadata, Iterable<Link> links) {
return new PagedModel<>(content, metadata, links);

View File

@@ -25,8 +25,8 @@ import org.springframework.util.Assert;
/**
* Accessor to links pointing to controllers backing an entity type. The {@link IllegalArgumentException} potentially
* thrown by the declared methods will only appear if the {@link Plugin#supports(Class)} method has returned
* {@literal false} and the method has been invoked anyway, i.e. if {@link Plugin#supports(Class)} returns
* thrown by the declared methods will only appear if the {@code Plugin#supports(Class)} method has returned
* {@literal false} and the method has been invoked anyway, i.e. if {@code Plugin#supports(Class)} returns
* {@literal true} it's safe to invoke the interface methods an the exception will never be thrown.
*
* @author Oliver Gierke

View File

@@ -46,7 +46,7 @@ public class TypedEntityLinks<T> {
* Returns a {@link LinkBuilder} able to create links to the controller managing the given entity. Implementations
* will know about the URI structure being used to expose item-resource URIs.
*
* @param type the entity to point to, must not be {@literal null}.
* @param entity the entity to point to, must not be {@literal null}.
* @return the {@link LinkBuilder} pointing to the item resource identified by the given entity. Will never be
* {@literal null}.
* @throws IllegalArgumentException in case the given type is unknown the entity links infrastructure.
@@ -59,7 +59,7 @@ public class TypedEntityLinks<T> {
* Creates a {@link Link} pointing to item resource backing the given entity. The relation type of the link will be
* determined by the implementation class and should be defaulted to {@link IanaLinkRelations#SELF}.
*
* @param type the entity to point to, must not be {@literal null}.
* @param entity the entity to point to, must not be {@literal null}.
* @return the {@link Link} pointing to the resource exposed for the given entity. Will never be {@literal null}.
* @throws IllegalArgumentException in case the given type is unknown the entity links infrastructure.
*/
@@ -91,7 +91,6 @@ public class TypedEntityLinks<T> {
* Creates a {@link Link} pointing to the collection resource of the configured type. The relation type of the link
* will be determined by the implementation class and should be defaulted to {@link IanaLinkRelations#SELF}.
*
* @param type the entity type to point to, must not be {@literal null}.
* @return the {@link Link} pointing to the collection resource exposed for the configured entity type. Will never
* be {@literal null}.
* @throws IllegalArgumentException in case the given type is unknown the entity links infrastructure.

View File

@@ -36,8 +36,9 @@ public interface SimpleReactiveRepresentationModelAssembler<T>
/**
* Converts the given entity into a {@link EntityModel} wrapped in a {@link Mono}.
*
* @param entity
* @return
* @param entity must not be {@literal null}.
* @param exchange must not be {@literal null}.
* @return will never be {@literal null}.
*/
@Override
default Mono<EntityModel<T>> toModel(T entity, ServerWebExchange exchange) {
@@ -49,7 +50,9 @@ public interface SimpleReactiveRepresentationModelAssembler<T>
/**
* Define links to add to every individual {@link EntityModel}.
*
* @param resource
* @param resource must not be {@literal null}.
* @param exchange must not be {@literal null}.
* @return will never be {@literal null}.
*/
default EntityModel<T> addLinks(EntityModel<T> resource, ServerWebExchange exchange) {
return resource;
@@ -58,9 +61,9 @@ public interface SimpleReactiveRepresentationModelAssembler<T>
/**
* Converts all given entities into resources and wraps the collection as a resource as well.
*
* @see #toResource(Object, ServerWebExchange)
* @see #toModel(Object, ServerWebExchange)
* @param entities must not be {@literal null}.
* @return {@link CollectionModel} containing {@link EntityModel} of {@code T}.
* @return {@link CollectionModel} containing {@link EntityModel} of {@code T}, will never be {@literal null}..
*/
default Mono<CollectionModel<EntityModel<T>>> toCollectionModel(Flux<? extends T> entities,
ServerWebExchange exchange) {
@@ -75,7 +78,8 @@ public interface SimpleReactiveRepresentationModelAssembler<T>
/**
* Define links to add to the {@link CollectionModel} collection.
*
* @param resources
* @param resources must not be {@literal null}.
* @return will never be {@literal null}.
*/
default CollectionModel<EntityModel<T>> addLinks(CollectionModel<EntityModel<T>> resources,
ServerWebExchange exchange) {