Class ServiceRemoteInclusion.Builder

java.lang.Object
eu.cloudnetservice.driver.service.ServiceRemoteInclusion.Builder
Enclosing class:
ServiceRemoteInclusion

public static class ServiceRemoteInclusion.Builder extends Object
A builder for a service remote inclusion.
Since:
4.0
  • Field Details

    • url

      protected String url
    • destination

      protected String destination
    • cacheStrategy

      protected String cacheStrategy
    • properties

      protected Document 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

      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

      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

      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.