Question

There is a class that is annotated with JAXB's @XmlRootElement, but there are some flows which doesn't exploit this annotation and which require high performance. Is there a performance penalty in constructing objects from this class and setting fields as opposed to doing so with the same class without this annotation?

Was it helpful?

Solution

There would be a small amount of memory used to store metadata related to a class being annotated with @XmlRootElement. The only runtime processing impact related to the presence of that annotation would be when bootstrapping the JAXBContext. There would be no impact on marshalling and unmarshalling.

OTHER TIPS

If I understand correctly, no, an annotation is metadata attached to the Class object, not to instances of the class.

The annotation will in no way affect creating instances and invoking methods on them directly.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top