Skip to content
This repository was archived by the owner on Jun 26, 2021. It is now read-only.
This repository was archived by the owner on Jun 26, 2021. It is now read-only.

Possibility to always add the type to EObjects. #110

@AlbinTheander

Description

@AlbinTheander

Currently I have a use-case where I need to deserialize an array of different types of EObjects into a standard java list. To be able to deal with the generics part of it, I need the type to be serialized in all the objects. (So the deserializer can create the correct EObject subtype.)

Currently there is a function in EObjectTypeProperty.java:

private boolean shouldSaveType(EClass objectType, EClass featureType, EStructuralFeature feature) {
	return objectType != featureType && objectType != EcorePackage.Literals.EOBJECT;
}

I don't know if there is a reason for not including it when the object type is the same as the feature type. I can see how it shouldn't be needed for most cases, but I can't see that it would be a problem to always include it.

I would like to either remove that condition, or add a feature flag to always include the type.

I am fully prepared to try to put together a pull request, but I would like some input on which way to go; removing it or adding a feature flat. (Or possibly tell me that it's already possible and I misunderstood things.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions