Closed LeonLiuY closed 10 years ago
I've tried this great tool but I found an error about EEnum Serialization. EEnum attribute will not be serialized if it has the default value 0.
0
And I found the reason:
In EAttributeSerializer.java there is:
EAttributeSerializer.java
static boolean isCandidate(EObject eObject, EAttribute eAttribute) { return eObject.eIsSet(eAttribute) && !eAttribute.isDerived() && !eAttribute.isTransient() && !eAttribute.isUnsettable(); }
If an EEnum object has the default value 0, eObject.eIsSet will return false. (if the object has a non-default value, it becomes true).
EEnum
eObject.eIsSet
false
true
You can test it by User.sex in the test model.
User.sex
I fixed it with
static boolean isCandidate(EObject eObject, EAttribute eAttribute) { return (eObject.eIsSet(eAttribute) || eAttribute.getEType() instanceof EEnum) && !eAttribute.isDerived() && !eAttribute.isTransient() && !eAttribute.isUnsettable(); }
but it is related with some test cases and I'm not sure whether this fix is the best way. I report this to you and I appreciate your updates on this.
It is fixed now, added in debaab61e74196e324a68678209111dba3692431
I've tried this great tool but I found an error about EEnum Serialization. EEnum attribute will not be serialized if it has the default value
0
.And I found the reason:
In
EAttributeSerializer.java
there is:If an
EEnum
object has the default value 0,eObject.eIsSet
will returnfalse
. (if the object has a non-default value, it becomestrue
).You can test it by
User.sex
in the test model.I fixed it with
but it is related with some test cases and I'm not sure whether this fix is the best way. I report this to you and I appreciate your updates on this.