YamlMetaType (@Nullable String complexTypeDisplayNameHint, YamlMetaType... types) { if (types.length == 0) { throw new IllegalArgumentException(); } if (types.length == 1) { return types[0]; } String name = "AnyOf[" + Stream.of(types).map(YamlMetaType::getDisplayName).collect(Collectors.joining()) + "]"; return new YamlAnyOfType(name, complexTypeDisplayNameHint != null ? complexTypeDisplayNameHint : name, flattenTypes(types)); }