Interface Projection<T>
-
- Type Parameters:
T
- The type of the original domain class describing the data available in this projection.
- All Superinterfaces:
ReferenceAware<T>
,Serializable
public interface Projection<T> extends Serializable, ReferenceAware<T>
Represents a projection class mapping to a persisted domain class. This is usually implemented concretely (especially during projection auto-generation) with additional fields describing interesting attributes of the persisted domain (or synthetic attributes) incoming and outgoing from the service API.- Author:
- Jeff Fischer
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default T
expose()
Projections are generated automatically by the system at runtime based on the related domain class.static <T> Projection<T>
get(Class<T> from)
RetrieveProjection
instance referencing the persistence domain class type.static <T> Projection<T>
get(Class<T> from, String id)
RetrieveProjection
instance referencing the persistence domain class type.String
getId()
Projections are expected to have an id field as a first class citizen.void
setId(String id)
Projections are expected to have an id field as a first class citizen.-
Methods inherited from interface com.broadleafcommerce.common.extension.projection.ReferenceAware
getProjectionReference
-
-
-
-
Method Detail
-
get
static <T> Projection<T> get(Class<T> from)
RetrieveProjection
instance referencing the persistence domain class type. SeeProjectionFactory
for more information on dynamic projections.- Type Parameters:
T
- The persistence domain class type- Parameters:
from
- The persistence domain class the projection instances references- Returns:
- The instantiated instance implementing Projection.
-
get
static <T> Projection<T> get(Class<T> from, String id)
RetrieveProjection
instance referencing the persistence domain class type. SeeProjectionFactory
for more information on dynamic projections.- Type Parameters:
T
- The persistence domain class type- Parameters:
from
- The persistence domain class the projection instances referencesid
- The id value to set on the projection instance (seegetId()
)- Returns:
- The instantiated instance implementing Projection.
-
getId
String getId()
Projections are expected to have an id field as a first class citizen. For projections related to Trackable domain, this id will relate to the contextId field.- Returns:
- The identification field reported for the related domain class
-
setId
void setId(String id)
Projections are expected to have an id field as a first class citizen. For projections related to Trackable domain, this id will relate to the contextId field.- Parameters:
id
- The identification field reported for the related domain class
-
expose
default T expose()
Projections are generated automatically by the system at runtime based on the related domain class. As such, the API internally exposed on the projection is similar to the related domain class API. This method provides exposure of the domain class API, but invocations are instead transparently invoked against the projection instance. SeeInvocationUtils
for more information on what is taking place behind the scenes.- Returns:
- An instance of this projection callable from the API of
<T>
.
-
-