Commit 91ad4bc5 authored by R.W.Majeed's avatar R.W.Majeed
Browse files

added javax.inject.Singleton annotation

parent 824a1fb6
......@@ -66,6 +66,17 @@
<artifactId>Saxon-HE</artifactId><!--
<version>9.6.0-7</version>-->
</dependency>
<!-- dependency injection is optional
and provided by the CDI container.
We need this to specify that only
one instance of the validator is
sufficient. -->
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>1</version>
<scope>provided</scope>
</dependency>
<!-- unit tests -->
<dependency>
<groupId>junit</groupId>
......
......@@ -6,6 +6,7 @@ import java.net.URL;
import java.util.Iterator;
import java.util.logging.Logger;
import javax.inject.Singleton;
import javax.xml.XMLConstants;
import javax.xml.namespace.NamespaceContext;
import javax.xml.transform.OutputKeys;
......@@ -31,10 +32,15 @@ import org.w3c.dom.NodeList;
* <p>
* This implementation is probably not thread-safe: A single {@link Transformer}
* instance is used for all calls to {@link #validate(Source)}.
* <p>
* This class can be used for dependency injection via CDI. In this case
* this class behaves as a singleton, so only one instance of the class
* is instantiated.
*
* @author R.W.Majeed
*
*/
@Singleton
public class Validator implements URIResolver, NamespaceContext {
private static final Logger log = Logger.getLogger(Validator.class.getName());
private TransformerFactory factory;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment