Class DefaultFormElementTemplateLoader
java.lang.Object
de.xima.fc.plugin.models.retval.form.DefaultFormElementTemplateLoader
Default implementations for
IPluginFormElementTemplateLoader
.- Since:
- 8.0.1
- Author:
- XIMA MEDIA GmbH
-
Method Summary
Modifier and TypeMethodDescriptionCreates a loader that loads icons and the persist JSON from the class path, using the given class path loader.classPath
(ClassLoader classPath) Creates a loader that loads icons and the persist JSON from the class path, using the given class path loader.custom
(IThrowingFunction<URI, InputStream> persistJsonLoader, IThrowingFunction<URI, InputStream> iconLoader) Creates a custom loader that uses the given loader functions.Creates a loader for static in-memory resources from the given maps.Creates a loader for static in-memory resources from the given maps.url()
Creates a loader that converts the URIs to URLs and reads the data from the URL.
-
Method Details
-
classPath
Creates a loader that loads icons and the persist JSON from the class path, using the given class path loader. The URIs must have their scheme set toclasspath
and their path to the absolute path of the class path resource. For example:classpath:/path/to/icon.png
- Parameters:
classPath
- Class from which to load resources.- Returns:
- A loader that loads resources from the class path.
-
classPath
Creates a loader that loads icons and the persist JSON from the class path, using the given class path loader. The URIs must have their scheme set toclasspath
and their path to the absolute path of the class path resource. For example:classpath:/path/to/icon.png
- Parameters:
classPath
- Class from which to load resources.- Returns:
- A loader that loads resources from the class path.
-
custom
public static IPluginFormElementTemplateLoader custom(IThrowingFunction<URI, InputStream> persistJsonLoader, IThrowingFunction<URI, InputStream> iconLoader) Creates a custom loader that uses the given loader functions.- Parameters:
persistJsonLoader
- Loader for the persist JSONiconLoader
- Loader for the icons.- Returns:
- A custom loader using the given loader functions.
-
map
public static IPluginFormElementTemplateLoader map(Map<URI, String> persistJsonMap, Map<URI, byte[]> iconMap) Creates a loader for static in-memory resources from the given maps. Use with care, as large in-memory resources may result in out-of-memory errors.- Parameters:
persistJsonMap
- Map with the persist JSON content for each supported URI. Each value must be a valid JSON string.iconMap
- Map with the icons for each supported URI.- Returns:
- A custom loader using the given loader functions.
-
mapBase64
public static IPluginFormElementTemplateLoader mapBase64(Map<URI, String> persistJsonMap, Map<URI, String> iconMap) Creates a loader for static in-memory resources from the given maps. Use with care, as large in-memory resources may result in out-of-memory errors.- Parameters:
persistJsonMap
- Map with the persist JSON content for each supported URI. Each value must be a valid JSON string.iconMap
- Map with the icons for each supported URI. Each value must be a valid base64 string.- Returns:
- A custom loader using the given loader functions.
-
url
Creates a loader that converts the URIs to URLs and reads the data from the URL.- Returns:
- A loader that expects URIs to represent valid URLs.
-