Friday, March 11, 2005

Using Annotations to add Validity Constraints to JavaBeans Properties

Using Annotations to add Validity Constraints to JavaBeans Properties: "Article
Using Annotations to add Validity Constraints to JavaBeans Properties


By Anders Holmgren, March 2005

Articles Index

Currently there is no standard way to add validity constraints to Java classes. This is in contrast to other languages like XML in which (using XML Schema) relatively rich constraints may be specified. With the advent of annotations (JSR 175) in the Java 2 Platform, Standard Edition (J2SE) 5.0 a convenient mechanism now exists to allow such constraints to be specified in the Java meta model. This article explores how annotations might be used for this purpose and discusses why this may be an important capability."

No comments: