super(modelBuilder, upstream, clazz);
accessorFactory = createAccessorFactory(clazz);
}
protected AccessorFactory createAccessorFactory(Class clazz) {
XmlAccessorFactory factoryAnn;
AccessorFactory accFactory = null;
// user providing class to be used.
JAXBContextImpl context = ((RuntimeModelBuilder) builder).context;
if (context!=null) {
this.supressAccessorWarnings = context.supressAccessorWarnings;
if (context.xmlAccessorFactorySupport) {
factoryAnn = findXmlAccessorFactoryAnnotation(clazz);
if (factoryAnn != null) {
try {
accFactory = factoryAnn.value().newInstance();
} catch (InstantiationException e) {
builder.reportError(new IllegalAnnotationException(
Messages.ACCESSORFACTORY_INSTANTIATION_EXCEPTION.format(
factoryAnn.getClass().getName(), nav().getClassName(clazz)), this));
} catch (IllegalAccessException e) {
builder.reportError(new IllegalAnnotationException(
Messages.ACCESSORFACTORY_ACCESS_EXCEPTION.format(
factoryAnn.getClass().getName(), nav().getClassName(clazz)),this));
}
}
}
}