Interface Renderer<T>
- Type Parameters:
T
- The type of things this renderer supports
public interface Renderer<T>
Renders constraints. This indirection exists to decouple the definition of a constraint from the underlying database.
- Since:
- 1.7.0
- Author:
- Michael J. Simons
- Soundtrack
- Anthrax - Spreading The Disease
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Renderer<T>
get
(Renderer.Format format, Class<T> type) Retrieves a renderer for the givenRenderer.Format
and the type matching type.static <T> Renderer<T>
get
(Renderer.Format format, T type) Retrieves a renderer for the givenRenderer.Format
and givenitem
.default String
render
(T item, RenderConfig config) Renders a schema item.void
render
(T item, RenderConfig config, OutputStream target) Renders a schema item.
-
Method Details
-
get
Retrieves a renderer for the givenRenderer.Format
and givenitem
.- Type Parameters:
T
- The type of the item- Parameters:
format
- The format in which to rendertype
- The item that should be rendered- Returns:
- A renderer for the given type
- Throws:
UnsupportedOperationException
- in case the combination of format and type is not supported
-
get
Retrieves a renderer for the givenRenderer.Format
and the type matching type.- Type Parameters:
T
- The types specific type- Parameters:
format
- The format in which to rendertype
- The type that should be rendered- Returns:
- A renderer for the given type
- Throws:
UnsupportedOperationException
- in case the combination of format and type is not supported
-
render
Renders a schema item.- Parameters:
item
- The item to be renderedconfig
- The context in which the constraint is to be rendered.target
- The target to write to. Will not be closed.- Throws:
IllegalStateException
- in case a given item cannot be rendered with the features requested in the given context.IOException
- If rendering fails due to issues with the target
-
render
Renders a schema item.- Parameters:
item
- The item to be renderedconfig
- The configuration to render- Returns:
- The textual representation of the item in the given context, ready to be executed.
- Throws:
UncheckedIOException
- anyIOException
fromrender(T, RenderConfig, OutputStream)
is rethrown here
-