Вопрос

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