Results 1 to 4 of 4

Thread: HttpInvoker and Jakarta Commons Enum

  1. #1

    Default HttpInvoker and Jakarta Commons Enum

    Hi,

    i try to return instances of org.apache.commons.lang.enums.Enum as the result of some method call using HttpInvoker. i do get always null as a result and cant imagine why this happens. Enum does implement the interface Serializable and my subclass is as simple as it can be

    Code:
    public class Taste extends Enum {
    	
    	Taste(String name) {
    		super(name);
    	}	
    }
    does anyone has any suggestions or any experiences with Enum and HttpInvoker? Working sample code would be nice.
    Last edited by Locomotyphus; Jan 2nd, 2007 at 08:16 AM.

  2. #2

    Default

    Are you shure that you are using the commons enum correctly?

    As far as I know, the constructor should be made private and static instances of the Taste class should be registred within this class.
    See http://jakarta.apache.org/commons/la...nums/Enum.html

    Where are you creating instances of the Taste class?

    When used like described in the API docs, serialistaion should work (from what I experienced)

    BR
    \christof

  3. #3

    Default

    The Taste class is just an example. We build up the enumeration lazy, on the event of first fetch. But bevor the first instance is available all the enumerations have been build. The instances of enumeration are created on the serverside and than delivered to the client side. On the serverside the log entries show that all enumnerations are created, but after delivery via HttpInvoker the result is <null>. That's the strange thing.

    I have simplified the problem to a method which just creates one instance of the enumeration and return it as method result. Even this simple scenario does not work, but returns <null>. Now i am glueless.
    Last edited by Locomotyphus; Jan 3rd, 2007 at 01:57 AM.

  4. #4
    Join Date
    Aug 2006
    Location
    Now Germany, previously Ukraine
    Posts
    1,546

    Default

    Quote Originally Posted by laenzlinger View Post
    Are you shure that you are using the commons enum correctly?

    As far as I know, the constructor should be made private and static instances of the Taste class should be registred within this class.
    See http://jakarta.apache.org/commons/la...nums/Enum.html

    Where are you creating instances of the Taste class?

    When used like described in the API docs, serialistaion should work (from what I experienced)

    BR
    Constructors definitely need not to be private - docs clearly stated that Enums can be subclassed and hierarchy of the Enums may be built. How would you subclass the class that has only private constructors ?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •