DS-3533 Adjust javadocs

This commit is contained in:
Chris Wilper
2020-02-06 09:12:03 -05:00
parent 241289a2f9
commit b1d54273de
5 changed files with 18 additions and 7 deletions

View File

@@ -19,8 +19,7 @@ import org.dspace.app.rest.utils.Utils;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
/** /**
* Class or method-level annotation to control linking/embedding behavior when a {@link RestModel} * Class or method-level annotation to provide information about linked/embedded subresources of a {@link RestModel}.
* is wrapped as a {@link HALResource}
* *
* @author Andrea Bollini (andrea.bollini at 4science.it) * @author Andrea Bollini (andrea.bollini at 4science.it)
*/ */

View File

@@ -12,8 +12,9 @@ import org.dspace.app.rest.model.RestModel;
import org.dspace.app.rest.model.hateoas.HALResource; import org.dspace.app.rest.model.hateoas.HALResource;
/** /**
* Abstract base class for projections. By default no transformation is done, optional embeds are not included, * Abstract base class for projections.
* and optional links are included. *
* By default, this does no transformation, and allows linking but not embedding of all subresources.
*/ */
public abstract class AbstractProjection implements Projection { public abstract class AbstractProjection implements Projection {

View File

@@ -8,7 +8,9 @@
package org.dspace.app.rest.projection; package org.dspace.app.rest.projection;
/** /**
* The default projection, which has no effect. * The default projection.
*
* This does no transformation, and allows linking but not embedding of all subresources.
*/ */
public class DefaultProjection extends AbstractProjection { public class DefaultProjection extends AbstractProjection {

View File

@@ -11,6 +11,9 @@ import org.dspace.app.rest.model.LinkRest;
import org.dspace.app.rest.model.hateoas.HALResource; import org.dspace.app.rest.model.hateoas.HALResource;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
/**
* Catch-all projection that allows embedding of all subresources.
*/
@Component @Component
public class FullProjection extends AbstractProjection { public class FullProjection extends AbstractProjection {

View File

@@ -106,10 +106,13 @@ public interface Projection {
<T extends HALResource> T transformResource(T halResource); <T extends HALResource> T transformResource(T halResource);
/** /**
* Tells whether this projection permits the embedding of a particular optionally-embeddable related resource. * Tells whether this projection permits the embedding of a particular embeddable subresource.
* *
* This gives the projection an opportunity to opt in to to certain embeds, by returning {@code true}. * This gives the projection an opportunity to opt in to to certain embeds, by returning {@code true}.
* *
* Note: If this method returns {@code true} for a given subresource,
* it will be automatically linked regardless of what {@link #allowLinking(HALResource, LinkRest)} returns.
*
* @param halResource the resource from which the embed may or may not be made. * @param halResource the resource from which the embed may or may not be made.
* @param linkRest the LinkRest annotation through which the related resource was discovered on the rest object. * @param linkRest the LinkRest annotation through which the related resource was discovered on the rest object.
* @return true if allowed, false otherwise. * @return true if allowed, false otherwise.
@@ -117,10 +120,13 @@ public interface Projection {
boolean allowEmbedding(HALResource halResource, LinkRest linkRest); boolean allowEmbedding(HALResource halResource, LinkRest linkRest);
/** /**
* Tells whether this projection permits the linking of a particular optionally-linkable related resource. * Tells whether this projection permits the linking of a particular linkable subresource.
* *
* This gives the projection an opportunity to opt in to to certain links, by returning {@code true}. * This gives the projection an opportunity to opt in to to certain links, by returning {@code true}.
* *
* Note: If {@link #allowEmbedding(HALResource, LinkRest)} returns {@code true} for a given subresource,
* it will be automatically linked regardless of what this method returns.
*
* @param halResource the resource from which the link may or may not be made. * @param halResource the resource from which the link may or may not be made.
* @param linkRest the LinkRest annotation through which the related resource was discovered on the rest object. * @param linkRest the LinkRest annotation through which the related resource was discovered on the rest object.
* @return true if allowed, false otherwise. * @return true if allowed, false otherwise.