Interface RepresentationFunction

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface RepresentationFunction
Interface implemented by classes that produce representations (see Representation) from response model maps.

Typically, plugins will provide one implementation of this interface for each different response model template used by the plugin. The mapping of the template name to the implementation class is done on the CanSupportHaapi descriptor interface, implemented by any plugin that supports HAAPI.

The apply(RepresentationModel, RepresentationFactory) method will only be called if the response is successful.

If this function is also used to render an error-scoped response model, it should also implement the applyError(ErrorRepresentationModel, ProblemRepresentationFactory) method to create the error representation. If it doesn't, or if it returns Optional.empty(), then a generic error representation will be automatically generated using the response model.

Since:
5.4.0