Martin Desruisseaux a écrit : > Jody Garnett a écrit : > >> can they subclass and annotate the subclass different? >> > > I'm not sure on this one; Cédric would know better. Hi,
it is normally possible to extend all classes and annotate only the sub classes. The super class needs to have a @XmlSeeAlso annotation with the class name of its subclasses. Then each subclass needs to have a XmlRootElement(name="example"), where "example" will be the name of the tag in the XML generated by a marshalling process. However I can see one problem : if I take the example of IdentificationImpl and DataIdentificationImpl, the latter extends the former. In the XML tree, I expect to get a tag <MD_DataIdentification>. So if I extend DataIdentification with a new class, I also need to get every fields annotated from the IdentificationImpl and reannotate them in the subclass of DataIdentification, reannotate because it will be already annotated in a new subclass of IdentificationImpl. This will duplicate annotations on the same fields finally, and I hope it can work (but never tried). Moreover we were talking about the size of the metadata jar, which has already increased due to Jaxb framework (annotation taglines, adapters ...), adding a bunch of more than a hundred of classes will again increase the size of this jar ... > But even if it is possible, > a user wanting to annotate differently would have to subclass the ~100 > existing > classes. The cost would be close to the same than creating his brand new set > of > implementations, especially since he may have to override every methods as > well > in order to ensure he manage instances of his subclasses. > > So no matter if metadata classes are annotated or not, it seems to me that > the > cost for a user wanting different JAXB annotations is close to the same. > > > >> - There was some indication you could use a special jaxb adapter >> annotation and punt out to some java code to make the decisions >> > > Yes I already though about that, but didn't talked about it because we have > not > tried yet. In the particular case of metadata, we had to write a lot of > adapters > anyway because of the unusual way ISO 19139 is defined. It may be possible to > leverage those adapters for handling a limited set of version changes. > > > >> I wonder if we could use this annotation metadata to bootstrap >> our GTXML parser. I would even be a good idea (does not handle the >> multi-schema problem but does offer the benifits of a dynamic parser). >> > > It may be possible. Like JDBC, JAXB is an API with plugable implementation > engines behind the hood. But I don't know how difficult could be the task. > > Martin > > > ------------------------------------------------------------------------- > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > http://sourceforge.net/services/buy/index.php > _______________________________________________ > Geotools-devel mailing list > Geotools-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/geotools-devel > > > ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ Geotools-devel mailing list Geotools-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-devel