Package net.sf.saxon.lib
Class ResourceResolverDelegate
- java.lang.Object
-
- net.sf.saxon.lib.ResourceResolverDelegate
-
- All Implemented Interfaces:
ResourceResolver
public class ResourceResolverDelegate extends java.lang.Object implements ResourceResolver
Convenience class to allow a ResourceResolver to be implemented as a lambda expression. Needed for C# transpilation, so that ResourceResolvers can be supplied both as classes implementing an interface, and as lambda functions.
-
-
Constructor Summary
Constructors Constructor Description ResourceResolverDelegate(java.util.function.Function<ResourceRequest,javax.xml.transform.Source> lambda)
Create aResourceResolver
implemented using (typically) a lambda expression
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description javax.xml.transform.Source
resolve(ResourceRequest request)
Process a resource request to deliver a resource
-
-
-
Constructor Detail
-
ResourceResolverDelegate
public ResourceResolverDelegate(java.util.function.Function<ResourceRequest,javax.xml.transform.Source> lambda)
Create aResourceResolver
implemented using (typically) a lambda expression- Parameters:
lambda
- a function, typically supplied as a lambda expression, to map satisfy aResourceRequest
and return aSource
. Note that this doesn't mean the resource actually has to be fetched: the returnedSource
might simply contain a URI.
-
-
Method Detail
-
resolve
public javax.xml.transform.Source resolve(ResourceRequest request) throws XPathException
Description copied from interface:ResourceResolver
Process a resource request to deliver a resource- Specified by:
resolve
in interfaceResourceResolver
- Parameters:
request
- the resource request- Returns:
- the returned Source; or null to delegate resolution to another resolver. The type of Source
must correspond to the type of resource requested: for non-XML resources, it should generally be a
StreamSource
. - Throws:
XPathException
- if the request is invalid in some way, or if the identified resource is unsuitable, or if resolution is to fail rather than being delegated to another resolver.
-
-