Java对象验证框架 - iScreen

fmms 12年前
     iScreen是一个Java对象验证框架。它的思想与Apache Jakarta的commons-validator项目相似,验证规则使用XML进行配置但也支持其它配置类型。它比commons-validator更强大,灵活,易于使用。    <br />    <a name="Java Object Validation"><strong>Java Object Validation</strong> </a>    <p>Validation is done via Java objects. Typically, these will be JavaBeans, but this is not required. OGNL (see <a href="/misc/goto?guid=4959517481249537940">www.ognl.org</a>) is used to access object fields, which gives considerable flexibility in what is eventually validated. </p>    <a name="Internationalization"><strong>Internationalization</strong> </a>    <p>Though currently somewhat weak (meaning, it needs a lot more work before it's done), basic internationalization support exists via resource bundles. </p>    <a name="Multiple Fields"><strong>Multiple Fields</strong> </a>    <p>Fundamental support for pulling multiple fields from a Java object and validating them together is supported. The capability, unlike most validation frameworks, is not tacked on, but is supported as a natural configuration capability. </p>    <a name="XML Configuration"><strong>XML Configuration</strong> </a>    <p>Though the underlying engine supports configuration by other means, the primary configuration format is XML. In the future, additional formats will become available. </p>    <a name="Configuration Reuse"><strong>Configuration Reuse</strong> </a>    <p>The feature is tied to the XML configuration capability. This re-use allows validations to be referenced by other validations via delegation. This is interesting because it simplifies and minimizes the configuration. </p>    <a name="Dynamic Failure Messages"><strong>Dynamic Failure Messages</strong> </a>    <p>Failure messages that are generated during validation are dynamically generated. Not only that, but each "validator" is configured with the message it will use (so, it's never hard-coded). These "validators" can also use multiple messages for different reasons (for example, imagine a validator that checks string lengths: it can use a different message for an invalid minimum length from the one it uses for maximum length). </p>    <a name="Failures and Warnings"><strong>Failures and Warnings</strong> </a>    <p>There are two types of errors that a validator can report: a failure and a warning. A warning is a failure that can be ignored (depending upon how the application wants to handle it). </p>    <a name="Configuration-Based"><strong>Configuration-Based</strong> </a>    <p>Definitions of validations are done via configuration in order to minimize the required amount of code. In fact, the amount of code necessary is fairly minimal. It's recommended that an inversion of control container be used to further minimize the necessary code. </p>    <a name="OGNL Access"><strong>OGNL Access</strong> </a>    <p>OGNL (see <a href="/misc/goto?guid=4959517481249537940">www.ognl.org</a>) is used for basic mapping and Java object access. This object navigation library is extremely powerful, providing considerable flexibility in what data is being validated and how messages are generated. </p>    <br />    <p><strong>项目主页:</strong><a href="http://www.open-open.com/lib/view/home/1326987082983" target="_blank">http://www.open-open.com/lib/view/home/1326987082983</a></p>