public BeanT createInstance(UnmarshallingContext context) throws IllegalAccessException, InvocationTargetException, InstantiationException, SAXException { BeanT bean = null; if (factoryMethod == null) { bean = ClassFactory.create0(jaxbType); } else { Object o = ClassFactory.create(factoryMethod); if (jaxbType.isInstance(o)) { bean = (BeanT) o; } else { throw new InstantiationException("The factory method didn't return a correct object"); } } if (xmlLocatorField != null) // need to copy because Locator is mutable try { xmlLocatorField.set(bean, new LocatorImpl(context.getLocator())); } catch (AccessorException e) { context.handleError(e); } return bean; }
/* */ private void assign(BeanT bean, TargetT t, UnmarshallingContext context) throws AccessorException /* */ { /* 286 */ if (!this.targetType.isInstance(t)) /* 287 */ context.handleError( Messages.UNASSIGNABLE_TYPE.format(new Object[] {this.targetType, t.getClass()})); /* */ else /* 289 */ this.acc.set(bean, t); /* */ }
public boolean reset(BeanT bean, UnmarshallingContext context) throws SAXException { try { if (superClazz != null) superClazz.reset(bean, context); for (Property<BeanT> p : properties) p.reset(bean); return true; } catch (AccessorException e) { context.handleError(e); return false; } }