[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.tools.emf] Re: Default Value of an inherited EAttribute or EReference

John,

Comments below.

John T.E. Timm wrote:
Ed:

Ed Merks wrote:

"Or have just an operation on A with a name that is overloaded by the attribute in B..."

Could you please expain how this would work?
On A you define an operation getFoo and in B you define a feature "foo" which will implement getFoo.

What about attaching annotations to the class with all of the default or fixed values and then customizing the generated EFactory to do something like this:


public ClassB createClassB() {
   ClassB instance = new ClassBImpl();
   // look at annotations to determine what needs to be initialized here
   instance.setAttr("someValue");
   // ...
}
You'll find that eIsSet returns true for "attr", so this value will be serialized, unlike what a true default would do. If you unset "attr" and made a copy of ClassB, you'd find "attr" would be set in the copy but not in the original.

Thanks,

JT