PodamFactoryImpl: Support for JAXBElement instantiation
Classes generated by the JAXB compiler, xjc, produces properties that may include a JAXBElement<T> wrapper. This wrapper is used to encapsulate information related to the XML schema such as the QName (namespace + element name), etc. The wrapper stores the actual property value in its own getValue() / setValue(...) property. Here is a patch for the manufactureAttributeValue method of the PodamFactoryImpl class to create the wrapper and generate a mock of the actual type. It is located just ahead of the exitsing test for "java" and "javax" classes.
import javax.xml.bind.JAXBElement;
import javax.xml.namespace.QName;
...
if ( realAttributeType.getName().startsWith("javax.xml.bind.JAXBElement"))
{
@SuppressWarnings("unchecked")
Class<Object> declaredType = (Class<Object>) genericTypeArgs[0];
String namepaceURI = pojoClass.getPackage().getName();
QName name = new QName(namepaceURI, attributeName);
Object value = manufactureAttributeValue(pojoClass, pojos, declaredType,
annotations, attributeName, new Type[0]);
attributeValue = new JAXBElement<Object>(name, declaredType, value);
}
else if (realAttributeType.getName().startsWith("java.")
|| realAttributeType.getName().startsWith("javax.")) {
...
Fixed in Podam 4.5.0.
Marco could I ask your help with releasing?
Released to Maven Central
On 31 Dec 2014, at 08:48, Daniil Ivanov [email protected] wrote:
Fixed in Podam 4.5.0.
Marco could I ask your help with releasing?
— Reply to this email directly or view it on GitHub https://github.com/mtedone/podam/issues/70#issuecomment-68430407.
Thank you Marco!
Closing.