Interface EmbedDataSource
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
An
EmbedDataSource
is used to retrieve Embed
s based on a unique name from various sources.-
Method Summary
Modifier and TypeMethodDescriptionstatic EmbedDataSource
dataObject
(DataObject dataObject) Constructs a newEmbedDataSource
using aDataObject
as its source.static EmbedDataSource
Constructs a newEmbedDataSource
using aPath
pointing to a JSON file as its source.Retrieves anEmbed
based on the given name.static EmbedDataSource
inputStream
(InputStream inputStream) Constructs a newEmbedDataSource
using an JSONInputStream
as its source.static EmbedDataSource
Constructs a newEmbedDataSource
using a JSON payload as its source.static EmbedDataSource
Constructs a newEmbedDataSource
using a JSON file that is located inside the resources folder.
-
Method Details
-
json
Constructs a newEmbedDataSource
using a JSON payload as its source.- Parameters:
json
- the JSON payload to retrieve embeds from- Returns:
- a new
EmbedDataSource
-
resource
Constructs a newEmbedDataSource
using a JSON file that is located inside the resources folder.- Parameters:
resource
- thePath
pointing to a JSON file- Returns:
- a new
EmbedDataSource
-
file
Constructs a newEmbedDataSource
using aPath
pointing to a JSON file as its source.- Parameters:
path
- thePath
pointing to a JSON file- Returns:
- a new
EmbedDataSource
-
inputStream
Constructs a newEmbedDataSource
using an JSONInputStream
as its source.- Parameters:
inputStream
- theInputStream
to retrieve embeds from- Returns:
- a new
EmbedDataSource
-
dataObject
Constructs a newEmbedDataSource
using aDataObject
as its source.- Parameters:
dataObject
- theDataObject
to retrieve embeds from- Returns:
- a new
EmbedDataSource
-
get
Retrieves anEmbed
based on the given name.- Parameters:
embed
- the name of the embed to retrieveplaceholders
- aMap
of placeholders to usei18n
- theI18n
instance to use- Returns:
- an
Optional
holding theEmbed
constructed from the retrieved embed json or an emptyOptional
if no embed was found for the given name - Throws:
ParsingException
- If the embed json is incorrect
-