Commit f0556df5 authored by Marco Konersmann's avatar Marco Konersmann

Renames ReferenceTransformations to IALTransformations for clarity

parent 68aa8b62
......@@ -4,14 +4,14 @@ import java.util.List;
import org.eclipse.emf.ecore.ENamedElement;
import de.mkonersmann.advert.java.embed.transformation.references.AbstractReferenceTransformation;
import de.mkonersmann.advert.java.embed.transformation.references.IALTransformation;
public class ReferenceTransformationTuple {
public class IALTransformationTuple {
ENamedElement ilElement;
List<Class<? extends AbstractReferenceTransformation<?, ?>>> transformationClasses;
List<Class<? extends IALTransformation<?, ?>>> transformationClasses;
public ReferenceTransformationTuple(ENamedElement ilElement,
List<Class<? extends AbstractReferenceTransformation<?, ?>>> transformationClasses) {
public IALTransformationTuple(ENamedElement ilElement,
List<Class<? extends IALTransformation<?, ?>>> transformationClasses) {
this.ilElement = ilElement;
this.transformationClasses = transformationClasses;
}
......@@ -20,7 +20,7 @@ public class ReferenceTransformationTuple {
return ilElement;
}
public List<Class<? extends AbstractReferenceTransformation<?, ?>>> getTransformationClasses() {
public List<Class<? extends IALTransformation<?, ?>>> getTransformationClasses() {
return transformationClasses;
}
......
......@@ -29,12 +29,12 @@ import org.modelversioning.emfprofileapplication.EMFProfileApplicationPackage;
import de.mkonersmann.advert.java.embed.transformation.AbstractModelCodeTransformation;
import de.mkonersmann.advert.java.embed.transformation.FindTranslatedElements;
import de.mkonersmann.advert.java.embed.transformation.references.AbstractReferenceTransformation;
import de.mkonersmann.advert.java.embed.transformation.references.ReferenceHolder;
import de.mkonersmann.advert.java.embed.transformation.references.IALTransformation;
import de.mkonersmann.advert.java.embed.transformation.references.IALHolder;
public abstract class JavaBasedImplementationLanguageDefinition extends ImplementationLanguageDefinition {
protected HashMap<EClass, ReferenceTransformationTuple> referenceTransformations = new HashMap<>();
protected HashMap<EClass, IALTransformationTuple> ialTransformations = new HashMap<>();
protected LinkedList<EClass> crossReferenceOrder = new LinkedList<>();
/**
......@@ -107,7 +107,7 @@ public abstract class JavaBasedImplementationLanguageDefinition extends Implemen
final IJavaElement codeElement = resolveCodeElement(idRegistry, cmElement);
if (codeElement == null)
return;
final List<? extends AbstractReferenceTransformation<?, ?>> referencesTransformations = createReferenceTransformationInstance(
final List<? extends IALTransformation<?, ?>> referencesTransformations = createIALTransformationInstance(
cmElement);
Resource applicationResource;
......@@ -121,7 +121,7 @@ public abstract class JavaBasedImplementationLanguageDefinition extends Implemen
if (referencesTransformations != null) {
referencesTransformations.parallelStream().forEach(t -> {
ReferenceHolder holder = t.getReferenceHolder();
IALHolder holder = t.getIALHolder();
holder.setIlElement(ilElement);
holder.setFoundationalCodeElement(codeElement);
holder.setProfileApplicationResource(applicationResource);
......@@ -161,12 +161,12 @@ public abstract class JavaBasedImplementationLanguageDefinition extends Implemen
final IJavaElement codeElement = resolveCodeElement(idRegistry, cmElement);
final EObject ilElement = idRegistry.getIntermediateLanguageModelElement(cmElement, ilRoots);
final List<? extends AbstractReferenceTransformation<?, ?>> referencesTransformation = createReferenceTransformationInstance(
final List<? extends IALTransformation<?, ?>> ialTransformations = createIALTransformationInstance(
cmElement);
if (referencesTransformation != null)
referencesTransformation.parallelStream().forEach(t -> {
if (ialTransformations != null)
ialTransformations.parallelStream().forEach(t -> {
try {
ReferenceHolder holder = t.getReferenceHolder();
IALHolder holder = t.getIALHolder();
t.setIDRegistry(idRegistry);
t.setModelElement(cmElement);
holder.setIlElement(ilElement);
......@@ -233,40 +233,40 @@ public abstract class JavaBasedImplementationLanguageDefinition extends Implemen
}
@SuppressWarnings("unchecked")
public List<? extends AbstractReferenceTransformation<?, ?>> createReferenceTransformationInstance(
public List<? extends IALTransformation<?, ?>> createIALTransformationInstance(
EObject cmElement) {
final List<ReferenceTransformationTuple> tuples = new LinkedList<>();
final List<AbstractReferenceTransformation<?, ?>> result = new LinkedList<>();
final List<IALTransformationTuple> tuples = new LinkedList<>();
final List<IALTransformation<?, ?>> result = new LinkedList<>();
if (cmElement == null)
return result;
for (final Entry<EClass, ReferenceTransformationTuple> entry : getReferenceTransformations().entrySet()) {
for (final Entry<EClass, IALTransformationTuple> entry : getIALTransformations().entrySet()) {
if (entry.getKey() == cmElement.eClass() || entry.getKey().isSuperTypeOf(cmElement.eClass())) {
tuples.add(entry.getValue());
}
}
for (final ReferenceTransformationTuple tuple : tuples) {
for (Class<? extends AbstractReferenceTransformation<?, ?>> transformationClass : tuple
for (final IALTransformationTuple tuple : tuples) {
for (Class<? extends IALTransformation<?, ?>> transformationClass : tuple
.getTransformationClasses()) {
AbstractReferenceTransformation<EObject, IJavaElement> referenceTrans = null;
IALTransformation<EObject, IJavaElement> referenceTrans = null;
try {
for (Constructor<?> constructor : transformationClass.getDeclaredConstructors()) {
if (constructor.getParameterCount() == 0) {
referenceTrans = (AbstractReferenceTransformation<EObject, IJavaElement>) constructor
referenceTrans = (IALTransformation<EObject, IJavaElement>) constructor
.newInstance(new Object[0]);
break;
} else if (constructor.getParameterCount() == 1
&& constructor.getParameterTypes()[0] == AbstractModelCodeTransformation.class) {
referenceTrans = (AbstractReferenceTransformation<EObject, IJavaElement>) constructor
referenceTrans = (IALTransformation<EObject, IJavaElement>) constructor
.newInstance(new Object[] { null });
break;
} else if (constructor.getParameterCount() == 2
&& constructor.getParameterTypes()[0] == AbstractModelCodeTransformation.class
&& ENamedElement.class.isAssignableFrom(constructor.getParameterTypes()[1])) {
referenceTrans = (AbstractReferenceTransformation<EObject, IJavaElement>) constructor
referenceTrans = (IALTransformation<EObject, IJavaElement>) constructor
.newInstance(null, tuple.getIlElement());
break;
}
......@@ -285,8 +285,8 @@ public abstract class JavaBasedImplementationLanguageDefinition extends Implemen
return result;
}
public HashMap<EClass, ReferenceTransformationTuple> getReferenceTransformations() {
return referenceTransformations;
public HashMap<EClass, IALTransformationTuple> getIALTransformations() {
return ialTransformations;
}
public LinkedList<EClass> getCrossReferenceOrder() {
......
......@@ -5,7 +5,7 @@ import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.jdt.core.IJavaElement;
public class ReferenceHolder extends MayHaveIssues {
public class IALHolder extends MayHaveIssues {
private Resource profileApplicationResource;
......
......@@ -6,13 +6,13 @@ import org.modelversioning.emfprofileapplication.StereotypeApplication;
import de.mkonersmann.advert.java.embed.transformation.IModelCodeTransformation;
public interface AbstractReferenceTransformation<ELEMENTECLASS extends EObject, JAVAELEMENTCLASS extends IJavaElement>
public interface IALTransformation<ELEMENTECLASS extends EObject, JAVAELEMENTCLASS extends IJavaElement>
extends IModelCodeTransformation<ELEMENTECLASS, JAVAELEMENTCLASS> {
/**
* Returns an object that holds references to model and code elements specific
* to IAL to code transformations.
*/
public ReferenceHolder getReferenceHolder();
public IALHolder getIALHolder();
/**
* Returns the actual IAL element that is translated. E.g. a stereotype upon a
......
......@@ -23,7 +23,7 @@ import org.osgi.framework.FrameworkUtil;
import de.mkonersmann.advert.java.embed.JavaBasedImplementationLanguageDefinition;
import de.mkonersmann.advert.java.embed.ProfilesUtils;
import de.mkonersmann.advert.java.embed.ReferenceTransformationTuple;
import de.mkonersmann.advert.java.embed.IALTransformationTuple;
import de.mkonersmann.advert.java.embed.transformation.AbstractModelCodeTransformation;
import de.mkonersmann.il.core.CorePackage;
import de.mkonersmann.il.profiles.Profiles;
......@@ -52,8 +52,8 @@ public class JEE7LanguageDefinition extends JavaBasedImplementationLanguageDefin
// For each bean the reference childTypes of the stereotype application
// HierarchicalComponentTypeScoped is translated via the given transformation
// class.
referenceTransformations.put(i.getBean(),
new ReferenceTransformationTuple(
ialTransformations.put(i.getBean(),
new IALTransformationTuple(
ProfilesUtils.getEReference(Profiles.COMPONENTS_HIERARCHY_SCOPED.load(),
"HierarchicalComponentTypeScoped", "childTypes"),
Arrays.asList(ChildTypeTransformation.class)));
......
......@@ -18,15 +18,15 @@ import org.modelversioning.emfprofileapplication.StereotypeApplication;
import de.mkonersmann.advert.java.embed.ProfilesUtils;
import de.mkonersmann.advert.java.embed.transformation.AbstractModelCodeTransformation;
import de.mkonersmann.advert.java.embed.transformation.references.AbstractReferenceTransformation;
import de.mkonersmann.advert.java.embed.transformation.references.ReferenceHolder;
import de.mkonersmann.advert.java.embed.transformation.references.IALTransformation;
import de.mkonersmann.advert.java.embed.transformation.references.IALHolder;
import de.mkonersmann.il.core.ComponentType;
import de.mkonersmann.il.profiles.Profiles;
public class ChildOperationTransformation extends ContainmentOperationTransformation<StereotypeApplication, EObject>
implements AbstractReferenceTransformation<StereotypeApplication, IType> {
implements IALTransformation<StereotypeApplication, IType> {
private ReferenceHolder holder = new ReferenceHolder();
private IALHolder holder = new IALHolder();
private ComponentType componentType;
public ChildOperationTransformation(AbstractModelCodeTransformation<? extends EObject, IType> parentTransformation,
......@@ -98,7 +98,7 @@ public class ChildOperationTransformation extends ContainmentOperationTransforma
}
@Override
public ReferenceHolder getReferenceHolder() {
public IALHolder getIALHolder() {
return holder;
}
......
......@@ -17,8 +17,8 @@ import org.modelversioning.emfprofileapplication.StereotypeApplication;
import de.mkonersmann.advert.java.embed.JDTUtils;
import de.mkonersmann.advert.java.embed.ProfilesUtils;
import de.mkonersmann.advert.java.embed.transformation.AbstractModelCodeTransformation;
import de.mkonersmann.advert.java.embed.transformation.references.AbstractReferenceTransformation;
import de.mkonersmann.advert.java.embed.transformation.references.ReferenceHolder;
import de.mkonersmann.advert.java.embed.transformation.references.IALTransformation;
import de.mkonersmann.advert.java.embed.transformation.references.IALHolder;
import de.mkonersmann.il.core.ComponentType;
import de.mkonersmann.il.core.Interface;
import de.mkonersmann.il.core.Provision;
......@@ -26,9 +26,9 @@ import de.mkonersmann.il.profiles.Profiles;
public class ChildTypeTransformation
extends AnnotatedMemberReferenceTransformation<StereotypeApplication, ComponentType>
implements AbstractReferenceTransformation<StereotypeApplication, IType> {
implements IALTransformation<StereotypeApplication, IType> {
private ReferenceHolder holder = new ReferenceHolder();
private IALHolder holder = new IALHolder();
public ChildTypeTransformation(AbstractModelCodeTransformation<? extends EObject, IType> parentTransformation,
EReference eReference) {
......@@ -82,7 +82,7 @@ public class ChildTypeTransformation
}
@Override
public ReferenceHolder getReferenceHolder() {
public IALHolder getIALHolder() {
return holder;
}
......
......@@ -24,7 +24,7 @@ import org.osgi.framework.FrameworkUtil;
import de.mkonersmann.advert.java.embed.JavaBasedImplementationLanguageDefinition;
import de.mkonersmann.advert.java.embed.ProfilesUtils;
import de.mkonersmann.advert.java.embed.ReferenceTransformationTuple;
import de.mkonersmann.advert.java.embed.IALTransformationTuple;
import de.mkonersmann.advert.java.embed.transformation.AbstractModelCodeTransformation;
import de.mkonersmann.il.profiles.Profiles;
......@@ -46,17 +46,17 @@ public class EjbWithStateMachineLanguage extends JavaBasedImplementationLanguage
m.put(i.getState_Transition(), ContainmentOperationMechanism.class);
m.put(i.getTransition_Target(), NinjaSingletonContainmentReferenceMechanism.class);
// Create the map of model elements to reference transformations
referenceTransformations.put(i.getComponent(),
new ReferenceTransformationTuple(
ProfilesUtils.getEReference(Profiles.COMPONENTS_HIERARCHY_SCOPED.load(),
"HierarchicalComponentTypeScoped", "childTypes"),
Arrays.asList(ChildTransformation.class)));
// Add all EClasses to the cross references. The order is irrelevant
for (final EClassifier c : ejbWithSMPackage.eINSTANCE.getEClassifiers())
if (c instanceof EClass)
crossReferenceOrder.add((EClass) c);
// Create the map of model elements to reference transformations
ialTransformations.put(i.getComponent(),
new IALTransformationTuple(
ProfilesUtils.getEReference(Profiles.COMPONENTS_HIERARCHY_SCOPED.load(),
"HierarchicalComponentTypeScoped", "childTypes"),
Arrays.asList(ChildTransformation.class)));
}
@Override
......
......@@ -24,12 +24,12 @@ import de.mkonersmann.advert.java.embed.JDTUtils;
import de.mkonersmann.advert.java.embed.ModelUtils;
import de.mkonersmann.advert.java.embed.ProfilesUtils;
import de.mkonersmann.advert.java.embed.transformation.AbstractModelCodeTransformation;
import de.mkonersmann.advert.java.embed.transformation.references.AbstractReferenceTransformation;
import de.mkonersmann.advert.java.embed.transformation.references.ReferenceHolder;
import de.mkonersmann.advert.java.embed.transformation.references.IALTransformation;
import de.mkonersmann.advert.java.embed.transformation.references.IALHolder;
import de.mkonersmann.il.profiles.Profiles;
public class ChildTransformation extends AbstractModelCodeTransformation<Component, IType>
implements AbstractReferenceTransformation<Component, IType> {
implements IALTransformation<Component, IType> {
public ChildTransformation(
AbstractModelCodeTransformation<? extends EObject, ? extends IJavaElement> parentTransformation) {
......@@ -39,7 +39,7 @@ public class ChildTransformation extends AbstractModelCodeTransformation<Compone
eReference = scopedComponent.getEStructuralFeature("childTypes");
}
private ReferenceHolder holder = new ReferenceHolder();
private IALHolder holder = new IALHolder();
private List<IAnnotation> annotations = new LinkedList<>();
private EStructuralFeature eReference;
......@@ -138,7 +138,7 @@ public class ChildTransformation extends AbstractModelCodeTransformation<Compone
}
@Override
public ReferenceHolder getReferenceHolder() {
public IALHolder getIALHolder() {
return holder;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment