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?

有帮助吗?

解决方案

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.

其他提示

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top