Skip to content

Latest commit

 

History

History
52 lines (43 loc) · 1.86 KB

README.md

File metadata and controls

52 lines (43 loc) · 1.86 KB

Moose version Moose version Build Info Coverage Status

Famix-Value

Famix-Value is a metamodel for representing runtime values and their corresponding types and entities in a Famix model.
The goal is to simplify working with values from languages other than Smalltalk by reifying them and linking them to the Famix model of the application that produced them.
This project allows the values to be exported into code so that they can be recreated in their original programming language.

Note that this is a work in progress: there are plans to improve the readability of the code, for example by giving variables better names.

Installation

Metacello new
  githubUser: 'moosetechnology' project: 'Famix-Value' commitish: 'main' path: 'src';
  baseline: 'FamixValue';
  load

Example

Given the following Java class:

public class MyClass {
  int foo;
  List<String> bar;

  void setFoo(int foo) { this.foo = foo; }
  void setBar(List<String> bar) { this.bar = bar; }
}

And the JSON serialization of an instance, produced by the Jackson library:

{
  "@type": "MyClass",
  "foo": 42,
  "bar": ["java.util.ArrayList", ["Hello", "World"]]
}

Exporting this value produces the following code:

MyClass myClass0 = new MyClass();
myClass.setFoo(42);
List<String> bar1 = new ArrayList<>();
bar1.add("Hello");
bar1.add("World");
myClass0.setBar(bar1);