[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
|
[news.eclipse.modeling.mdt.uml2.ocl] Re: Problem with validating inherited attribute
|
Hi, Andreas,
I have been lax in getting around to updating that article. I think it's
high time that I did it!
Sorry for the trouble,
Christian
Andreas Werner wrote:
> OK, there is another posting to this topic in
>
>
http://dev.eclipse.org/newslists/news.eclipse.technology.emft/msg01074.html
>
> Andreas Werner wrote:
>> Hi Newsgroup,
>>
>> I'm not sure whether this is the right newsgroup. Sorry, if not!
>>
>> In my EMF model I have a class B which extends class A. In A there is a
>> String attribute 'name'.
>> While still playing with the OCL constraint stuff :), I just wanted to
>> constrain the 'name' of A (and thus of B, too) to a length less than 20
>> characters. So I added this OCL expression to A:
>> self.name.size()<20
>>
>> In my GMF Editor I only have instances of B and doing the validation
>> raises a
>> org.eclipse.emf.common.util.BasicEList$BasicIndexOutOfBoundsException.
>>
>> The problem is in the generated method 'validateNameLength' in AImpl.
>> This line was generated, right after the first if:
>> EOperation eOperation = (EOperation) eClass().getEOperations().get(1);
>> Get(1) raises the exception, because there is only one operation, and
>> that is one from B and not from A!
>>
>> So, i guess the bug is in the template? I copypasted the whole templates
>> folder from the employee example.
>> I thought I could use these templates, without modifying them, right?
>> Or do I have to make my own templates?
>>
>> I'm completely unfamiliar with JET and templates stuff.
>>
>> Thanks, Andreas