Red Hat Application Migration Toolkit
package org.exolab.castor.xml.wls8;
import java.lang.reflect.Method;
import org.exolab.castor.xml.OutputFormat;
import org.exolab.castor.xml.wls8.WeblogicXercesImplementation;
public class WeblogicXercesOutputFormat extends WeblogicXercesImplementation implements OutputFormat {
private static Class outputFormatClass;
private static Method setDoctype;
private static Method setEncoding;
private static Method setIndenting;
private static Method setMethod;
private static Method setOmitDocumentType;
private static Method setOmitXMLDeclaration;
private static Method setPreserveSpace;
private Object outputFormat;
public WeblogicXercesOutputFormat() {
try {
this.outputFormat = outputFormatClass.newInstance();
} catch (InstantiationException var2) {
throw new RuntimeException(var2.toString());
} catch (IllegalAccessException var3) {
throw new RuntimeException(var3.toString());
}
}
public void setMethod(String method) {
Object[] params = new Object[]{method};
this.invoke(setMethod, params);
}
public void setIndenting(boolean indent) {
Boolean[] params = new Boolean[]{Boolean.valueOf(indent)};
this.invoke(setIndenting, params);
}
public void setPreserveSpace(boolean preserveSpace) {
Boolean[] params = new Boolean[]{new Boolean(preserveSpace)};
this.invoke(setPreserveSpace, params);
}
public Object getFormat() {
return this.outputFormat;
}
public void setDoctype(String type1, String type2) {
Object[] params = new Object[]{type1, type2};
this.invoke(setDoctype, params);
}
public void setOmitXMLDeclaration(boolean omitXMLDeclaration) {
Boolean[] params = new Boolean[]{Boolean.valueOf(omitXMLDeclaration)};
this.invoke(setOmitXMLDeclaration, params);
}
public void setOmitDocumentType(boolean omitDocumentType) {
Boolean[] params = new Boolean[]{Boolean.valueOf(omitDocumentType)};
this.invoke(setOmitDocumentType, params);
}
public void setEncoding(String encoding) {
String[] params = new String[]{encoding};
this.invoke(setEncoding, params);
}
private Object invoke(Method method, Object[] params) {
return this.invoke(this.outputFormat, method, params);
}
static {
String wlsOutputFormatClassFqcn = "weblogic.apache.xml.serialize.OutputFormat";
try {
outputFormatClass = Class.forName(wlsOutputFormatClassFqcn);
} catch (ClassNotFoundException var4) {
handleStaticInitException("Could find class " + wlsOutputFormatClassFqcn, var4);
}
Class[] parameterTwoStrings = new Class[]{String.class, String.class};
setDoctype = getMethod(outputFormatClass, "setDoctype", parameterTwoStrings);
Class[] parameterOneString = new Class[]{String.class};
setEncoding = getMethod(outputFormatClass, "setEncoding", parameterOneString);
Class[] parameterBoolean = new Class[]{Boolean.TYPE};
setIndenting = getMethod(outputFormatClass, "setIndenting", parameterBoolean);
setMethod = getMethod(outputFormatClass, "setMethod", parameterOneString);
setOmitDocumentType = getMethod(outputFormatClass, "setOmitDocumentType", parameterBoolean);
setOmitXMLDeclaration = getMethod(outputFormatClass, "setOmitXMLDeclaration", parameterBoolean);
setPreserveSpace = getMethod(outputFormatClass, "setPreserveSpace", parameterBoolean);
}
}