Class Cdn

java.lang.Object
net.dzikoysk.cdn.Cdn

public final class Cdn extends Object
The main class of Cdn library that expose methods related to process of loading/rendering configurations. You can build an instance using configure() method or you can take a look at predefined instances in CdnFactory.
  • Method Details

    • configure

      public static CdnSettings configure()
      Build custom CDN instance. For standard usage like CDN, JSON, YAML-like formats you can use predefined instances available in CdnFactory class.
      Returns:
      default instance of settings
      See Also:
    • load

      public panda.std.Result<Configuration,CdnException> load(@NotNull @NotNull Source source)
      Load configuration as default Configuration structure.
      Parameters:
      source - the source to load
      Returns:
      the parsed configuration
      See Also:
    • load

      public <T> panda.std.Result<T,CdnException> load(@NotNull @NotNull Source source, @NotNull @NotNull Class<T> configurationClass)
      Load configuration from the given source and map default Configuration structure into the given configuration class.
      Type Parameters:
      T - the expected type
      Parameters:
      source - the source to load
      configurationClass - the class to use
      Returns:
      an instance of configuration class mapped from Configuration structure
    • load

      public <T> panda.std.Result<T,CdnException> load(@NotNull @NotNull Source source, @NotNull T instance)
      Load configuration from the given source and map default Configuration structure into the given configuration class.
      Type Parameters:
      T - the expected type
      Parameters:
      source - the source to load
      instance - the instance to use
      Returns:
      an instance of configuration class mapped from Configuration structure
    • render

      public panda.std.Result<String,CdnException> render(@NotNull @NotNull Object entity)
      Convert the given instance to the output string
      Parameters:
      entity - the instance to convert
      Returns:
      the rendered output
    • render

      public panda.std.Result<String,CdnException> render(@NotNull @NotNull Object entity, @NotNull @NotNull Output output)
      Convert the given instance using render(Object) method and save the output in the given file using UTF-8 charset.
      Parameters:
      entity - the instance to convert
      output - the output file
    • render

      public panda.std.Result<String,CdnException> render(@NotNull @NotNull Element<?> element)
      Convert the given configuration instance to the output string
      Parameters:
      element - the element to convert
      Returns:
      the rendered output
    • render

      public panda.std.Result<String,CdnException> render(@NotNull @NotNull Element<?> element, @NotNull @NotNull Output output)
      Convert the given instance using render(net.dzikoysk.cdn.model.Element) method and save the output in the given file using UTF-8 charset.
      Parameters:
      element - the element to convert
      output - the output file
    • getSettings

      public CdnSettings getSettings()
      Get settings used by this CDN instance
      Returns:
      settings used by this instance