Skip to content

Commit 35324ea

Browse files
committed
doc: add java doc for Model class
1 parent 8bfd97f commit 35324ea

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/main/java/org/icij/ftm/Model.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,18 @@
1616

1717
import static java.lang.String.format;
1818

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+
*/
1931
public class Model {
2032
private final static Logger logger = LoggerFactory.getLogger(Model.class);
2133
final Map<String, Model> parents;
@@ -38,6 +50,10 @@ public String name() {
3850
return yaml.keySet().iterator().next();
3951
}
4052

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+
*/
4157
public Optional<String> concreteParent() {
4258
List<String> extendz = getExtends();
4359
List<String> concreteParents = extendz.stream().filter(p -> parents.get(p) == null || parents.get(p).isConcrete()).collect(Collectors.toList());

0 commit comments

Comments
 (0)