use of org.spongepowered.api.util.annotation.CatalogedBy in project SpongeCommon by SpongePowered.
the class RegistryTestUtil method generateCatalogContainerTestObjects.
static Iterable<Object[]> generateCatalogContainerTestObjects() {
final SpongeGameRegistry registry = (SpongeGameRegistry) Sponge.getGame().getRegistry();
final ArrayList<Object[]> objects = new ArrayList<>();
for (Map.Entry<Class<? extends CatalogType>, CatalogRegistryModule<?>> entry : registry.catalogRegistryMap.entrySet()) {
final Class<? extends CatalogType> key = entry.getKey();
final CatalogedBy catalogedBy = key.getAnnotation(CatalogedBy.class);
if (catalogedBy != null) {
for (Class<?> containerClass : catalogedBy.value()) {
for (Field field : containerClass.getFields()) {
if (Modifier.isStatic(field.getModifiers())) {
objects.add(new Object[] { field.getName(), entry.getKey(), containerClass, entry.getValue(), field });
}
}
}
}
}
return objects;
}
Aggregations