java - jaxb xjc falg in base class accessible from inner ones -
maybe didn't use right words many searches on topic, couldn't find answer.
intro
i have xsd file contains complex types. need ("expensive") xslt transformation returns string before marshal. when has changed since last marshal, otherwise use previous transformation output. need string value in other places too, not upon doing marshal.
(by way, xsd file changes every year or two)
the problem
to prevent transformation happening when nothing has changed, need kind of flag "true" whenever field changed. think best place flag base extracted class, each instance of keeps updated. problem comes when need change flag within contained class, since doesn't have reference base class.
i remember asking few years in jaxb mailing-list. don't remember answer ended making base class singleton , added static fields in using binding files. using aop changed 1 of added fields every time setter invoked (for short).
now, need class not singleton. need have more 1 instance of it, since same class needs used differently before , don't want implement "busy flag" , create bottle neck.
since xsd file specified third party , changes quite often, don't want many fixed transformations hand since maintenance hard , expensive.
thoughts:
if inner classes created xjc weren't static, parent.this.setflag()
if <jaxb:globalbindings localscoping="toplevel"/>
, contained complextype attributes aren't static anymore, because every complextype gets generated in own file, doesn't find base class either. complextype class has no reference container one.
thought of having map somewhere references every complextyple class instance, can't imagine how implement without doing hand...so what's use of xjc, right?
how it?
- find way make inner classes not-static
i think best solution, since easier 1 implement.
- find way add reference base class on every inner one.
this difficult implement, since need define binding file modification every inner class, , need change objectfactore (somehow) make every constructor have parameter base class instance.
- ?
help
any ideas and/or suggestions?
Comments
Post a Comment