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 Embeds based on a unique name from various sources.-
Method Summary
Modifier and TypeMethodDescriptionstatic EmbedDataSourcedataObject(DataObject dataObject) Constructs a newEmbedDataSourceusing aDataObjectas its source.static EmbedDataSourceConstructs a newEmbedDataSourceusing aPathpointing to a JSON file as its source.Retrieves anEmbedbased on the given name.static EmbedDataSourceinputStream(InputStream inputStream) Constructs a newEmbedDataSourceusing an JSONInputStreamas its source.static EmbedDataSourceConstructs a newEmbedDataSourceusing a JSON payload as its source.static EmbedDataSourceConstructs a newEmbedDataSourceusing a JSON file that is located inside the resources folder.
-
Method Details
-
json
Constructs a newEmbedDataSourceusing a JSON payload as its source.- Parameters:
json- the JSON payload to retrieve embeds from- Returns:
- a new
EmbedDataSource
-
resource
Constructs a newEmbedDataSourceusing a JSON file that is located inside the resources folder.- Parameters:
resource- thePathpointing to a JSON file- Returns:
- a new
EmbedDataSource
-
file
Constructs a newEmbedDataSourceusing aPathpointing to a JSON file as its source.- Parameters:
path- thePathpointing to a JSON file- Returns:
- a new
EmbedDataSource
-
inputStream
Constructs a newEmbedDataSourceusing an JSONInputStreamas its source.- Parameters:
inputStream- theInputStreamto retrieve embeds from- Returns:
- a new
EmbedDataSource
-
dataObject
Constructs a newEmbedDataSourceusing aDataObjectas its source.- Parameters:
dataObject- theDataObjectto retrieve embeds from- Returns:
- a new
EmbedDataSource
-
get
Retrieves anEmbedbased on the given name.- Parameters:
embed- the name of the embed to retrieveplaceholders- aMapof placeholders to usemessageResolver- theMessageResolverinstance to use- Returns:
- an
Optionalholding theEmbedconstructed from the retrieved embed json or an emptyOptionalif no embed was found for the given name - Throws:
ParsingException- If the embed json is incorrect
-