Here's some UML:
I'm trying to marshall those Components which are stored in a HashMap<String, Component> with this annotated code as explained in the Unofficial JAXB guide:
/**
* This is a marshalling method which returns each
* of this entity's components in a Collection
* @return A collection of this entity's components
*/
@XmlElementWrapper(name="components")
@XmlAnyElement
@XmlElementRef
public Collection<Component> getComponentSet() {
return components.values();
}
And in each Component implementation I put @XmlRootElement
But JAXB is stuck on the following exception and all my attempts to get past it have been futile:
Exception in thread "main" com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions
mycrap.core.components.Component is an interface and JAXB can't handle interfaces.
this problem is related to the following location:
at mycrap.core.components.Component
at public java.util.Collection tobacco.core.components.Entity.getComponentSet()
at mycrap.core.components.Entity
I've been dealing with this for a couple of days to no avail. Other posts I find don't seem to get this exception at this point, once @XmlAnyElement's in place. What have I done wrong?! :(
No comments:
Post a Comment