blob: 7df7b31f68ac5fe79a4bc4c56fb0e2f3d6d9fd09 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
package org.eclipse.emf.edapt.declaration.creation;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.edapt.declaration.EdaptOperation;
import org.eclipse.emf.edapt.declaration.EdaptParameter;
import org.eclipse.emf.edapt.declaration.OperationImplementation;
import org.eclipse.emf.edapt.internal.common.MetamodelFactory;
import org.eclipse.emf.edapt.spi.migration.Metamodel;
import org.eclipse.emf.edapt.spi.migration.Model;
/**
* {@description}
*
* @author herrmama
* @author $Author$
* @version $Rev$
* @levd.rating YELLOW Hash: 9CD50DCE313F4E9FC232ACDD74C6918B
*/
@EdaptOperation(identifier = "newReference", label = "Create Reference", description = "In the metamodel, a new reference is created. Nothing is changed in the model.")
public class NewReference extends OperationImplementation {
/** {@description} */
@EdaptParameter(main = true, description = "The class in which the reference is created")
public EClass eClass;
/** {@description} */
@EdaptParameter(description = "The name of the new reference")
public String name;
/** {@description} */
@EdaptParameter(description = "The type of the new reference")
public EClass type;
/** {@description} */
@EdaptParameter(description = "The lower bound of the new reference")
public int lowerBound = 0;
/** {@description} */
@EdaptParameter(description = "The upper bound of the new reference")
public int upperBound = 1;
/** {@description} */
@EdaptParameter(description = "Whether the new reference is a containment reference")
public Boolean containment = false;
/** {@description} */
@EdaptParameter(description = "The opposite reference of the new reference", optional = true)
public EReference opposite;
/** {@inheritDoc} */
@Override
public void execute(Metamodel metamodel, Model model) {
final EReference reference = MetamodelFactory.newEReference(eClass, name, type,
lowerBound, upperBound, containment);
if (opposite != null) {
metamodel.setEOpposite(opposite, reference);
}
}
}
|