Unfortunately, you're correct that there's no way for you to access the schema metadata at present. Longer-term I'd like to standardize the schema code generation model and expose it as an official API, but it'll take a substantial refactoring before I'm ready to do that.
That said, it should be possible to incorporate the restrictions directly into the code generation without major changes, but it'll still take some work. One issue is in how to actually implement the validation. JSR 303 is now official, but I haven't looked into how easy or difficult it is to use this in different production environments. It also looks like JSR 303 only handles validation calls, rather than supporting fast-fail validate-on-set checks. I'd like to allow users to choose between validate-on-set checks (which would throw a runtime exception if you tried to set a non-allowed value to a property) and validate calls (which could be used for post-set and pre-get validation checks), but if I had to choose one way or the other I'd go with the fast-fail validate-on-set approach (since that forces you to deal with the problem at its source, rather than trying to backtrack from an invalid state detected later). - Dennis Dennis M. Sosnoski XML and Web Services in Java Training and Consulting http://www.sosnoski.com - http://www.sosnoski.co.nz Seattle, WA +1-425-939-0576 - Wellington, NZ +64-4-298-6117 On 07/22/2010 08:19 AM, Thomas R. Hall wrote: > Thanks, Dennis. That's exactly what I figured would be the case - > extending a base class. > > I'd ideally like to read the maxLength attribute off of the XSD for > each element and add a method for a particular class that can perform > the truncation/validation automatically. Looking at the code for > ExtensionDecorator < > http://jibx.cvs.sourceforge.net/viewvc/jibx/core/build/src/org/jibx/schema/codegen/extend/ExtensionDecorator.java?view=log > >> , it wasn't readily apparent to me if that metadata is available to >> > me. I looked at the source for CollectionMethodsDecorator also, and > see how I could leverage AST to determine attributes of a class (if > it's a List, etc.), but not how to access the metadata from the XSD. > > Does my question make sense? If you have another sample that may help > me with that piece, let me know. I'm worried in looking at the code > that I may have to somehow modify/extend CodeGen, or is that not the > case? > > Thanks, > > --Thomas > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by Sprint > What will you do first with EVO, the first 4G phone? > Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first > _______________________________________________ > jibx-users mailing list > jibx-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/jibx-users > > ------------------------------------------------------------------------------ This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first _______________________________________________ jibx-users mailing list jibx-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jibx-users