for (QName qn : bi.getTypeNames()) typeMap.put( qn, bi ); if(e.isElement()) for (QName qn : ai.getTypeNames()) typeMap.put( qn, ai ); bi.link(this); bi.wrapUp();
for (Method m : getDeclaredMethods(jt)) { String name = m.getName(); if (match(m, unmarshalEventParams)) { cacheLifecycleMethod(m, FLAG_HAS_BEFORE_UNMARSHAL_METHOD); if (match(m, unmarshalEventParams)) { cacheLifecycleMethod(m, FLAG_HAS_AFTER_UNMARSHAL_METHOD); if (match(m, marshalEventParams)) { cacheLifecycleMethod(m, FLAG_HAS_BEFORE_MARSHAL_METHOD); if (match(m, marshalEventParams)) { cacheLifecycleMethod(m, FLAG_HAS_AFTER_MARSHAL_METHOD);
/** * Creates a new instance of the specified class. * In the unmarshaller, we need to check the user-specified factory class. */ public Object createInstance( JaxBeanInfo beanInfo ) throws SAXException { if(!factories.isEmpty()) { Factory factory = factories.get(beanInfo.jaxbType); if(factory!=null) return factory.createInstance(); } try { return beanInfo.createInstance(this); } catch (IllegalAccessException e) { Loader.reportError("Unable to create an instance of "+beanInfo.jaxbType.getName(),e,false); } catch (InvocationTargetException e) { Loader.reportError("Unable to create an instance of "+beanInfo.jaxbType.getName(),e,false); } catch (InstantiationException e) { Loader.reportError("Unable to create an instance of "+beanInfo.jaxbType.getName(),e,false); } return null; // can never be here }
/** * Invokes the afterUnmarshal method if applicable. */ public final void invokeAfterUnmarshalMethod(UnmarshallerImpl unm, Object child, Object parent) throws SAXException { Method m = getLifecycleMethods().afterUnmarshal; invokeUnmarshallCallback(m, child, unm, parent); }
public QName getElementName(Class o) throws JAXBException { JaxBeanInfo bi = getBeanInfo(o,true); if(!bi.isElement()) return null; return new QName(bi.getElementNamespaceURI(o),bi.getElementLocalName(o)); }
public ArrayLoader(JAXBContextImpl owner) { super(false); itemLoader = itemBeanInfo.getLoader(owner,true); }
@Override public void childElement(UnmarshallingContext.State state, TagName arg) throws SAXException { ChildLoader child = childUnmarshallers.get(arg.uri,arg.local); if(child == null) { Boolean backupWithParentNamespace = ((JAXBContextImpl) state.getContext().getJAXBContext()).backupWithParentNamespace; backupWithParentNamespace = backupWithParentNamespace != null ? backupWithParentNamespace : Boolean.parseBoolean(Util.getSystemProperty(JAXBRIContext.BACKUP_WITH_PARENT_NAMESPACE)); if ((beanInfo != null) && (beanInfo.getTypeNames() != null) && backupWithParentNamespace) { Iterator<?> typeNamesIt = beanInfo.getTypeNames().iterator(); QName parentQName = null; if ((typeNamesIt != null) && (typeNamesIt.hasNext()) && (catchAll == null)) { parentQName = (QName) typeNamesIt.next(); String parentUri = parentQName.getNamespaceURI(); child = childUnmarshallers.get(parentUri, arg.local); } } if (child == null) { child = catchAll; if(child==null) { super.childElement(state,arg); return; } } } state.setLoader(child.loader); state.setReceiver(child.receiver); }
/** * Invoke the afterMarshal api on the external listener (if it exists) and on the bean embedded * afterMarshal api(if it exists). * * This method is called only after the callee has determined that beanInfo.lookForLifecycleMethods == true. * * @param beanInfo * @param currentTarget */ private void fireAfterMarshalEvents(final JaxBeanInfo beanInfo, Object currentTarget) { // first invoke bean embedded listener if (beanInfo.hasAfterMarshalMethod()) { Method m = beanInfo.getLifecycleMethods().afterMarshal; fireMarshalEvent(currentTarget, m); } // then invoke external listener before bean embedded listener Marshaller.Listener externalListener = marshaller.getListener(); if (externalListener != null) { externalListener.afterMarshal(currentTarget); } }
/** * Invoke the beforeMarshal api on the external listener (if it exists) and on the bean embedded * beforeMarshal api(if it exists). * * This method is called only after the callee has determined that beanInfo.lookForLifecycleMethods == true. * * @param beanInfo * @param currentTarget */ private void fireBeforeMarshalEvents(final JaxBeanInfo beanInfo, Object currentTarget) { // first invoke bean embedded listener if (beanInfo.hasBeforeMarshalMethod()) { Method m = beanInfo.getLifecycleMethods().beforeMarshal; fireMarshalEvent(currentTarget, m); } // then invoke external listener Marshaller.Listener externalListener = marshaller.getListener(); if (externalListener != null) { externalListener.beforeMarshal(currentTarget); } }
/** * Gets the ID value from an identifiable object. */ private String getIdFromObject(Object identifiableObject) throws SAXException, JAXBException { return grammar.getBeanInfo(identifiableObject,true).getId(identifiableObject,this); }
public ValueListBeanInfoImpl(JAXBContextImpl owner, Class arrayType) throws JAXBException { super(owner, null, arrayType, false, true, false); this.itemType = jaxbType.getComponentType(); this.xducer = owner.getBeanInfo(arrayType.getComponentType(),true).getTransducer(); assert xducer!=null; }
public QName getElementName(Object o) throws JAXBException { JaxBeanInfo bi = getBeanInfo(o,true); if(!bi.isElement()) return null; return new QName(bi.getElementNamespaceURI(o),bi.getElementLocalName(o)); }
/** * Invokes the beforeUnmarshal method if applicable. */ public final void invokeBeforeUnmarshalMethod(UnmarshallerImpl unm, Object child, Object parent) throws SAXException { Method m = getLifecycleMethods().beforeUnmarshal; invokeUnmarshallCallback(m, child, unm, parent); }
reportError(Messages.NOT_A_QNAME.format(value),true); } else { if(defaultBeanInfo!=null && defaultBeanInfo.getTypeNames().contains(type))
/** * Invoke the afterMarshal api on the external listener (if it exists) and on the bean embedded * afterMarshal api(if it exists). * * This method is called only after the callee has determined that beanInfo.lookForLifecycleMethods == true. * * @param beanInfo * @param currentTarget */ private void fireAfterMarshalEvents(final JaxBeanInfo beanInfo, Object currentTarget) { // first invoke bean embedded listener if (beanInfo.hasAfterMarshalMethod()) { Method m = beanInfo.getLifecycleMethods().afterMarshal; fireMarshalEvent(currentTarget, m); } // then invoke external listener before bean embedded listener Marshaller.Listener externalListener = marshaller.getListener(); if (externalListener != null) { externalListener.afterMarshal(currentTarget); } }
/** * Invoke the beforeMarshal api on the external listener (if it exists) and on the bean embedded * beforeMarshal api(if it exists). * * This method is called only after the callee has determined that beanInfo.lookForLifecycleMethods == true. * * @param beanInfo * @param currentTarget */ private void fireBeforeMarshalEvents(final JaxBeanInfo beanInfo, Object currentTarget) { // first invoke bean embedded listener if (beanInfo.hasBeforeMarshalMethod()) { Method m = beanInfo.getLifecycleMethods().beforeMarshal; fireMarshalEvent(currentTarget, m); } // then invoke external listener Marshaller.Listener externalListener = marshaller.getListener(); if (externalListener != null) { externalListener.beforeMarshal(currentTarget); } }
public String next() throws SAXException, JAXBException { last = i.next(); String id = context.grammar.getBeanInfo(last,true).getId(last,context); if(id==null) { context.errorMissingId(last); } return id; } }
public ValueListBeanInfoImpl(JAXBContextImpl owner, Class arrayType) throws JAXBException { super(owner, null, arrayType, false, true, false); this.itemType = jaxbType.getComponentType(); this.xducer = owner.getBeanInfo(arrayType.getComponentType(),true).getTransducer(); assert xducer!=null; }
public QName getElementName(Class o) throws JAXBException { JaxBeanInfo bi = getBeanInfo(o,true); if(!bi.isElement()) return null; return new QName(bi.getElementNamespaceURI(o),bi.getElementLocalName(o)); }