javaeclipseemfeclipse-emf

Is it possible to model operation parameters as vararg in Eclipse/EMF?


I'm trying to find a way to model an operation with a vararg input parameter.

The model should generate an interface as shown below.

/**
 * ...
 * @generated
 */
public interface Content extends EObject {
    /**
     * ...
     * @generated
     */
    List<Definition> getDefinitionsByLabels(String... label);      


}

Please don't answer with workarounds because I'm trying to update a model of an existing (large) code base (that was "manually" developed further post generation).

So far investigating this didn't look promising, but I didn't want to give up on this aspect without asking a question here.

Example Class Diagram


Solution

  • Since varargs is not supported directly by the code generator of EMF, someone asked to make the upper limit a marker for varargs. The bug report is pending, i.e. the requested feature is not available: https://bugs.eclipse.org/bugs/show_bug.cgi?id=337052