Package com.adobe.granite.rest.converter
Interface ResourceConverter<T>
-
- All Known Implementing Classes:
AbstractPageableSirenConverter
,AbstractSirenConverter
@ConsumerType public interface ResourceConverter<T>
ResourceConverter
is an interface describing a Java class that can perform Object-to-Object conversions between model data objects and a representationT
of those objects that is suitable for rendering.Implementors should ensure that a ResourceConverter can be retrieved adapting a
Resource
by implementing anAdapterFactory
.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description T
toEntity(ResourceConverterContext context)
Converts aresource
into an object of typeT
to represent an entity.T
toSubEntity(ResourceConverterContext context)
Converts aresource
to an object of typeT
to represent a sub-entity.
-
-
-
Method Detail
-
toEntity
T toEntity(ResourceConverterContext context) throws ResourceConverterException
Converts aresource
into an object of typeT
to represent an entity.- Parameters:
context
- Converter context- Returns:
- Converted object of type T
- Throws:
ResourceConverterException
- if an error occurs during conversion
-
toSubEntity
T toSubEntity(ResourceConverterContext context) throws ResourceConverterException
Converts aresource
to an object of typeT
to represent a sub-entity. The sub-entity might only contain a subset of information and might be used to represent child elements of a collection.- Parameters:
context
- Converter context- Returns:
- Converted sub-object of type T
- Throws:
ResourceConverterException
- if an error occurs during conversion
-
-