Casting Object to EnumerationLiteral

General discussions about MagicDraw

Moderator: Moderators

Casting Object to EnumerationLiteral

Postby » Mon Jul 22, 2019 4:25 am

Hello everyone,

the method of the class PropertyChangeEvent getOldValue() is returning an object. The problem that I have is to cast this object into any other, in this case into EnumerationLiteral, class.
Here is a part of my code:
public void adjustValueOfFailureToFailureRate(PropertyChangeEvent evt) {
if(evt.getSource() instanceof Property) {
Property property = (Property) evt.getSource();

EnumerationLiteral old = (EnumerationLiteral) evt.getOldValue();
String oldLambda = CftRetrieval.getLambda((Property)old);

I have also tried to cast in other classes like StringLiteral or just Property, but I always get the same error that the object can not be casted.
Can someone help?
Forum Newbie
Forum Newbie
Posts: 2
Posts Rating:0
Joined: Mon Jul 22, 2019 12:42 am

Return to MagicDraw

Who is online

Users browsing this forum: No registered users and 6 guests