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.destination(@NonNull String destination) Sets the destination to download the inclusion to.properties(@NonNull eu.cloudnetservice.common.document.gson.JsonDocument properties) Sets the properties of the service remote inclusion.Sets the download url of the inclusion.
-
Field Details
-
url
-
destination
-
properties
protected eu.cloudnetservice.common.document.gson.JsonDocument 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.
-
properties
@NonNull public @NonNull ServiceRemoteInclusion.Builder properties(@NonNull @NonNull eu.cloudnetservice.common.document.gson.JsonDocument 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 or destination was given.
-