ws-soap-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bill-s...@carpenter.ORG (WJCarpenter)
Subject odd reflective stuff
Date Sat, 06 Aug 2005 01:26:24 GMT
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...
    }

-- 
bill-soap@carpenter.ORG (WJCarpenter)    PGP 0x91865119
38 95 1B 69 C9 C6 3D 25    73 46 32 04 69 D6 ED F3


Mime
View raw message