jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
Signup
castor
  • castor
  • CASTOR-2907 Continue extending JPA annotations su...
  • CASTOR-2969

Implement @Enumerated

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Sub-task Sub-task
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.3.2, 1.4
  • Fix Version/s: 1.3.2
  • Component/s: JPA annotations
  • Labels:
    None
  • Number of attachments :
    5
  • Options
    • Sort By Name
    • Sort By Date
    • Ascending
    • Descending
    • Download All

Attachments

  1. Text File
    enum_0.patch
    01/Aug/10 2:40 PM
    19 kB
    Robert Thurnher
  2. Text File
    enum_1.patch
    15/Aug/10 10:46 AM
    21 kB
    Robert Thurnher
  3. Text File
    enum_2.patch
    16/Aug/10 4:00 PM
    5 kB
    Robert Thurnher
  4. Text File
    enum_3.patch
    18/Aug/10 3:34 PM
    9 kB
    Robert Thurnher
  5. Text File
    enum_4.patch
    20/Aug/10 11:14 AM
    1 kB
    Robert Thurnher

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
Robert Thurnher added a comment - 01/Aug/10 2:40 PM

Attached preliminary patch (work in progress).

IT currently fails (consequently, failing test case method's annotated with `@Ignore` ATM).

Feedback's very welcome; most probably corresponding approach/code in `InfoToDescriptorConverter`'s needs more work/thought..?

Show
Robert Thurnher added a comment - 01/Aug/10 2:40 PM Attached preliminary patch (work in progress). IT currently fails (consequently, failing test case method's annotated with `@Ignore` ATM). Feedback's very welcome; most probably corresponding approach/code in `InfoToDescriptorConverter`'s needs more work/thought..?
Hide
Permalink
Werner Guttmann added a comment - 02/Aug/10 4:13 PM

Just out of curiosity, why did you decide to go down that route ? And in addition, have you tried to debug what happens in FieldDescriptorImpl#createFieldDesc() and AbstractMappingLoader#createFieldHandler() respectively ?

Show
Werner Guttmann added a comment - 02/Aug/10 4:13 PM Just out of curiosity, why did you decide to go down that route ? And in addition, have you tried to debug what happens in FieldDescriptorImpl#createFieldDesc() and AbstractMappingLoader#createFieldHandler() respectively ?
Hide
Permalink
Robert Thurnher added a comment - 03/Aug/10 2:45 PM

Actually, just thought, since there's a special `EnumFieldHandler` in Castor JDO already, why not use it.

So, debugging some more now.

Show
Robert Thurnher added a comment - 03/Aug/10 2:45 PM Actually, just thought, since there's a special `EnumFieldHandler` in Castor JDO already, why not use it. So, debugging some more now.
Hide
Permalink
Robert Thurnher added a comment - 04/Aug/10 3:16 PM

Werner, debugging showed that AbstractMappingLoader#createField[Desc|Handler]() seem to not get called. What would you suggest how to proceed here?

Show
Robert Thurnher added a comment - 04/Aug/10 3:16 PM Werner, debugging showed that AbstractMappingLoader#createField [Desc|Handler] () seem to not get called. What would you suggest how to proceed here?
Hide
Permalink
Robert Thurnher added a comment - 15/Aug/10 10:46 AM

Attached patch with working impl. of string-serialized/converted enum types.

Thus, ordinal serialization/conversion (which should be default behavior according to JPA spec) doesn't work yet and corresponding integration test code is currently commented out.

Show
Robert Thurnher added a comment - 15/Aug/10 10:46 AM Attached patch with working impl. of string-serialized/converted enum types. Thus, ordinal serialization/conversion (which should be default behavior according to JPA spec) doesn't work yet and corresponding integration test code is currently commented out.
Hide
Permalink
Werner Guttmann added a comment - 15/Aug/10 2:18 PM

I had a peek at the code, and it loks good to me so far (except this one dealing with a NoSuchMethodException). Re: support for ordinals, I will be back soon.

Show
Werner Guttmann added a comment - 15/Aug/10 2:18 PM I had a peek at the code, and it loks good to me so far (except this one dealing with a NoSuchMethodException). Re: support for ordinals, I will be back soon.
Hide
Permalink
Werner Guttmann added a comment - 15/Aug/10 2:34 PM

Robert, I just decided to commit the current patch almost as is. Here's some observations:

  • That NoSuchMethodException catching somehow does not seem right.
  • It might be worthwhile to move this new EnumTypeConvertor to a new (standalone) class.
  • Please add comments in some places to make available the knowledge you extracted from your debugging sessions.
Show
Werner Guttmann added a comment - 15/Aug/10 2:34 PM Robert, I just decided to commit the current patch almost as is. Here's some observations: That NoSuchMethodException catching somehow does not seem right. It might be worthwhile to move this new EnumTypeConvertor to a new (standalone) class. Please add comments in some places to make available the knowledge you extracted from your debugging sessions.
Hide
Permalink
Robert Thurnher added a comment - 15/Aug/10 3:29 PM

Thanks for the feedback, am going to apply/improve mentioned points and curious about what to do best regarding ordinals support.

Show
Robert Thurnher added a comment - 15/Aug/10 3:29 PM Thanks for the feedback, am going to apply/improve mentioned points and curious about what to do best regarding ordinals support.
Hide
Permalink
Werner Guttmann added a comment - 16/Aug/10 3:26 PM

I just had a peek at java.lang.Enum, and there is

/**
 * Returns the ordinal of this enumeration constant (its 
 * position in its enum declaration, where the initial 
 * constant is assigned an ordinal of zero).
 * 
 * Most programmers will have no use for this method. It 
 * is designed for use by sophisticated enum-based data 
 * structures, such as {@link java.util.EnumSet} and 
 * {@link java.util.EnumMap}.
 *
 * @return the ordinal of this enumeration constant
 */
 public final int ordinal() {
   return ordinal;
}
Show
Werner Guttmann added a comment - 16/Aug/10 3:26 PM I just had a peek at java.lang.Enum, and there is /** * Returns the ordinal of this enumeration constant (its * position in its enum declaration, where the initial * constant is assigned an ordinal of zero). * * Most programmers will have no use for this method. It * is designed for use by sophisticated enum -based data * structures, such as {@link java.util.EnumSet} and * {@link java.util.EnumMap}. * * @ return the ordinal of this enumeration constant */ public final int ordinal() { return ordinal; }
Hide
Permalink
Robert Thurnher added a comment - 16/Aug/10 4:00 PM

Attached patch containing aforementioned refinements.

Now looking further into using `java.lang.Enum#ordinal` for supporting conversion of ordinals as well, thanks.

Show
Robert Thurnher added a comment - 16/Aug/10 4:00 PM Attached patch containing aforementioned refinements. Now looking further into using `java.lang.Enum#ordinal` for supporting conversion of ordinals as well, thanks.
Hide
Permalink
Werner Guttmann added a comment - 18/Aug/10 2:52 PM

Just commited those two refactorings. I just wonder whether the new EnumTypeConvertor should go to the same package as all others. What's your view ?

Show
Werner Guttmann added a comment - 18/Aug/10 2:52 PM Just commited those two refactorings. I just wonder whether the new EnumTypeConvertor should go to the same package as all others. What's your view ?
Hide
Permalink
Robert Thurnher added a comment - 18/Aug/10 3:34 PM

Yes, agreed; makes sense to put convertors into existing, dedicated package.

Attached patch refactoring some more as well as containing working impl. of ordinals support.

Show
Robert Thurnher added a comment - 18/Aug/10 3:34 PM Yes, agreed; makes sense to put convertors into existing, dedicated package. Attached patch refactoring some more as well as containing working impl. of ordinals support.
Hide
Permalink
Robert Thurnher added a comment - 20/Aug/10 11:14 AM

Werner, I've made a mistake while refactoring concerning `svn mv`, sorry.

So here's another patch for deleting the package-wise moved `EnumTypeConvertor`.

Show
Robert Thurnher added a comment - 20/Aug/10 11:14 AM Werner, I've made a mistake while refactoring concerning `svn mv`, sorry. So here's another patch for deleting the package-wise moved `EnumTypeConvertor`.

People

  • Assignee:
    Werner Guttmann
    Reporter:
    Robert Thurnher
Vote (0)
Watch (0)

Dates

  • Created:
    01/Aug/10 2:34 PM
    Updated:
    22/Jul/11 4:34 PM
    Resolved:
    20/Aug/10 2:08 PM
  • Atlassian JIRA (v5.2.7#850-sha1:b2af0c8)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.