Вопрос

I want to create a new EObject, but by default the constructor is protected. Is there a way to overcome that and create a new instance of EObject?

Это было полезно?

Решение

EMF uses the factory pattern. Please try EcoreFactory.eInstance.createEObject().

If you want to instantiate other objects that implement EObject, you'll have to use the respective factory for your own EPackage. The code should read MyPackFactory.eInstance.createObject() where MyPackFactory should be replaced by your concrete factory and createObject() has to be replaced by the type that you want to instantiate, e.g. createObjectValue()

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top