File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
src/main/java/org/icij/ftm Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change 16
16
17
17
import static java .lang .String .format ;
18
18
19
+ /**
20
+ * Java encapsulation of Map of Map YAML models. It makes easier to manipulate models and centralize code generation rules.
21
+ * <p>
22
+ * parents instance is the same reference for all Model objects event if it is not static because harder to test and initialize.
23
+ * </p>
24
+ * <p>
25
+ * yaml object is the original yaml Map<String, Object> read from FtM models. We use this object for equal/hash methods.
26
+ * </p>
27
+ * <p>
28
+ * mixins instance is here to "help" the mapping of Java classes with multiple inheritance FtM models.
29
+ * </p>
30
+ */
19
31
public class Model {
20
32
private final static Logger logger = LoggerFactory .getLogger (Model .class );
21
33
final Map <String , Model > parents ;
@@ -38,6 +50,10 @@ public String name() {
38
50
return yaml .keySet ().iterator ().next ();
39
51
}
40
52
53
+ /**
54
+ * Recursive method to find a concrete parent (java class) for the current model.
55
+ * @return the parent string model name with isConcrete = true from the inheritance tree.
56
+ */
41
57
public Optional <String > concreteParent () {
42
58
List <String > extendz = getExtends ();
43
59
List <String > concreteParents = extendz .stream ().filter (p -> parents .get (p ) == null || parents .get (p ).isConcrete ()).collect (Collectors .toList ());
You can’t perform that action at this time.
0 commit comments