private static void doStuffWith(Class<?> clazz) {
FeatureInfo featureInfo = clazz.getAnnotation(FeatureInfo.class);
List<String> dependencies = new ArrayList<>();
try {
Class[] dep = (Class[]) clazz.getMethod("getDependencies").invoke(clazz.newInstance());
for (Class c : dep) {
dependencies.add(c.getName());
}
} catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException | InstantiationException e) {
e.printStackTrace();
System.out.println("could not collect dependencies for clazz " + clazz.getSimpleName());
}
List<String> params = new ArrayList<>();
for (Field field : clazz.getDeclaredFields()) {
if (field.isAnnotationPresent(Expose.class)) {
params.add(field.getName() + " (" + field.getType().getName() + ")");
}
}
Feature feature = new Feature(featureInfo.name(), clazz.getName(), featureInfo.author(), featureInfo.version(),
featureInfo.description(), dependencies, params, slugify.slugify(clazz.getName()));
System.out.println(feature);
features.add(feature);
}
GenerateFeatures.java 文件源码
java
阅读 26
收藏 0
点赞 0
评论 0
项目:VoxelGamesLib
作者:
评论列表
文章目录