
| Key: |
NUCRDBMS-50
|
| Type: |
Improvement
|
| Status: |
Open
|
| Priority: |
Major
|
| Assignee: |
Unassigned
|
| Reporter: |
Erik Bengtson
|
| Votes: |
1
|
| Watchers: |
1
|
|
If you were logged in you would be able to see more operations.
|
|
|
|
|
| Component/s: |
None
|
| Affects Version/s: |
None
|
| Fix Version/s: |
None
|
|
|
Enum usage is normally a combination of name and ordinal values. Currently JPOX supports persisting the name or ordinal values, but should be allowed to persist arbitrary values. See the example:
public enum Test {
RED(1), BLUE(5);
private final int value;
Test(int v)
{
this.value = v;
}
public final int getValue()
{
return this.value;
}
public final static Enum getEnum(int i)
{
switch(i)
{
case 1: return Test.RED;
case 5: return Test.BLUE;
}
return null;
}
}
<jdo>
<package name="org.jpox.samples.jdo.enums">
<class name="Palette">
<field name="color" persistence-modifier="persistent" serialized="false">
<column>
<extension vendor-name="jpox" key="enum-persistence-value-getter" value="getValue"/>
<extension vendor-name="jpox" key="enum-enum-value-getter" value="getEnum"/>
</column>
</field>
</class>
</package>
</jdo>
enum-enum-value-getter is the getter name for a static method that returns the Enum instance for the corresponding value.
enum-persistence-value-getter is the getter name for an instance method that returns the value to be persisted
|
|
Description
|
Enum usage is normally a combination of name and ordinal values. Currently JPOX supports persisting the name or ordinal values, but should be allowed to persist arbitrary values. See the example:
public enum Test {
RED(1), BLUE(5);
private final int value;
Test(int v)
{
this.value = v;
}
public final int getValue()
{
return this.value;
}
public final static Enum getEnum(int i)
{
switch(i)
{
case 1: return Test.RED;
case 5: return Test.BLUE;
}
return null;
}
}
<jdo>
<package name="org.jpox.samples.jdo.enums">
<class name="Palette">
<field name="color" persistence-modifier="persistent" serialized="false">
<column>
<extension vendor-name="jpox" key="enum-persistence-value-getter" value="getValue"/>
<extension vendor-name="jpox" key="enum-enum-value-getter" value="getEnum"/>
</column>
</field>
</class>
</package>
</jdo>
enum-enum-value-getter is the getter name for a static method that returns the Enum instance for the corresponding value.
enum-persistence-value-getter is the getter name for an instance method that returns the value to be persisted |
Show » |
|