net.sf.nakeduml.javageneration.basicjava.simpleactions.StructuralFeatureClearer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of metamodel Show documentation
Show all versions of metamodel Show documentation
A uml code generator and execution engine
The newest version!
package net.sf.nakeduml.javageneration.basicjava.simpleactions;
import net.sf.nakeduml.javageneration.NakedStructuralFeatureMap;
import net.sf.nakeduml.javageneration.bpm.actions.ActionMap;
import net.sf.nakeduml.javametamodel.OJBlock;
import net.sf.nakeduml.javametamodel.annotation.OJAnnotatedOperation;
import net.sf.nakeduml.metamodel.actions.INakedClearStructuralFeatureAction;
import nl.klasse.octopus.oclengine.IOclEngine;
public class StructuralFeatureClearer extends SimpleActionBuilder{
public StructuralFeatureClearer(IOclEngine oclEngine,INakedClearStructuralFeatureAction action){
super(oclEngine, action);
}
@Override
public void implementActionOn(OJAnnotatedOperation operation,OJBlock block){
ActionMap actionMap = new ActionMap(node);
OJBlock forEach = buildLoopThroughTarget(operation, block, actionMap);
NakedStructuralFeatureMap map = new NakedStructuralFeatureMap(node.getFeature());
if(map.isOne()){
forEach.addToStatements(actionMap.targetName() + "." + map.setter() + "(null)");
}else{
forEach.addToStatements(actionMap.targetName() + "." + map.clearer() + "()");
}
}
}