0

I am facing a problem here. I want to call a method that takes as argument the following:

public void eSet(int featureID, Object newValue) {
    switch (featureID) {
        case LibraryPackage.RESOURCE_CONSUMER_A__REQUIRED_RESOURCES:
            getRequiredResources().clear();
            getRequiredResources().addAll((Collection<? extends Resource>)newValue);
            return;
        case LibraryPackage.RESOURCE_CONSUMER_A__CONSUMED_GROUPS:
            getConsumedGroups().clear();
            getConsumedGroups().addAll((Collection<? extends ResourceGroup>)newValue);
            return;
    }
    super.eSet(featureID, newValue);
}

where I need to call the method as the following:

                                            FatherObject.eSet(FatherObject.eClass().getEAllReferences().get(v), ContainedObject);

I am not having a problem with the first argument. However the problem shows the following on the console:

java.lang.ClassCastException: de.oaam.model.oaam.capabilities.impl.ResourceConsumptionImpl cannot be cast to java.base/java.util.Collection

I will be glad if some one could help

George
  • 23
  • 4

0 Answers0