public class CombinedLocationStrategy extends Object implements FileLocationStrategy
 A specialized implementation of a FileLocationStrategy which
 encapsulates an arbitrary number of FileLocationStrategy objects.
 
 A collection with the wrapped FileLocationStrategy objects is passed
 at construction time. During a [locate() operation the wrapped
 strategies are called one after the other until one returns a non null
 URL. This URL is returned. If none of the wrapped strategies is able to
 resolve the passed in FileLocator, result is null. This is
 similar to the chain of responsibility design pattern.
 
 This class, together with the provided concrete FileLocationStrategy
 implementations, offers a convenient way to customize the lookup for
 configuration files: Just add the desired concrete strategies to a
 CombinedLocationStrategy object. If necessary, custom strategies can
 be implemented if there are specific requirements. Note that the order in
 which strategies are added to a CombinedLocationStrategy matters: sub
 strategies are queried in the same order as they appear in the collection
 passed to the constructor.
 
| Constructor and Description | 
|---|
CombinedLocationStrategy(Collection<? extends FileLocationStrategy> subs)
Creates a new instance of  
CombinedLocationStrategy and
 initializes it with the provided sub strategies. | 
| Modifier and Type | Method and Description | 
|---|---|
Collection<FileLocationStrategy> | 
getSubStrategies()
Returns a (unmodifiable) collection with the sub strategies managed by
 this object. 
 | 
URL | 
locate(FileSystem fileSystem,
      FileLocator locator)
Tries to locate the specified file. 
 | 
public CombinedLocationStrategy(Collection<? extends FileLocationStrategy> subs)
CombinedLocationStrategy and
 initializes it with the provided sub strategies. The passed in collection
 must not be null or contain null elements.subs - the collection with sub strategiesIllegalArgumentException - if the collection is null or has
         null elementspublic Collection<FileLocationStrategy> getSubStrategies()
FileLocationStrategy objectspublic URL locate(FileSystem fileSystem, FileLocator locator)
FileSystem to be used. Note that the FileLocator object
 may also contain a FileSystem, but this is optional. The passed
 in FileSystem should be used, and callers must not pass a
 null reference for this argument. A concrete implementation has to
 evaluate the properties stored in the FileLocator object and try
 to match them to an existing file. If this can be done, a corresponding
 URL is returned. Otherwise, result is null. Implementations should
 not throw an exception (unless parameters are null) as there might
 be alternative strategies which can find the file in question. This implementation tries to locate the file by delegating
 to the managed sub strategies.locate in interface FileLocationStrategyfileSystem - the FileSystem to be used for this operationlocator - the object describing the file to be locatedCopyright © 2001–2020 The Apache Software Foundation. All rights reserved.