Jaxb2Marshaller.java 文件源码

java
阅读 34 收藏 0 点赞 0 评论 0

项目:spring4-understanding 作者:
/**
 * Template method that can be overridden by concrete JAXB marshallers for custom initialization behavior.
 * Gets called after creation of JAXB {@code Marshaller}, and after the respective properties have been set.
 * <p>The default implementation sets the {@link #setUnmarshallerProperties(Map) defined properties}, the {@link
 * #setValidationEventHandler(ValidationEventHandler) validation event handler}, the {@link #setSchemas(Resource[])
 * schemas}, {@link #setUnmarshallerListener(javax.xml.bind.Unmarshaller.Listener) listener}, and
 * {@link #setAdapters(XmlAdapter[]) adapters}.
 */
protected void initJaxbUnmarshaller(Unmarshaller unmarshaller) throws JAXBException {
    if (this.unmarshallerProperties != null) {
        for (String name : this.unmarshallerProperties.keySet()) {
            unmarshaller.setProperty(name, this.unmarshallerProperties.get(name));
        }
    }
    if (this.unmarshallerListener != null) {
        unmarshaller.setListener(this.unmarshallerListener);
    }
    if (this.validationEventHandler != null) {
        unmarshaller.setEventHandler(this.validationEventHandler);
    }
    if (this.adapters != null) {
        for (XmlAdapter<?, ?> adapter : this.adapters) {
            unmarshaller.setAdapter(adapter);
        }
    }
    if (this.schema != null) {
        unmarshaller.setSchema(this.schema);
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号