Defining a class in developer

Hi all,

Does anybody know how to define a class in developer? My requirement is I need to define a class which implements Comparator interface and overrides one of its method. So what is the best way of doing it?

I think there is extends field in java service. You can implement any interface and import any java class…

Create your Java class(es) as you would normally for any Java application (ex. using Eclipse, etc.) Compile it and drop it within the code/classes directory of the package from which you want to use it; or, my personal preference, jar it up and place it in the code/jars directory of the package.

You can then import the class from the Shared tab of your Java service and use it as you would any other class.

  • Percio

Hello,
We can not write explicitly any Java class in developer, but you can write a Java service that acts as a method in the java class.
Parent folder of Java service acts as Java class, it is internally created by webMethods Developer and all Java services written under that parent folder become methods of class. You can find .class file of Java class under IntegrationServer/packages//code/classes.

If you want to make use of existing third-party Java class in Developer, then you need to import those classes or java package into your Java service, this can be achieved by adding jars under IntegrationServer/packages//code/jars. So you can use extends option under “shared” tab of Java service to inherit any methods of a class or use “Implements” option if want to implement any interface from the jars/class that is imported.

Thanks,
Naga.

Here is an example of defining a class using Developer. Coincidentally, it is a class implementing the Comparator interface. Keep in mind that the class is accessible only by services within the same IS package.

http://reamon.squarespace.com/articles/2009/4/20/wm-is-document-list-sort-over-multiple-fields.html

[Edit] The example uses a nested static class and can be instantiated anywhere within the package containing the class. http://www.javaworld.com/javaworld/javaqa/1999-08/01-qa-static2.html