If you're interested in functional programming, you might also want to checkout my second blog which i'm actively working on!!

Thursday, March 26, 2015

Fixing collisions ObjectFactory while executing wsdl2java

Often you have to deal with WSDL's from third parties. Sometimes the WSDL including referenced schemas are setup crappy and you run into issues while converting the WSDL to Java. Below we will look into how to fix these issues.

Eclipse will complain with following message

[ERROR] file:/playground/objectfactory/src/main/resources/xsd/helloworld.xsd [32,3]: (Relevant to above error) another "ReasonType" is generated from here. [ERROR] file:/playground/objectfactory/src/main/resources/xsd/helloworld.xsd [32,3]: Two declarations cause a collision in the ObjectFactory class. [ERROR] file:/playground/objectfactory/src/main/resources/xsd/helloworld.xsd [26,3]: (Related to above error) This is the other declaration. [ERROR] file:/playground/objectfactory/src/main/resources/xsd/helloworld.xsd [9,3]: Two declarations cause a collision in the ObjectFactory class. [ERROR] file:/playground/objectfactory/src/main/resources/xsd/helloworld.xsd [10,3]: (Related to above error) This is the other declaration. [ERROR] file:/playground/objectfactory/src/main/resources/xsd/helloworld.xsd [15,7]: Two declarations cause a collision in the ObjectFactory class. [ERROR] file:/playground/objectfactory/src/main/resources/xsd/helloworld.xsd [14,7]: (Related to above error) This is the other declaration. A class/interface with the same name "com.pelssers.helloworld.wrapper.ReasonType" is already in use. Use a class customization to resolve this conflict.

Below a version that fixes all issues. Ps. Sometimes it might also be useful to add @underscoreBinding="asCharInWord" to the globalBindings.

Friday, April 4, 2014

Ceylon: annotations

What is an annotation?

An annotation is a top level function that returns a subtype of ConstrainedAnnotation.

There are 2 interfaces which satisfy ConstrainedAnnotation directly:
  • OptionalAnnotation: An annotation that may occur at most once at a single program element and only on certain program elements.
  • SequencedAnnotation: An annotation that may occur multiple times at a single program element, and only on certain program elements.

Let's see the type hierarchy of ConstrainedAnnotation to get a better picture.


So what you might have thought to be reserved keywords (shared, formal, actual, ...) are in fact annotations used by the compiler.  Let's see how the DocAnnotation is implemented.