On Thu, Sep 29, 2011 at 12:54 AM, Andreas Veithen <andreas.veit...@gmail.com> wrote: > That doesn't look like good OO design. XMLGregorianCalendar is an > abstract API and the actual runtime type is completely implementation > dependent. Trying to enumerate every possible existing implementation > is obviously not a correct approach. I would not be surprised if e.g. > on IBM WebSphere, that API is implemented by yet another class.
Agree on you, in fact my original aim was to use instanceof operator to identify implementation class. BTW I have changed above method in r1177265. Thanks ! > > This probably points to a design flaw in the TypeTable thing. > > Andreas > > On Tue, Sep 27, 2011 at 10:45, <sag...@apache.org> wrote: >> Author: sagara >> Date: Tue Sep 27 08:45:05 2011 >> New Revision: 1176281 >> >> URL: http://svn.apache.org/viewvc?rev=1176281&view=rev >> Log: >> Since org.apache.xerces.jaxp.datatype.XMLGregorianCalendarImpl is not an >> instantiable class this method return null, changed to use Class names. >> >> Modified: >> >> axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/description/java2wsdl/TypeTable.java >> >> Modified: >> axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/description/java2wsdl/TypeTable.java >> URL: >> http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/description/java2wsdl/TypeTable.java?rev=1176281&r1=1176280&r2=1176281&view=diff >> ============================================================================== >> --- >> axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/description/java2wsdl/TypeTable.java >> (original) >> +++ >> axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/description/java2wsdl/TypeTable.java >> Tue Sep 27 08:45:05 2011 >> @@ -330,25 +330,18 @@ public class TypeTable { >> * the name >> * @return the schema type name by class >> */ >> - private QName getSchemaTypeNameByClass(String name) { >> - Object dataClass; >> - try { >> - dataClass = Class.forName(name).newInstance(); >> - /* >> - * XMLGregorianCalendar can be found as following classes. >> - * >> 1.)com.sun.org.apache.xerces.internal.jaxp.datatype.XMLGregorianCalendarImpl >> - * 2.)org.apache.xerces.jaxp.datatype.XMLGregorianCalendarImpl >> - */ >> - if (dataClass instanceof XMLGregorianCalendar) { >> - return (QName) >> simpleTypetoxsd.get(XMLGregorianCalendar.class >> - .getName()); >> - } >> - } catch (InstantiationException e) { >> - e.printStackTrace(); >> - } catch (IllegalAccessException e) { >> - e.printStackTrace(); >> - } catch (ClassNotFoundException e) { >> - e.printStackTrace(); >> + private QName getSchemaTypeNameByClass(String name) { >> + /* >> + * XMLGregorianCalendar can be found as following classes. >> + * >> 1.)com.sun.org.apache.xerces.internal.jaxp.datatype.XMLGregorianCalendarImpl >> + * 2.)org.apache.xerces.jaxp.datatype.XMLGregorianCalendarImpl >> + */ >> + if >> ("com.sun.org.apache.xerces.internal.jaxp.datatype.XMLGregorianCalendarImpl" >> + .equals(name) >> + || >> "org.apache.xerces.jaxp.datatype.XMLGregorianCalendarImpl" >> + .equals(name)) { >> + return (QName) simpleTypetoxsd.get(XMLGregorianCalendar.class >> + .getName()); >> } >> return null; >> } >> >> >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-dev-unsubscr...@axis.apache.org > For additional commands, e-mail: java-dev-h...@axis.apache.org > > -- Sagara Gunathunga Blog - http://ssagara.blogspot.com Web - http://people.apache.org/~sagara/ LinkedIn - http://www.linkedin.com/in/ssagara --------------------------------------------------------------------- To unsubscribe, e-mail: java-dev-unsubscr...@axis.apache.org For additional commands, e-mail: java-dev-h...@axis.apache.org