本文整理了Java中org.apache.logging.log4j.core.config.Configuration.getPluginPackages()
方法的一些代码示例,展示了Configuration.getPluginPackages()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Configuration.getPluginPackages()
方法的具体详情如下:
包路径:org.apache.logging.log4j.core.config.Configuration
类名称:Configuration
方法名:getPluginPackages
[英]Returns the list of packages to scan for plugins for this Configuration.
[中]返回要扫描此配置插件的包列表。
代码示例来源:origin: ops4j/org.ops4j.pax.logging
this.config = config;
final PluginManager manager = new PluginManager(converterKey);
manager.collectPlugins(config == null ? null : config.getPluginPackages());
final Map<String, PluginType<?>> plugins = manager.getPlugins();
final Map<String, Class<PatternConverter>> converters = new LinkedHashMap<>();
代码示例来源:origin: org.apache.logging.log4j/log4j-catalog-api
private ConstraintPlugins() {
final PluginManager manager = new PluginManager(ConstraintType.CATEGORY);
if (LOGGER instanceof org.apache.logging.log4j.core.Logger) {
List<String> pluginPackages =
((org.apache.logging.log4j.core.Logger) LOGGER).getContext().getConfiguration().getPluginPackages();
manager.collectPlugins(pluginPackages);
} else {
manager.collectPlugins();
}
final Map<String, PluginType<?>> plugins = manager.getPlugins();
for (Map.Entry<String, PluginType<?>> entry : plugins.entrySet()) {
try {
final Class<? extends ConstraintType> clazz = entry.getValue().getPluginClass().asSubclass(ConstraintType.class);
ConstraintType constraintType = ReflectionUtil.instantiate(clazz);
constraintMap.put(entry.getKey(), constraintType);
} catch (final Throwable t) {
throw new ConstraintCreationException("Unable to create constraint for " + entry.getKey(), t);
}
}
}
代码示例来源:origin: ops4j/org.ops4j.pax.logging
/**
* Creates the Properties component.
* @param properties An array of Property elements.
* @param config The Configuration.
* @return An Interpolator that includes the configuration properties.
*/
@PluginFactory
public static StrLookup configureSubstitutor(@PluginElement("Properties") final Property[] properties,
@PluginConfiguration final Configuration config) {
if (properties == null) {
return new Interpolator(config.getProperties());
}
final Map<String, String> map = new HashMap<>(config.getProperties());
for (final Property prop : properties) {
map.put(prop.getName(), prop.getValue());
}
return new Interpolator(new MapLookup(map), config.getPluginPackages());
}
}
内容来源于网络,如有侵权,请联系作者删除!