javax.xml.transform.Result#getClass ( )源码实例Demo

下面列出了javax.xml.transform.Result#getClass ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: spring-analysis-note   文件: AbstractMarshaller.java
/**
 * Marshals the object graph with the given root into the provided {@code javax.xml.transform.Result}.
 * <p>This implementation inspects the given result, and calls {@code marshalDomResult},
 * {@code marshalSaxResult}, or {@code marshalStreamResult}.
 * @param graph the root of the object graph to marshal
 * @param result the result to marshal to
 * @throws IOException if an I/O exception occurs
 * @throws XmlMappingException if the given object cannot be marshalled to the result
 * @throws IllegalArgumentException if {@code result} if neither a {@code DOMResult},
 * a {@code SAXResult}, nor a {@code StreamResult}
 * @see #marshalDomResult(Object, javax.xml.transform.dom.DOMResult)
 * @see #marshalSaxResult(Object, javax.xml.transform.sax.SAXResult)
 * @see #marshalStreamResult(Object, javax.xml.transform.stream.StreamResult)
 */
@Override
public final void marshal(Object graph, Result result) throws IOException, XmlMappingException {
	if (result instanceof DOMResult) {
		marshalDomResult(graph, (DOMResult) result);
	}
	else if (StaxUtils.isStaxResult(result)) {
		marshalStaxResult(graph, result);
	}
	else if (result instanceof SAXResult) {
		marshalSaxResult(graph, (SAXResult) result);
	}
	else if (result instanceof StreamResult) {
		marshalStreamResult(graph, (StreamResult) result);
	}
	else {
		throw new IllegalArgumentException("Unknown Result type: " + result.getClass());
	}
}
 
/**
 * Marshals the object graph with the given root into the provided {@code javax.xml.transform.Result}.
 * <p>This implementation inspects the given result, and calls {@code marshalDomResult},
 * {@code marshalSaxResult}, or {@code marshalStreamResult}.
 * @param graph the root of the object graph to marshal
 * @param result the result to marshal to
 * @throws IOException if an I/O exception occurs
 * @throws XmlMappingException if the given object cannot be marshalled to the result
 * @throws IllegalArgumentException if {@code result} if neither a {@code DOMResult},
 * a {@code SAXResult}, nor a {@code StreamResult}
 * @see #marshalDomResult(Object, javax.xml.transform.dom.DOMResult)
 * @see #marshalSaxResult(Object, javax.xml.transform.sax.SAXResult)
 * @see #marshalStreamResult(Object, javax.xml.transform.stream.StreamResult)
 */
@Override
public final void marshal(Object graph, Result result) throws IOException, XmlMappingException {
	if (result instanceof DOMResult) {
		marshalDomResult(graph, (DOMResult) result);
	}
	else if (StaxUtils.isStaxResult(result)) {
		marshalStaxResult(graph, result);
	}
	else if (result instanceof SAXResult) {
		marshalSaxResult(graph, (SAXResult) result);
	}
	else if (result instanceof StreamResult) {
		marshalStreamResult(graph, (StreamResult) result);
	}
	else {
		throw new IllegalArgumentException("Unknown Result type: " + result.getClass());
	}
}
 
/**
 * Marshals the object graph with the given root into the provided {@code javax.xml.transform.Result}.
 * <p>This implementation inspects the given result, and calls {@code marshalDomResult},
 * {@code marshalSaxResult}, or {@code marshalStreamResult}.
 * @param graph the root of the object graph to marshal
 * @param result the result to marshal to
 * @throws IOException if an I/O exception occurs
 * @throws XmlMappingException if the given object cannot be marshalled to the result
 * @throws IllegalArgumentException if {@code result} if neither a {@code DOMResult},
 * a {@code SAXResult}, nor a {@code StreamResult}
 * @see #marshalDomResult(Object, javax.xml.transform.dom.DOMResult)
 * @see #marshalSaxResult(Object, javax.xml.transform.sax.SAXResult)
 * @see #marshalStreamResult(Object, javax.xml.transform.stream.StreamResult)
 */
@Override
public final void marshal(Object graph, Result result) throws IOException, XmlMappingException {
	if (result instanceof DOMResult) {
		marshalDomResult(graph, (DOMResult) result);
	}
	else if (StaxUtils.isStaxResult(result)) {
		marshalStaxResult(graph, result);
	}
	else if (result instanceof SAXResult) {
		marshalSaxResult(graph, (SAXResult) result);
	}
	else if (result instanceof StreamResult) {
		marshalStreamResult(graph, (StreamResult) result);
	}
	else {
		throw new IllegalArgumentException("Unknown Result type: " + result.getClass());
	}
}
 
 方法所在类