Announcement Announcement Module
Collapse
No announcement yet.
HttpInvoker and Jakarta Commons Enum Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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, 08:16 AM.

  • #2
    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

    Comment


    • #3
      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, 01:57 AM.

      Comment


      • #4
        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 ?

        Comment

        Working...
        X