WJCarpenter
2005-08-06 01:26:24 UTC
I happened across this stuff in org.apache.soap.encoding.SOAPMappingRegistry.
Those Class.forName() calls struck me as a little odd. It's mainly
curiosity, but I wonder why those things were instantiated
reflectively instead of just via new like so many other serializers in
that same source file.
try {
Class XMISerializer =
Class.forName("org.apache.soap.util.xml.XMISerializer");
Class XMIParameterSerializer =
Class.forName("org.apache.soap.encoding.xmi.XMIParameterSerializer");
// Register default serializers for XMI encoding style.
mapTypes(Constants.NS_URI_XMI_ENC, null, null,
(Serializer)XMISerializer.newInstance(),
(Deserializer)XMIParameterSerializer.newInstance());
// Register serializer for Parameter class - not deserializer!
mapTypes(Constants.NS_URI_XMI_ENC, null, Parameter.class,
(Serializer)XMIParameterSerializer.newInstance(), null);
} catch (IllegalAccessException iae) {
} catch (InstantiationException ie) {
} catch (ClassNotFoundException cnfe) {
} catch (NoClassDefFoundError ncdfe) {
// If the class can't be loaded, continue without it...
}
Those Class.forName() calls struck me as a little odd. It's mainly
curiosity, but I wonder why those things were instantiated
reflectively instead of just via new like so many other serializers in
that same source file.
try {
Class XMISerializer =
Class.forName("org.apache.soap.util.xml.XMISerializer");
Class XMIParameterSerializer =
Class.forName("org.apache.soap.encoding.xmi.XMIParameterSerializer");
// Register default serializers for XMI encoding style.
mapTypes(Constants.NS_URI_XMI_ENC, null, null,
(Serializer)XMISerializer.newInstance(),
(Deserializer)XMIParameterSerializer.newInstance());
// Register serializer for Parameter class - not deserializer!
mapTypes(Constants.NS_URI_XMI_ENC, null, Parameter.class,
(Serializer)XMIParameterSerializer.newInstance(), null);
} catch (IllegalAccessException iae) {
} catch (InstantiationException ie) {
} catch (ClassNotFoundException cnfe) {
} catch (NoClassDefFoundError ncdfe) {
// If the class can't be loaded, continue without it...
}
--
bill-***@carpenter.ORG (WJCarpenter) PGP 0x91865119
38 95 1B 69 C9 C6 3D 25 73 46 32 04 69 D6 ED F3
bill-***@carpenter.ORG (WJCarpenter) PGP 0x91865119
38 95 1B 69 C9 C6 3D 25 73 46 32 04 69 D6 ED F3