Class DefaultFormElementTemplateLoader

java.lang.Object
de.xima.fc.plugin.models.retval.form.DefaultFormElementTemplateLoader

public final class DefaultFormElementTemplateLoader extends Object
Default implementations for IPluginFormElementTemplateLoader.
Since:
8.0.1
Author:
XIMA MEDIA GmbH
  • Method Details

    • classPath

      public static IPluginFormElementTemplateLoader classPath(Class<?> 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 to classpath 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

      public static IPluginFormElementTemplateLoader classPath(ClassLoader 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 to classpath 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 JSON
      iconLoader - 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

      public static IPluginFormElementTemplateLoader 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.