문제

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