本文整理汇总了Java中org.aeonbits.owner.Config.Key方法的典型用法代码示例。如果您正苦于以下问题:Java Config.Key方法的具体用法?Java Config.Key怎么用?Java Config.Key使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.aeonbits.owner.Config
的用法示例。
在下文中一共展示了Config.Key方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDefaultValuesFromConfig
import org.aeonbits.owner.Config; //导入方法依赖的package包/类
private Map<String, String> getDefaultValuesFromConfig(final Class<GATKConfig> gatkConfigClass) {
final Map<String, String> defaultValueMap = new HashMap<>();
// Now we cycle through our interface methods, resolve parameter names,
// and log their values at the given level:
for (final Method propertyMethod : gatkConfigClass.getDeclaredMethods()) {
final String defaultValue;
final Config.DefaultValue defVal = propertyMethod.getAnnotation( Config.DefaultValue.class );
if (defVal != null) {
defaultValue = defVal.value();
// Get the property name:
String propertyName = propertyMethod.getName();
// Get the real property name if we've overwritten it with a key:
final Config.Key key = propertyMethod.getAnnotation(Config.Key.class);
if ( key != null ) {
propertyName = key.value();
}
defaultValueMap.put(propertyName, defaultValue);
}
}
return defaultValueMap;
}
示例2: getFieldDelimiterFromGATKConfig
import org.aeonbits.owner.Config; //导入方法依赖的package包/类
private String getFieldDelimiterFromGATKConfig(final String parameterName) {
String delimiter = ",";
for (final Method propertyMethod : GATKConfig.class.getDeclaredMethods()) {
// Get the property name:
String propertyName = propertyMethod.getName();
// Get the real property name if we've overwritten it with a key:
final Config.Key key = propertyMethod.getAnnotation(Config.Key.class);
if ( key != null ) {
propertyName = key.value();
}
// Check to see if this is the property we're interested in:
if ( parameterName.equals(propertyName) ) {
// Get the delimiter:
final Config.Separator separator = propertyMethod.getAnnotation(Config.Separator.class);
if ( separator != null ) {
delimiter = separator.value();
}
}
}
return delimiter;
}