Class AbstractFileLocationStrategy.AbstractBuilder<T extends FileLocationStrategy,B extends AbstractFileLocationStrategy.AbstractBuilder<T,B>>

java.lang.Object
org.apache.commons.io.build.AbstractSupplier<T,B>
org.apache.commons.configuration2.io.AbstractFileLocationStrategy.AbstractBuilder<T,B>
Type Parameters:
T - The type of FileLocationStrategy to build.
B - The builder type.
All Implemented Interfaces:
org.apache.commons.io.function.IOSupplier<T>
Direct Known Subclasses:
AbstractFileLocationStrategy.StrategyBuilder, CombinedLocationStrategy.Builder, HomeDirectoryLocationStrategy.Builder
Enclosing class:
AbstractFileLocationStrategy

public abstract static class AbstractFileLocationStrategy.AbstractBuilder<T extends FileLocationStrategy,B extends AbstractFileLocationStrategy.AbstractBuilder<T,B>> extends org.apache.commons.io.build.AbstractSupplier<T,B>
Builds new instances for subclasses.

As of version 2.15.0, by default, the only URL schemes allowed are file and jar. To override this default, you can either use the system property org.apache.commons.configuration2.io.FileLocationStrategy.schemes or build a subclass of AbstractFileLocationStrategy.

Using System Properties

The system property org.apache.commons.configuration2.io.FileLocationStrategy.schemes String value must be a comma-separated list of schemes, where the default is "file,jar", and the complete list is "file,http,https,jar".

Using a Builder

The root builder for AbstractFileLocationStrategy is AbstractFileLocationStrategy.AbstractBuilder where you define allowed schemes and hosts through its setter methods.

See AbstractFileLocationStrategy learn how to grant an deny URL schemes and hosts.

  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs a new instance for subclasses.
  • Method Summary

    Modifier and Type
    Method
    Description
    Sets enabled URL-based hosts, empty means all are enabled.
    Sets enabled URL-based hosts, empty means all are enabled.
    setSchemes(Set<String> schemes)
    Sets enabled URL-based schemes, empty means all are enabled.

    Methods inherited from class org.apache.commons.io.build.AbstractSupplier

    asThis

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.apache.commons.io.function.IOSupplier

    asSupplier, get, getUnchecked
  • Constructor Details

    • AbstractBuilder

      public AbstractBuilder()
      Constructs a new instance for subclasses.
  • Method Details

    • setHosts

      public B setHosts(Set<Pattern> hosts)
      Sets enabled URL-based hosts, empty means all are enabled. URL hosts are case-insensitive.
      Parameters:
      hosts - enabled URL-based hosts.
      Returns:
      this instance.
    • setHostsRegEx

      public B setHostsRegEx(Set<String> hosts)
      Sets enabled URL-based hosts, empty means all are enabled. URL hosts are case-insensitive.
      Parameters:
      hosts - Regular expressions enabled URL-based hosts.
      Returns:
      this instance.
    • setSchemes

      public B setSchemes(Set<String> schemes)
      Sets enabled URL-based schemes, empty means all are enabled. URL schemes are case-insensitive.
      Parameters:
      schemes - enabled URL-based schemes, the default null means all schemes are allowed.
      Returns:
      this instance.