Class ServiceRemoteInclusion.Builder
java.lang.Object
eu.cloudnetservice.driver.service.ServiceRemoteInclusion.Builder
- Enclosing class:
ServiceRemoteInclusion
A builder for a service remote inclusion.
- Since:
- 4.0
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds a service remote inclusion instance based on this builder.cacheStrategy(@NonNull String cacheStrategy) Sets the cache strategy that is used when downloading the inclusion from the remote.destination(@NonNull String destination) Sets the destination to download the inclusion to.properties(@NonNull Document properties) Sets the properties of the service remote inclusion.Sets the download url of the inclusion.
-
Field Details
-
url
-
destination
-
cacheStrategy
-
properties
-
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
url
Sets the download url of the inclusion. The url scheme should be http/https (the only supported ones by default) but no check is made in this method if the scheme is valid and can be loaded. Including the remote inclusions might result in an exception when an invalid scheme was given.- Parameters:
url- the url to download the inclusion from.- Returns:
- the same instance as used to call the method, for chaining.
- Throws:
NullPointerException- if the given url is null.
-
destination
@NonNull public @NonNull ServiceRemoteInclusion.Builder destination(@NonNull @NonNull String destination) Sets the destination to download the inclusion to. The given path should be relative to the service directory, for example to download into the plugin folder: plugins/BedWars.jar- Parameters:
destination- the service relative destination path to download the inclusion to.- Returns:
- the same instance as used to call the method, for chaining.
- Throws:
NullPointerException- if the given destination path is null.
-
cacheStrategy
@NonNull public @NonNull ServiceRemoteInclusion.Builder cacheStrategy(@NonNull @NonNull String cacheStrategy) Sets the cache strategy that is used when downloading the inclusion from the remote.To disable caching use the
ServiceRemoteInclusion.NO_CACHE_STRATEGY, which is also the default of this builder.- Parameters:
cacheStrategy- the caching strategy to use.- Returns:
- the same instance as used to call the method, for chaining.
- Throws:
NullPointerException- if the given cache strategy is null.
-
properties
@NonNull public @NonNull ServiceRemoteInclusion.Builder properties(@NonNull @NonNull Document properties) Sets the properties of the service remote inclusion. The properties can for example be used to set the http headers which should get send when making a request to the given download url.- Parameters:
properties- the properties of the service inclusion.- Returns:
- the same instance as used to call the method, for chaining.
- Throws:
NullPointerException- if the given properties document is null.
-
build
Builds a service remote inclusion instance based on this builder.- Returns:
- the service remote inclusion.
- Throws:
NullPointerException- if no url, destination or cache strategy is given.
-