Interface ProjectionFactory
public interface ProjectionFactory
A factory class used for creating dynamic projection classes from a domain class. The system will
use this generated projection as a DTO class to transfer data from an entity instance back and
forth from the exposed endpoint and service layer.
One of the main ways to disable auto creation of projections (and instead create a custom projection from scratch) is to make the domain class implement the BusinessTypeAware interface from the Broadleaf datatracking library and specify an explicit projection class that should be used.
- Author:
- Jeff Fischer
-
Method Summary
Modifier and TypeMethodDescriptionClass<?>
createProjection
(Class<?> repositoryDomain) Create a dynamic projection class for the specified domain class.Class<?>
createProjection
(Class<?> repositoryDomain, String projectionName) Create a dynamic projection class for the specified domain class.Class<?>
getExistingProjectionType
(Class<?> repositoryDomain) Try to ascertain if a known projection type already exists for the specified domain class.
-
Method Details
-
createProjection
Create a dynamic projection class for the specified domain class. Will return null if the system determines that a projection is not necessary (for example, if the domain class implement BusinessTypeAware).- Parameters:
repositoryDomain
- The domain class to inspect and create a projection class from- Returns:
- The dynamic projection class
-
createProjection
Create a dynamic projection class for the specified domain class. Use the projectionName parameter to specify the simple name of the resulting projection class. The projection class will share the same package as the repositoryDomain parameter. Note, the projectionDomain must be different than the simple name of the repositoryDomain.- Parameters:
repositoryDomain
- The domain class to inspect and create a projection class fromprojectionName
- The simple name used to make the simple classname for the projection class- Returns:
- The dynamic projection class
-
getExistingProjectionType
Try to ascertain if a known projection type already exists for the specified domain class. This could be a projection type noted on a superclass. Will return null if no projection type was able to be ascertained for the domain class, or any of its ancestors.- Parameters:
repositoryDomain
- The domain class to inspect for determination of a referenced projection class- Returns:
- The identified projection class, or null if not found
-