Class ProjectionDefinitionConfiguration

java.lang.Object
org.springframework.data.rest.core.config.ProjectionDefinitionConfiguration
All Implemented Interfaces:
ProjectionDefinitions

public class ProjectionDefinitionConfiguration extends Object implements ProjectionDefinitions
Wrapper class to register projection definitions for later lookup by name and source type.
Author:
Oliver Gierke
  • Constructor Details

  • Method Details

    • getParameterName

      public String getParameterName()
      Description copied from interface: ProjectionDefinitions
      Returns the request parameter to be used to expose the projection to the web.
      Specified by:
      getParameterName in interface ProjectionDefinitions
      Returns:
      the parameterName will never be null or empty.
    • setParameterName

      public void setParameterName(String parameterName)
      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

      public ProjectionDefinitionConfiguration addProjection(Class<?> projectionType)
      Adds the given projection type to the configuration. The type has to be annotated with Projection for 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

      public Class<?> getProjectionType(Class<?> sourceType, String name)
      Description copied from interface: ProjectionDefinitions
      Returns the projection type for the given source type and name.
      Specified by:
      getProjectionType in interface ProjectionDefinitions
      Parameters:
      sourceType - must not be null.
      name - must not be null or empty.
      Returns:
    • hasProjectionFor

      public boolean hasProjectionFor(Class<?> sourceType)
      Description copied from interface: ProjectionDefinitions
      Returns whether we have a projection registered for the given source type.
      Specified by:
      hasProjectionFor in interface ProjectionDefinitions
      Parameters:
      sourceType - must not be null.
      Returns:
    • getProjectionsFor

      public Map<String,Class<?>> getProjectionsFor(Class<?> sourceType)
      Returns all projections registered for the given source type.
      Parameters:
      sourceType - must not be null.
      Returns: