Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEd Willink2016-05-05 07:36:31 -0400
committerEd Willink2016-05-05 09:32:22 -0400
commit78c58796eddfc13366773734ce702dd48b021bac (patch)
tree529eaeba8f0aa7bfaef3a88f8232197fda670b47
parent43ccebf6198e317a50c729532daa58a1a2e3f080 (diff)
downloadorg.eclipse.qvtd-78c58796eddfc13366773734ce702dd48b021bac.tar.gz
org.eclipse.qvtd-78c58796eddfc13366773734ce702dd48b021bac.tar.xz
org.eclipse.qvtd-78c58796eddfc13366773734ce702dd48b021bac.zip
[486722] Implement CGEcoreContainerAssignment
-rw-r--r--plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiAS2CGVisitor.java17
-rw-r--r--plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiAnalysisVisitor.java6
-rw-r--r--plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiBoxingAnalyzer.java13
-rw-r--r--plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiCG2StringVisitor.java9
-rw-r--r--plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiDependencyVisitor.java6
-rw-r--r--plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiFieldingAnalyzer.java11
-rw-r--r--plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiReferencesVisitor.java6
-rw-r--r--plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/java/QVTiCG2JavaPreVisitor.java6
-rw-r--r--plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/java/QVTiCG2JavaVisitor.java71
9 files changed, 143 insertions, 2 deletions
diff --git a/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiAS2CGVisitor.java b/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiAS2CGVisitor.java
index 0f5b81fb4..3fd04fdfb 100644
--- a/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiAS2CGVisitor.java
+++ b/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiAS2CGVisitor.java
@@ -19,6 +19,7 @@ import java.util.Set;
import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.emf.ecore.util.EcoreUtil.Copier;
@@ -68,6 +69,7 @@ import org.eclipse.qvtd.codegen.qvti.java.QVTiCodeGenerator;
import org.eclipse.qvtd.codegen.qvti.java.QVTiGlobalContext;
import org.eclipse.qvtd.codegen.qvticgmodel.CGConnectionAssignment;
import org.eclipse.qvtd.codegen.qvticgmodel.CGConnectionVariable;
+import org.eclipse.qvtd.codegen.qvticgmodel.CGEcoreContainerAssignment;
import org.eclipse.qvtd.codegen.qvticgmodel.CGEcorePropertyAssignment;
import org.eclipse.qvtd.codegen.qvticgmodel.CGEcoreRealizedVariable;
import org.eclipse.qvtd.codegen.qvticgmodel.CGFunction;
@@ -844,6 +846,21 @@ public class QVTiAS2CGVisitor extends AS2CGVisitor implements QVTimperativeVisit
System.out.println("Missing getAccessor for " + eStructuralFeature + "ignored.");
}
}
+ else {
+ Property asOppositeProperty = asTargetProperty.getOpposite();
+ eStructuralFeature = (EStructuralFeature) (asOppositeProperty != null ? asOppositeProperty.getESObject() : null);
+ if (eStructuralFeature != null) {
+ assert ((EReference)eStructuralFeature).isContainment();
+ try {
+ genModelHelper.getGetAccessor(eStructuralFeature);
+ CGEcoreContainerAssignment cgEcoreContainerAssignment = QVTiCGModelFactory.eINSTANCE.createCGEcoreContainerAssignment();
+ cgEcoreContainerAssignment.setEStructuralFeature(eStructuralFeature);
+ cgPropertyAssignment = cgEcoreContainerAssignment;
+ } catch (GenModelException e) {
+ System.out.println("Missing getAccessor for " + eStructuralFeature + "ignored.");
+ }
+ }
+ }
}
if (cgPropertyAssignment == null) {
cgPropertyAssignment = QVTiCGModelFactory.eINSTANCE.createCGPropertyAssignment();
diff --git a/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiAnalysisVisitor.java b/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiAnalysisVisitor.java
index 189997094..e74f2c01b 100644
--- a/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiAnalysisVisitor.java
+++ b/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiAnalysisVisitor.java
@@ -17,6 +17,7 @@ import org.eclipse.ocl.examples.codegen.generator.LocalContext;
import org.eclipse.ocl.pivot.OperationCallExp;
import org.eclipse.qvtd.codegen.qvticgmodel.CGConnectionAssignment;
import org.eclipse.qvtd.codegen.qvticgmodel.CGConnectionVariable;
+import org.eclipse.qvtd.codegen.qvticgmodel.CGEcoreContainerAssignment;
import org.eclipse.qvtd.codegen.qvticgmodel.CGEcorePropertyAssignment;
import org.eclipse.qvtd.codegen.qvticgmodel.CGEcoreRealizedVariable;
import org.eclipse.qvtd.codegen.qvticgmodel.CGFunction;
@@ -55,6 +56,11 @@ public class QVTiAnalysisVisitor extends AnalysisVisitor implements QVTiCGModelV
}
@Override
+ public Object visitCGEcoreContainerAssignment(@NonNull CGEcoreContainerAssignment object) {
+ return visitCGPropertyAssignment(object);
+ }
+
+ @Override
public Object visitCGEcorePropertyAssignment(@NonNull CGEcorePropertyAssignment object) {
return visitCGPropertyAssignment(object);
}
diff --git a/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiBoxingAnalyzer.java b/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiBoxingAnalyzer.java
index 9c2e3508b..49bf5e9b4 100644
--- a/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiBoxingAnalyzer.java
+++ b/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiBoxingAnalyzer.java
@@ -23,6 +23,7 @@ import org.eclipse.ocl.pivot.TypedElement;
import org.eclipse.ocl.pivot.Variable;
import org.eclipse.qvtd.codegen.qvticgmodel.CGConnectionAssignment;
import org.eclipse.qvtd.codegen.qvticgmodel.CGConnectionVariable;
+import org.eclipse.qvtd.codegen.qvticgmodel.CGEcoreContainerAssignment;
import org.eclipse.qvtd.codegen.qvticgmodel.CGEcorePropertyAssignment;
import org.eclipse.qvtd.codegen.qvticgmodel.CGEcoreRealizedVariable;
import org.eclipse.qvtd.codegen.qvticgmodel.CGFunction;
@@ -70,6 +71,18 @@ public class QVTiBoxingAnalyzer extends BoxingAnalyzer implements QVTiCGModelVis
}
@Override
+ public Object visitCGEcoreContainerAssignment(@NonNull CGEcoreContainerAssignment cgEcoreContainerAssignment) {
+ EStructuralFeature eStructuralFeature = cgEcoreContainerAssignment.getEStructuralFeature();
+ boolean isRequired = eStructuralFeature.isRequired();
+ rewriteAsEcore(cgEcoreContainerAssignment.getSlotValue(), eStructuralFeature.getEType());
+ rewriteAsEcore(cgEcoreContainerAssignment.getInitValue(), eStructuralFeature.getEContainingClass());
+ if (isRequired) {
+ rewriteAsGuarded(cgEcoreContainerAssignment.getSlotValue(), false, "value");
+ }
+ return visitCGPropertyAssignment(cgEcoreContainerAssignment);
+ }
+
+ @Override
public Object visitCGEcorePropertyAssignment(@NonNull CGEcorePropertyAssignment cgEcorePropertyAssignment) {
EStructuralFeature eStructuralFeature = cgEcorePropertyAssignment.getEStructuralFeature();
boolean isRequired = eStructuralFeature.isRequired();
diff --git a/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiCG2StringVisitor.java b/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiCG2StringVisitor.java
index 2d51b2a1d..c5c249847 100644
--- a/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiCG2StringVisitor.java
+++ b/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiCG2StringVisitor.java
@@ -19,6 +19,7 @@ import org.eclipse.ocl.examples.codegen.cgmodel.CGValuedElement;
import org.eclipse.ocl.examples.codegen.cgmodel.CGVariableExp;
import org.eclipse.qvtd.codegen.qvticgmodel.CGConnectionAssignment;
import org.eclipse.qvtd.codegen.qvticgmodel.CGConnectionVariable;
+import org.eclipse.qvtd.codegen.qvticgmodel.CGEcoreContainerAssignment;
import org.eclipse.qvtd.codegen.qvticgmodel.CGEcorePropertyAssignment;
import org.eclipse.qvtd.codegen.qvticgmodel.CGEcoreRealizedVariable;
import org.eclipse.qvtd.codegen.qvticgmodel.CGFunction;
@@ -100,8 +101,12 @@ public class QVTiCG2StringVisitor extends CG2StringVisitor implements QVTiCGMode
}
@Override
- @Nullable
- public String visitCGEcorePropertyAssignment(@NonNull CGEcorePropertyAssignment object) {
+ public @Nullable String visitCGEcoreContainerAssignment(@NonNull CGEcoreContainerAssignment object) {
+ return visitCGPropertyAssignment(object);
+ }
+
+ @Override
+ public @Nullable String visitCGEcorePropertyAssignment(@NonNull CGEcorePropertyAssignment object) {
return visitCGPropertyAssignment(object);
}
diff --git a/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiDependencyVisitor.java b/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiDependencyVisitor.java
index cf45311ab..cef43b9ba 100644
--- a/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiDependencyVisitor.java
+++ b/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiDependencyVisitor.java
@@ -16,6 +16,7 @@ import org.eclipse.ocl.examples.codegen.java.JavaDependencyVisitor;
import org.eclipse.qvtd.codegen.qvti.java.QVTiGlobalContext;
import org.eclipse.qvtd.codegen.qvticgmodel.CGConnectionAssignment;
import org.eclipse.qvtd.codegen.qvticgmodel.CGConnectionVariable;
+import org.eclipse.qvtd.codegen.qvticgmodel.CGEcoreContainerAssignment;
import org.eclipse.qvtd.codegen.qvticgmodel.CGEcorePropertyAssignment;
import org.eclipse.qvtd.codegen.qvticgmodel.CGEcoreRealizedVariable;
import org.eclipse.qvtd.codegen.qvticgmodel.CGFunction;
@@ -53,6 +54,11 @@ public class QVTiDependencyVisitor extends JavaDependencyVisitor implements QVTi
}
@Override
+ public Object visitCGEcoreContainerAssignment(@NonNull CGEcoreContainerAssignment object) {
+ return visitCGPropertyAssignment(object);
+ }
+
+ @Override
public Object visitCGEcorePropertyAssignment(@NonNull CGEcorePropertyAssignment object) {
return visitCGPropertyAssignment(object);
}
diff --git a/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiFieldingAnalyzer.java b/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiFieldingAnalyzer.java
index 39610e9e8..1bd4be850 100644
--- a/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiFieldingAnalyzer.java
+++ b/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiFieldingAnalyzer.java
@@ -19,6 +19,7 @@ import org.eclipse.ocl.examples.codegen.cgmodel.CGIterator;
import org.eclipse.ocl.examples.codegen.cgmodel.CGVariable;
import org.eclipse.qvtd.codegen.qvticgmodel.CGConnectionAssignment;
import org.eclipse.qvtd.codegen.qvticgmodel.CGConnectionVariable;
+import org.eclipse.qvtd.codegen.qvticgmodel.CGEcoreContainerAssignment;
import org.eclipse.qvtd.codegen.qvticgmodel.CGEcorePropertyAssignment;
import org.eclipse.qvtd.codegen.qvticgmodel.CGEcoreRealizedVariable;
import org.eclipse.qvtd.codegen.qvticgmodel.CGFunction;
@@ -58,6 +59,11 @@ public class QVTiFieldingAnalyzer extends FieldingAnalyzer
}
@Override
+ public @Nullable Set<CGVariable> visitCGEcoreContainerAssignment(@NonNull CGEcoreContainerAssignment object) {
+ return visitCGPropertyAssignment(object);
+ }
+
+ @Override
public @Nullable Set<CGVariable> visitCGEcorePropertyAssignment(@NonNull CGEcorePropertyAssignment object) {
return visitCGPropertyAssignment(object);
}
@@ -165,6 +171,11 @@ public class QVTiFieldingAnalyzer extends FieldingAnalyzer
}
@Override
+ public Boolean visitCGEcoreContainerAssignment(@NonNull CGEcoreContainerAssignment object) {
+ return visitCGPropertyAssignment(object);
+ }
+
+ @Override
public Boolean visitCGEcorePropertyAssignment(@NonNull CGEcorePropertyAssignment object) {
return visitCGPropertyAssignment(object);
}
diff --git a/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiReferencesVisitor.java b/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiReferencesVisitor.java
index 8f242da5f..808ef2ca0 100644
--- a/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiReferencesVisitor.java
+++ b/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiReferencesVisitor.java
@@ -17,6 +17,7 @@ import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.ocl.examples.codegen.analyzer.ReferencesVisitor;
import org.eclipse.qvtd.codegen.qvticgmodel.CGConnectionAssignment;
import org.eclipse.qvtd.codegen.qvticgmodel.CGConnectionVariable;
+import org.eclipse.qvtd.codegen.qvticgmodel.CGEcoreContainerAssignment;
import org.eclipse.qvtd.codegen.qvticgmodel.CGMappingExp;
import org.eclipse.qvtd.codegen.qvticgmodel.CGMappingLoop;
import org.eclipse.qvtd.codegen.qvticgmodel.CGSequence;
@@ -47,6 +48,11 @@ public class QVTiReferencesVisitor extends ReferencesVisitor implements QVTiCGMo
}
@Override
+ public @NonNull List<@Nullable Object> visitCGEcoreContainerAssignment(@NonNull CGEcoreContainerAssignment object) {
+ return visitCGPropertyAssignment(object);
+ }
+
+ @Override
public @NonNull List<@Nullable Object> visitCGEcorePropertyAssignment(org.eclipse.qvtd.codegen.qvticgmodel.@NonNull CGEcorePropertyAssignment object) {
return visitCGPropertyAssignment(object);
}
diff --git a/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/java/QVTiCG2JavaPreVisitor.java b/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/java/QVTiCG2JavaPreVisitor.java
index 066a2227c..8ea48b8c1 100644
--- a/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/java/QVTiCG2JavaPreVisitor.java
+++ b/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/java/QVTiCG2JavaPreVisitor.java
@@ -15,6 +15,7 @@ import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.ocl.examples.codegen.java.CG2JavaPreVisitor;
import org.eclipse.qvtd.codegen.qvticgmodel.CGConnectionAssignment;
import org.eclipse.qvtd.codegen.qvticgmodel.CGConnectionVariable;
+import org.eclipse.qvtd.codegen.qvticgmodel.CGEcoreContainerAssignment;
import org.eclipse.qvtd.codegen.qvticgmodel.CGEcorePropertyAssignment;
import org.eclipse.qvtd.codegen.qvticgmodel.CGEcoreRealizedVariable;
import org.eclipse.qvtd.codegen.qvticgmodel.CGFunction;
@@ -52,6 +53,11 @@ public class QVTiCG2JavaPreVisitor extends CG2JavaPreVisitor implements QVTiCGMo
}
@Override
+ public Object visitCGEcoreContainerAssignment(@NonNull CGEcoreContainerAssignment object) {
+ return visitCGPropertyAssignment(object);
+ }
+
+ @Override
public Object visitCGEcorePropertyAssignment(@NonNull CGEcorePropertyAssignment object) {
return visitCGPropertyAssignment(object);
}
diff --git a/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/java/QVTiCG2JavaVisitor.java b/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/java/QVTiCG2JavaVisitor.java
index 6e7cf672b..605a25ae0 100644
--- a/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/java/QVTiCG2JavaVisitor.java
+++ b/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/java/QVTiCG2JavaVisitor.java
@@ -61,6 +61,7 @@ import org.eclipse.ocl.pivot.utilities.ValueUtil;
import org.eclipse.qvtd.codegen.qvti.analyzer.QVTiAnalyzer;
import org.eclipse.qvtd.codegen.qvticgmodel.CGConnectionAssignment;
import org.eclipse.qvtd.codegen.qvticgmodel.CGConnectionVariable;
+import org.eclipse.qvtd.codegen.qvticgmodel.CGEcoreContainerAssignment;
import org.eclipse.qvtd.codegen.qvticgmodel.CGEcorePropertyAssignment;
import org.eclipse.qvtd.codegen.qvticgmodel.CGEcoreRealizedVariable;
import org.eclipse.qvtd.codegen.qvticgmodel.CGFunction;
@@ -296,6 +297,33 @@ public class QVTiCG2JavaVisitor extends CG2JavaVisitor<@NonNull QVTiCodeGenerato
return null;
}
+ protected void doAssigned(@NonNull CGEcoreContainerAssignment cgPropertyAssignment) {
+ EStructuralFeature eStructuralFeature = ClassUtil.nonNullModel(cgPropertyAssignment.getEStructuralFeature());
+ CGValuedElement cgSlot = getExpression(cgPropertyAssignment.getSlotValue());
+ CGValuedElement cgInit = getExpression(cgPropertyAssignment.getInitValue());
+ EPackage ePackage = ClassUtil.nonNullModel(eStructuralFeature.getEContainingClass().getEPackage());
+ boolean isHazardous = false;
+ Element asPropertyAssignment = cgPropertyAssignment.getAst();
+ Mapping asMapping = QVTimperativeUtil.getContainingMapping(asPropertyAssignment);
+ if ((asMapping != null) && (asPropertyAssignment instanceof PropertyAssignment)) {
+ isHazardous = transformationAnalysis.isHazardousWrite(asMapping, (PropertyAssignment)asPropertyAssignment);
+ }
+ if (isHazardous || isIncremental) {
+ js.append("objectManager.assigned(");
+ if (isIncremental) {
+ js.append("this, ");
+ }
+ js.appendValueName(cgInit);
+ js.append(", ");
+ js.appendClassReference(genModelHelper.getQualifiedPackageInterfaceName(ePackage));
+ js.append(".Literals.");
+ js.append(genModelHelper.getEcoreLiteralName(eStructuralFeature));
+ js.append(", ");
+ js.appendValueName(cgSlot);
+ js.append(", null);\n");
+ }
+ }
+
protected void doAssigned(@NonNull CGEcorePropertyAssignment cgPropertyAssignment) {
EStructuralFeature eStructuralFeature = ClassUtil.nonNullModel(cgPropertyAssignment.getEStructuralFeature());
CGValuedElement cgSlot = getExpression(cgPropertyAssignment.getSlotValue());
@@ -701,6 +729,49 @@ public class QVTiCG2JavaVisitor extends CG2JavaVisitor<@NonNull QVTiCodeGenerato
}
@Override
+ public @NonNull Boolean visitCGEcoreContainerAssignment(@NonNull CGEcoreContainerAssignment cgPropertyAssignment) {
+// Property referredProperty = cgPropertyAssignment.getReferredProperty();
+// Property pivotProperty = cgPropertyCallExp.getReferredProperty();
+// CGTypeId cgTypeId = analyzer.getTypeId(pivotProperty.getOwningType().getTypeId());
+// JavaTypeDescriptor requiredTypeDescriptor = context.getJavaTypeDescriptor(cgTypeId, false);
+ EStructuralFeature eStructuralFeature = ClassUtil.nonNullModel(cgPropertyAssignment.getEStructuralFeature());
+ CGValuedElement cgSlot = getExpression(cgPropertyAssignment.getSlotValue());
+ CGValuedElement cgInit = getExpression(cgPropertyAssignment.getInitValue());
+// Class<?> requiredJavaClass = requiredTypeDescriptor.getJavaClass();
+// Method leastDerivedMethod = requiredJavaClass != null ? getLeastDerivedMethod(requiredJavaClass, getAccessor) : null;
+// Class<?> unboxedSourceClass = leastDerivedMethod != null ? leastDerivedMethod.getDeclaringClass() : requiredJavaClass;
+ //
+ if (!js.appendLocalStatements(cgSlot)) {
+ return false;
+ }
+ if (!js.appendLocalStatements(cgInit)) {
+ return false;
+ }
+ if (eStructuralFeature.isMany()) {
+ String getAccessor = genModelHelper.getGetAccessor(eStructuralFeature);
+ //
+ js.appendValueName(cgInit);
+ js.append(".");
+ js.append(getAccessor);
+ js.append("().add(");
+ js.appendValueName(cgSlot);
+ js.append(");\n");
+ }
+ else {
+ String setAccessor = genModelHelper.getSetAccessor(eStructuralFeature);
+ //
+ js.appendValueName(cgInit);
+ js.append(".");
+ js.append(setAccessor);
+ js.append("(");
+ js.appendValueName(cgSlot);
+ js.append(");\n");
+ }
+ doAssigned(cgPropertyAssignment);
+ return true;
+ }
+
+ @Override
public @NonNull Boolean visitCGEcorePropertyAssignment(@NonNull CGEcorePropertyAssignment cgPropertyAssignment) {
// Property referredProperty = cgPropertyAssignment.getReferredProperty();
// Property pivotProperty = cgPropertyCallExp.getReferredProperty();

Back to the top