public class XsltTransmogrifier<T> extends AbstractCachingXmlProcessor<Templates> implements Transmogrifier<Source,T>
Source
into an object of type T. The stylesheet to be used is passed with the
zap(Source, Object...)
call, however, the Xslt Template object is cached for subsequent transformations
using this stylesheet.
Xslt parameters can be passed in as Map parameter.
Note: This class is thread-safe and reentrant.
AbstractCachingXmlProcessor.Loader<S>
RESOURCE_LOCATION
Constructor and Description |
---|
XsltTransmogrifier() |
XsltTransmogrifier(Class<T> outputFormat) |
XsltTransmogrifier(Class<T> outputFormat,
ClassLoader classLoader) |
XsltTransmogrifier(Class<T> outputFormat,
ClassLoader classLoader,
Map<String,Object> staticParams) |
XsltTransmogrifier(Class<T> outputFormat,
Map<String,Object> staticParams) |
Modifier and Type | Method and Description |
---|---|
protected Templates |
createResource(Object... params)
Creates a ready-to-use resource (e.g.
|
protected ConcurrentMap<String,AbstractCachingXmlProcessor.Loader<Templates>> |
getCache() |
TransformerFactory |
getFactory() |
Map<String,Object> |
getStaticParams() |
void |
setStaticParams(Map<String,Object> staticParams) |
protected void |
setXsltParameters(Transformer transformer,
Map<String,Object> param)
Sets the parameter to the
Transformer object |
T |
zap(Source source,
Object... params)
Converts a Source into a Result using a XSL processor.
|
resource, resourceCacheKey, resourceContent, resourceLocation, resourceParameters
public XsltTransmogrifier()
public XsltTransmogrifier(Class<T> outputFormat, ClassLoader classLoader)
public XsltTransmogrifier(Class<T> outputFormat, Map<String,Object> staticParams)
public XsltTransmogrifier(Class<T> outputFormat, ClassLoader classLoader, Map<String,Object> staticParams)
outputFormat
- currently supported: String, Writer, OutputStreamclassLoader
- class loader for resource retrieval, may be null
staticParams
- static Xslt parameterspublic TransformerFactory getFactory()
protected ConcurrentMap<String,AbstractCachingXmlProcessor.Loader<Templates>> getCache()
getCache
in class AbstractCachingXmlProcessor<Templates>
public T zap(Source source, Object... params)
The XSL stylesheet resource location is mandatory in the first extra parameter. XSL Parameters may be passed as a Map in the second parameter.
zap
in interface Transmogrifier<Source,T>
source
- what goes inTransmogrifier.zap(java.lang.Object, java.lang.Object[])
protected void setXsltParameters(Transformer transformer, Map<String,Object> param)
Transformer
objectprotected Templates createResource(Object... params)
AbstractCachingXmlProcessor
createResource
in class AbstractCachingXmlProcessor<Templates>
params
- validator/transmogrifier parameters.@Generated(value="lombok") public Map<String,Object> getStaticParams()
@Generated(value="lombok") public void setStaticParams(Map<String,Object> staticParams)
Copyright © 2018 Open eHealth Foundation. All rights reserved.