Class ResponseTemplateManager
java.lang.Object
com.centralnicreseller.apiconnector.ResponseTemplateManager
ResponseTemplateManager covers functionality to manage response
TEMPLATES_DATA.
- Since:
- 2.0
- Version:
- %I%, %G%
- Author:
- Kai Schwarz
-
Method Summary
Modifier and TypeMethodDescriptionstatic Class<ResponseTemplateManager> addTemplate(String id, String plain) Add a response template to the template container.static Class<ResponseTemplateManager> addTemplate(String id, String code, String descr) Add a response template to the template container.static StringgenerateTemplate(String code, String description) Generate API response template string for a given code and description.static ResponsegetTemplate(String id) Get a response template instance from the template container.Return all available response TEMPLATES_DATA.Retrieves a copy of the current API response templates map.static booleanhasTemplate(String id) Check if a given template exists in the template container.static booleanisTemplateMatchHash(Map<String, Object> tpl2, String id) Check if a given API response hash matches a given template by code and description.static booleanisTemplateMatchPlain(String plain, String id) Check if a given API plain response matches a given template by code and description.
-
Method Details
-
generateTemplate
-
addTemplate
Add a response template to the template container.- Parameters:
id- Template ID.plain- API plain response.- Returns:
- ResponseTemplateManager class for method chaining.
-
addTemplate
Add a response template to the template container.- Parameters:
id- Template ID.code- Data provided for generating a new template to use.descr- Data provided for generating a new template to use.- Returns:
- ResponseTemplateManager class for method chaining.
-
getTemplate
-
getTemplates
-
hasTemplate
Check if a given template exists in the template container.- Parameters:
id- Template ID.- Returns:
- Boolean result.
-
isTemplateMatchHash
-
isTemplateMatchPlain
-
getTemplatesMap
Retrieves a copy of the current API response templates map.This method returns a new
HashMapcontaining the entries from theTEMPLATES_DATAmap. The returned map is a shallow copy, meaning modifications to the returned map will not affect the originalTEMPLATES_DATAmap.- Returns:
- A new
Mapcontaining the API response templates. The map's keys are template identifiers, and the values are the corresponding response template strings.
-