Class Cdn
java.lang.Object
net.dzikoysk.cdn.Cdn
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 Summary
Modifier and TypeMethodDescriptionstatic CdnSettingsBuild custom CDN instance.Get settings used by this CDN instancepanda.std.Result<Configuration, CdnException> Load configuration as defaultConfigurationstructure.<T> panda.std.Result<T, CdnException> Load configuration from the given source and map defaultConfigurationstructure into the given configuration class.<T> panda.std.Result<T, CdnException> Load configuration from the given source and map defaultConfigurationstructure into the given configuration class.panda.std.Result<String, CdnException> Convert the given instance to the output stringpanda.std.Result<String, CdnException> Convert the given instance usingrender(Object)method and save the output in the given file using UTF-8 charset.panda.std.Result<String, CdnException> Convert the given configuration instance to the output stringpanda.std.Result<String, CdnException> Convert the given instance usingrender(net.dzikoysk.cdn.model.Element)method and save the output in the given file using UTF-8 charset.
-
Method Details
-
configure
Build custom CDN instance. For standard usage like CDN, JSON, YAML-like formats you can use predefined instances available inCdnFactoryclass.- Returns:
- default instance of settings
- See Also:
-
load
Load configuration as defaultConfigurationstructure.- 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 defaultConfigurationstructure into the given configuration class.- Type Parameters:
T- the expected type- Parameters:
source- the source to loadconfigurationClass- the class to use- Returns:
- an instance of configuration class mapped from
Configurationstructure
-
load
public <T> panda.std.Result<T,CdnException> load(@NotNull @NotNull Source source, @NotNull T instance) Load configuration from the given source and map defaultConfigurationstructure into the given configuration class.- Type Parameters:
T- the expected type- Parameters:
source- the source to loadinstance- the instance to use- Returns:
- an instance of configuration class mapped from
Configurationstructure
-
render
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 usingrender(Object)method and save the output in the given file using UTF-8 charset.- Parameters:
entity- the instance to convertoutput- the output file
-
render
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 usingrender(net.dzikoysk.cdn.model.Element)method and save the output in the given file using UTF-8 charset.- Parameters:
element- the element to convertoutput- the output file
-
getSettings
Get settings used by this CDN instance- Returns:
- settings used by this instance
-