本文整理汇总了Java中ch.jalu.configme.SettingsHolder类的典型用法代码示例。如果您正苦于以下问题:Java SettingsHolder类的具体用法?Java SettingsHolder怎么用?Java SettingsHolder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SettingsHolder类属于ch.jalu.configme包,在下文中一共展示了SettingsHolder类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSectionCommentMethods
import ch.jalu.configme.SettingsHolder; //导入依赖的package包/类
/**
* Gets all {@link SectionComments} methods from {@link SettingsHolder} implementations.
*/
@SuppressWarnings("unchecked")
private List<Method> getSectionCommentMethods() {
// Find all SettingsHolder classes
List<Class<? extends SettingsHolder>> settingsClasses =
new ClassCollector(TestHelper.SOURCES_FOLDER, TestHelper.PROJECT_ROOT + "settings/properties/")
.collectClasses(SettingsHolder.class);
checkArgument(!settingsClasses.isEmpty(), "Could not find any SettingsHolder classes");
// Find all @SectionComments methods in these classes
return settingsClasses.stream()
.map(Class::getDeclaredMethods)
.flatMap(Arrays::stream)
.filter(method -> method.isAnnotationPresent(SectionComments.class))
.collect(Collectors.toList());
}
示例2: collectData
import ch.jalu.configme.SettingsHolder; //导入依赖的package包/类
/**
* Collects all properties and comment data from the provided classes.
* Properties are sorted by their group, and each group is sorted by order of encounter.
*
* @param classes the classes to scan for their property data
* @return collected configuration data
*/
public static ConfigurationData collectData(Iterable<Class<? extends SettingsHolder>> classes) {
ConfigurationDataBuilder builder = new ConfigurationDataBuilder();
for (Class<? extends SettingsHolder> clazz : classes) {
builder.collectProperties(clazz);
builder.commentsGatherer.collectAllSectionComments(clazz);
}
return new ConfigurationData(builder.propertyListBuilder.create(), builder.commentsGatherer.getComments());
}
示例3: scanForSettingsClasses
import ch.jalu.configme.SettingsHolder; //导入依赖的package包/类
@BeforeClass
public static void scanForSettingsClasses() {
ClassCollector collector = new ClassCollector(TestHelper.SOURCES_FOLDER, SETTINGS_FOLDER);
classes = collector.collectClasses(SettingsHolder.class);
if (classes.isEmpty()) {
throw new IllegalStateException("Did not find any SettingsHolder classes. Is the folder correct?");
}
System.out.println("Found " + classes.size() + " SettingsHolder implementations");
}