Class BeanValidationPlugin
- java.lang.Object
-
- com.sun.tools.xjc.Plugin
-
- org.eclipse.persistence.jaxb.plugins.BeanValidationPlugin
-
public class BeanValidationPlugin extends com.sun.tools.xjc.PluginXJC Plugin for generation of JSR349 (Bean Validation) annotations.Has two mods:
Is capable of generating the following annotations:"jsr303" - enables backward compatibility. "simpleRegex" - disables translation of UNICODE XML regex into UNICODE Java regex. Java ASCII regex are shorter to read.
Reacts to the following XSD restrictions and facets:- @DecimalMax - @DecimalMin - @Digits - @NotNull - @Pattern - @Size - @Valid - @AssertTrue - @AssertFalse - @Future - @Past
Basic usage:- maxExclusive - minExclusive - maxInclusive - minInclusive - nillable - pattern - length - maxLength - minLength - minOccurs - maxOccurs
Example usage with mods:xjc file.xsd -XBeanVal
Programmatic usage, with mods and extensions enabled:xjc file.xsd -XBeanVal jsr303 simpleRegex
Supports setting Target groups and Error message through binding customizations. Example:Driver.run(new String[] { schemaPath, "-extension", "-XBeanVal", "jsr303", "simpleRegex" }, System.out, System.out);<xs:appinfo> <jxb:bindings node="/xs:schema/xs:complexType/xs:sequence/xs:element[@name='generic']"> <bv:facet type="maxLength" message="Hello, world!" groups="Object"/> <bv:facet type="future" message="Welcome to the Future!"/> </jxb:bindings> </xs:appinfo>Supports custom-created BV annotations. Example:
<xs:appinfo> <jxb:bindings node="/xs:schema/xs:complexType/xs:sequence/xs:element[@name='generic']"> <bv:facet type="org.eclipse.persistence.annotations.AdditionalCriteria" value="This is a real custom annotation."/> </jxb:bindings> </xs:appinfo>- Author:
- Marcel Valovy - marcel.valovy@oracle.com
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringFACETstatic java.lang.StringJSR_303_MODstatic java.lang.StringNS_URIstatic java.lang.StringPLUGIN_OPTIONstatic java.lang.StringSIMPLE_REGEX_MOD
-
Constructor Summary
Constructors Constructor Description BeanValidationPlugin()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<java.lang.String>getCustomizationURIs()java.lang.StringgetOptionName()java.lang.StringgetUsage()booleanisCustomizationTagName(java.lang.String nsUri, java.lang.String localName)intparseArgument(com.sun.tools.xjc.Options opt, java.lang.String[] args, int i)booleanrun(com.sun.tools.xjc.outline.Outline outline, com.sun.tools.xjc.Options opts, org.xml.sax.ErrorHandler errorHandler)
-
-
-
Field Detail
-
PLUGIN_OPTION
public static final java.lang.String PLUGIN_OPTION
- See Also:
- Constant Field Values
-
JSR_303_MOD
public static final java.lang.String JSR_303_MOD
- See Also:
- Constant Field Values
-
SIMPLE_REGEX_MOD
public static final java.lang.String SIMPLE_REGEX_MOD
- See Also:
- Constant Field Values
-
NS_URI
public static final java.lang.String NS_URI
- See Also:
- Constant Field Values
-
FACET
public static final java.lang.String FACET
- See Also:
- Constant Field Values
-
-
Method Detail
-
getOptionName
public java.lang.String getOptionName()
- Specified by:
getOptionNamein classcom.sun.tools.xjc.Plugin
-
getUsage
public java.lang.String getUsage()
- Specified by:
getUsagein classcom.sun.tools.xjc.Plugin
-
getCustomizationURIs
public java.util.List<java.lang.String> getCustomizationURIs()
- Overrides:
getCustomizationURIsin classcom.sun.tools.xjc.Plugin
-
isCustomizationTagName
public boolean isCustomizationTagName(java.lang.String nsUri, java.lang.String localName)- Overrides:
isCustomizationTagNamein classcom.sun.tools.xjc.Plugin
-
parseArgument
public int parseArgument(com.sun.tools.xjc.Options opt, java.lang.String[] args, int i) throws com.sun.tools.xjc.BadCommandLineException, java.io.IOException- Overrides:
parseArgumentin classcom.sun.tools.xjc.Plugin- Throws:
com.sun.tools.xjc.BadCommandLineExceptionjava.io.IOException
-
run
public boolean run(com.sun.tools.xjc.outline.Outline outline, com.sun.tools.xjc.Options opts, org.xml.sax.ErrorHandler errorHandler)- Specified by:
runin classcom.sun.tools.xjc.Plugin
-
-