Class ProjectionDefinitionConfiguration
java.lang.Object
org.springframework.data.rest.core.config.ProjectionDefinitionConfiguration
- All Implemented Interfaces:
ProjectionDefinitions
Wrapper class to register projection definitions for later lookup by name and source type.
- Author:
- Oliver Gierke
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddProjection(Class<?> projectionType) Adds the given projection type to the configuration.addProjection(Class<?> projectionType, Class<?>... sourceTypes) Adds a projection type for the given source types.addProjection(Class<?> projectionType, String name, Class<?>... sourceTypes) Adds the given projection type for the given source types under the given name.Returns the request parameter to be used to expose the projection to the web.getProjectionsFor(Class<?> sourceType) Returns all projections registered for the given source type.Class<?>getProjectionType(Class<?> sourceType, String name) Returns the projection type for the given source type and name.booleanhasProjectionFor(Class<?> sourceType) Returns whether we have a projection registered for the given source type.voidsetParameterName(String parameterName) Configures the request parameter name to be used to accept the projection name to be returned.
-
Constructor Details
-
ProjectionDefinitionConfiguration
public ProjectionDefinitionConfiguration()Creates a newProjectionDefinitionConfiguration.
-
-
Method Details
-
getParameterName
Description copied from interface:ProjectionDefinitionsReturns the request parameter to be used to expose the projection to the web.- Specified by:
getParameterNamein interfaceProjectionDefinitions- Returns:
- the parameterName will never be null or empty.
-
setParameterName
Configures the request parameter name to be used to accept the projection name to be returned.- Parameters:
parameterName- defaults to "projection", will be set back to this default if null or an empty value is configured.
-
addProjection
Adds the given projection type to the configuration. The type has to be annotated withProjectionfor additional metadata.- Parameters:
projectionType- must not be null.- Returns:
- See Also:
-
addProjection
public ProjectionDefinitionConfiguration addProjection(Class<?> projectionType, Class<?>... sourceTypes) Adds a projection type for the given source types. The name of the projection will be defaulted to the uncapitalized simply class name.- Parameters:
projectionType- must not be null.sourceTypes- must not be null or empty.- Returns:
-
addProjection
public ProjectionDefinitionConfiguration addProjection(Class<?> projectionType, String name, Class<?>... sourceTypes) Adds the given projection type for the given source types under the given name.- Parameters:
projectionType- must not be null.name- must not be null or empty.sourceTypes- must not be null or empty.- Returns:
-
getProjectionType
Description copied from interface:ProjectionDefinitionsReturns the projection type for the given source type and name.- Specified by:
getProjectionTypein interfaceProjectionDefinitions- Parameters:
sourceType- must not be null.name- must not be null or empty.- Returns:
-
hasProjectionFor
Description copied from interface:ProjectionDefinitionsReturns whether we have a projection registered for the given source type.- Specified by:
hasProjectionForin interfaceProjectionDefinitions- Parameters:
sourceType- must not be null.- Returns:
-
getProjectionsFor
Returns all projections registered for the given source type.- Parameters:
sourceType- must not be null.- Returns:
-