public static Template buildTemplate(List<Archetype> archetypes) { Template result = new Template(); Archetype first = archetypes.get(0); AdlUtils.fillArchetypeFields(result, first); for (Archetype archetype : Iterables.skip(archetypes, 1)) { result.getOverlays().add(archetype); } return result; }
public static List<Archetype> demolishTemplate(Template template) { List<Archetype> result = new ArrayList<>(); Archetype first = new Archetype(); AdlUtils.fillArchetypeFields(first, template); result.add(first); result.addAll(template.getOverlays()); return result; }