Package org.eclipse.persistence.jaxb
Class ValidationXMLReader
- java.lang.Object
-
- org.eclipse.persistence.jaxb.ValidationXMLReader
-
- All Implemented Interfaces:
java.util.concurrent.Callable<java.util.Map<java.lang.Class<?>,java.lang.Boolean>>
public class ValidationXMLReader extends java.lang.Object implements java.util.concurrent.Callable<java.util.Map<java.lang.Class<?>,java.lang.Boolean>>Detects external Bean Validation configuration.Strategy:
1. Parse validation.xml, looking for a constraints-file reference.
2. For each reference, if file is found, parses the constraints file and puts all classes declared under <bean class="clazz"> intoconstraintsOnClassesfield ofBeanValidationHelperclass withBoolean.TRUEvalue.This class contains resources-burdening instance fields (e.g. SAXParser) and as such was designed to be instantiated once (make the instance BOUNDED) and have
call()method called on that instance once.Not suitable for singleton (memory burden). The method #parse() will be invoked only once per class load of this class. After that the instance and all its fields should be made collectible by GC.
- Author:
- Marcel Valovy, Dmitry Kornilov, Miroslav Kos
- Since:
- 2.6
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringBEAN_QNAMEstatic java.lang.StringCLASS_QNAMEstatic java.lang.StringCONSTRAINT_MAPPING_QNAMEstatic java.lang.StringDEFAULT_PACKAGE_QNAMEstatic java.lang.StringPACKAGE_SEPARATOR
-
Constructor Summary
Constructors Constructor Description ValidationXMLReader()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Map<java.lang.Class<?>,java.lang.Boolean>call()Parses validation.xml.static booleanisValidationXmlPresent()Checks if validation.xml exists.
-
-
-
Field Detail
-
DEFAULT_PACKAGE_QNAME
public static final java.lang.String DEFAULT_PACKAGE_QNAME
- See Also:
- Constant Field Values
-
BEAN_QNAME
public static final java.lang.String BEAN_QNAME
- See Also:
- Constant Field Values
-
CONSTRAINT_MAPPING_QNAME
public static final java.lang.String CONSTRAINT_MAPPING_QNAME
- See Also:
- Constant Field Values
-
CLASS_QNAME
public static final java.lang.String CLASS_QNAME
- See Also:
- Constant Field Values
-
PACKAGE_SEPARATOR
public static final java.lang.String PACKAGE_SEPARATOR
- See Also:
- Constant Field Values
-
-
Method Detail
-
call
public java.util.Map<java.lang.Class<?>,java.lang.Boolean> call() throws java.lang.ExceptionParses validation.xml.- Specified by:
callin interfacejava.util.concurrent.Callable<java.util.Map<java.lang.Class<?>,java.lang.Boolean>>- Returns:
- returns a map with classes found in validation.xml as keys and true as a value. Never returns null.
- Throws:
java.lang.Exception
-
isValidationXmlPresent
public static boolean isValidationXmlPresent()
Checks if validation.xml exists.
-
-