Red Hat Application Migration Toolkit
package org.exolab.castor.xml.wls8;
import java.io.IOException;
import java.io.OutputStream;
import java.io.Writer;
import java.lang.reflect.Method;
import org.exolab.castor.xml.OutputFormat;
import org.exolab.castor.xml.Serializer;
import org.exolab.castor.xml.wls8.WeblogicXercesImplementation;
import org.xml.sax.DocumentHandler;
public class WeblogicXercesSerializer extends WeblogicXercesImplementation implements Serializer {
private static Class _serializerClass;
private static Method _asDocumentHandler;
private static Method _setOutputByteStream;
private static Method _setOutputCharStream;
private static Method _setOutputFormat;
private Object _serializer;
public WeblogicXercesSerializer() {
try {
this._serializer = _serializerClass.newInstance();
} catch (InstantiationException var2) {
throw new RuntimeException(var2.toString());
} catch (IllegalAccessException var3) {
throw new RuntimeException(var3.toString());
}
}
/** @deprecated */
public DocumentHandler asDocumentHandler() throws IOException {
return (DocumentHandler)this.invoke(_asDocumentHandler, new Object[0]);
}
public void setOutputByteStream(OutputStream output) {
Object[] params = new Object[]{output};
this.invoke(_setOutputByteStream, params);
}
public void setOutputCharStream(Writer out) {
Object[] params = new Object[]{out};
this.invoke(_setOutputCharStream, params);
}
public void setOutputFormat(OutputFormat format) {
Object[] params = new Object[]{format.getFormat()};
this.invoke(_setOutputFormat, params);
}
private Object invoke(Method method, Object[] params) {
return this.invoke(this._serializer, method, params);
}
static {
Class weblogicOutputFormat = null;
try {
_serializerClass = Class.forName("weblogic.apache.xml.serialize.XMLSerializer");
weblogicOutputFormat = Class.forName("weblogic.apache.xml.serialize.OutputFormat");
} catch (ClassNotFoundException var4) {
handleStaticInitException(var4);
}
_asDocumentHandler = getMethod(_serializerClass, "asDocumentHandler", new Class[0]);
Class[] parameterOutputStream = new Class[]{OutputStream.class};
_setOutputByteStream = getMethod(_serializerClass, "setOutputByteStream", parameterOutputStream);
Class[] parameterWriter = new Class[]{Writer.class};
_setOutputCharStream = getMethod(_serializerClass, "setOutputCharStream", parameterWriter);
Class[] parameterOutputFormat = new Class[]{weblogicOutputFormat};
_setOutputFormat = getMethod(_serializerClass, "setOutputFormat", parameterOutputFormat);
}
}