The AI component catalog no longer offers the deprecated inner layers, and lists the new 'Board Side' property

This commit is contained in:
Bane Stojkovic
2026-11-11 17:05:44 +01:00
parent 19c78e5fa9
commit 5ef6952ef4
7 changed files with 264 additions and 20 deletions
@@ -54,6 +54,7 @@ import org.diylc.presenter.ComparatorFactory;
import org.diylc.presenter.ComponentProcessor;
import org.diylc.presenter.DatasheetService;
import org.diylc.presenter.ReleaseHistory;
import org.diylc.utils.ReflectionUtils;
/**
* Standalone tool that generates component catalog JSON files from the current codebase.
@@ -227,9 +228,11 @@ public class ComponentCatalogGenerator {
}
}
// Include enum possible values (using name() instead of toString())
// Include enum possible values (using name() instead of toString()), leaving out the
// deprecated ones the editor does not offer either
if (propType.isEnum()) {
List<String> possibleValues = Arrays.stream(propType.getEnumConstants())
.filter(e -> !ReflectionUtils.isDeprecated((Enum<?>) e))
.map(e -> ((Enum<?>) e).name())
.collect(Collectors.toList());
prop.put("possibleValues", possibleValues);
@@ -148,4 +148,16 @@ public class ReflectionUtils {
}
return result.get(0);
}
/**
* @return true when the enum constant is marked {@link Deprecated}; such values are kept only so
* that old files load, and are not offered for new choices
*/
public static boolean isDeprecated(Enum<?> value) {
try {
return value.getDeclaringClass().getField(value.name()).isAnnotationPresent(Deprecated.class);
} catch (NoSuchFieldException e) {
return false;
}
}
}