/FluidTL

Fluid API for Model Transformation

Primary LanguageGroovyEclipse Public License 2.0EPL-2.0

FluidTL

A Fluid API for model transformation.

AtomicReference<Member> inref = new AtomicReference<Member>();
AtomicReference<Male> outref = new AtomicReference<Male>();
Member member = FamiliesFactory.eINSTANCE.createMember();
inref.set(member);

moduleBuilder.module("Families2Persons")
.create("OUT",Person.class.getPackage())
.from("IN",Family.class.getPackage())
.rule("Member2Male")
	.from(member,(EObject s)->{
		Member mem = (Member) s;
		inref.getAndSet(mem);
		return !mem.isFemale();
	})
	.to((EObject t)->{
		Member s = inref.get();
		Male male = (Male) t;
		male.setFullName(s.getFirstName() + ' ' + s.getFamilyName());
		outref.getAndSet(male);
	});
Module module = ModuleBuilder
.create(SmmPackage.eINSTANCE)
.from(JavaPackage.eINSTANCE)

Rule class2mesure = module
        .createRule("class2mesure")
        .from(JavaPackage.CLASS_DECLARATION)
        .to(SmmPackage.MEASURE)
        .bind(SmmPackage.MEASURE__NAME, "name")
---