Project

Profile

Help

Support #3237 » Transformation.java

Aniruddha Joag, 2017-06-29 11:35

 
package test.saxon.streaming.transformerhandler;

import javax.xml.transform.Result;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException;

/**
* Created by Aniruddha Joag (aniruddha.joag@hsbc.com) on 22/06/2017.
* @author Aniruddha Joag "aniruddha.joag@hsbc.com"
*/
public class Transformation
{
private final Transformer transformer;
private Source source;
private final Result result;

public Transformation(Transformer transformer, Source source, Result result)
{
this.transformer = transformer;
this.source = source;
this.result = result;
}

public Transformation(Transformer transformer, Result result)
{
this(transformer, null, result);
}

public void execute() throws TransformerException
{
if(source == null)
throw new TransformerException("Source is null");
transformer.transform(source,result);
}

public void setSource(Source source)
{
this.source = source;
}
}
(14-14/15)