org.apache.logging.log4j.core.config.plugins.Plugin.category()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(4.0k)|赞(0)|评价(0)|浏览(101)

本文整理了Java中org.apache.logging.log4j.core.config.plugins.Plugin.category()方法的一些代码示例,展示了Plugin.category()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Plugin.category()方法的具体详情如下:
包路径:org.apache.logging.log4j.core.config.plugins.Plugin
类名称:Plugin
方法名:category

Plugin.category介绍

暂无

代码示例

代码示例来源:origin: org.apache.logging.log4j/log4j-core

@Test
public void testFakePluginAliasesContainSameInformation() throws Exception {
  final PluginAliases aliases = FakePlugin.class.getAnnotation(PluginAliases.class);
  for (final String alias : aliases.value()) {
    final PluginEntry fake = pluginCache.getCategory(p.category()).get(alias.toLowerCase());
    verifyFakePluginEntry(alias, fake);
  }
}

代码示例来源:origin: org.apache.logging.log4j/log4j-core

@Test
public void testTestCategoryFound() throws Exception {
  assertNotNull("No plugin annotation on FakePlugin.", p);
  final Map<String, PluginEntry> testCategory = pluginCache.getCategory(p.category());
  assertNotEquals("No plugins were found.", 0, pluginCache.size());
  assertNotNull("The category '" + p.category() + "' was not found.", testCategory);
  assertFalse(testCategory.isEmpty());
}

代码示例来源:origin: org.apache.logging.log4j/log4j-core

@Test
public void testFakePluginFoundWithCorrectInformation() throws Exception {
  final PluginEntry fake = pluginCache.getCategory(p.category()).get(p.name().toLowerCase());
  verifyFakePluginEntry(p.name(), fake);
}

代码示例来源:origin: org.apache.logging.log4j/log4j-core

@Test
  public void testNestedPlugin() throws Exception {
    final Plugin p = FakePlugin.Nested.class.getAnnotation(Plugin.class);
    final PluginEntry nested = pluginCache.getCategory(p.category()).get(p.name().toLowerCase());
    assertNotNull(nested);
    assertEquals(p.name().toLowerCase(), nested.getKey());
    assertEquals(FakePlugin.Nested.class.getName(), nested.getClassName());
    assertEquals(p.name(), nested.getName());
    assertEquals(Plugin.EMPTY, p.elementType());
    assertEquals(p.printObject(), nested.isPrintable());
    assertEquals(p.deferChildren(), nested.isDefer());
  }
}

代码示例来源:origin: ops4j/org.ops4j.pax.logging

@Override
  public Collection<PluginEntry> visitType(final TypeElement e, final Plugin plugin) {
    final PluginAliases aliases = e.getAnnotation(PluginAliases.class);
    if (aliases == null) {
      return DEFAULT_VALUE;
    }
    final Collection<PluginEntry> entries = new ArrayList<>(aliases.value().length);
    for (final String alias : aliases.value()) {
      final PluginEntry entry = new PluginEntry();
      entry.setKey(alias.toLowerCase(Locale.US));
      entry.setClassName(elements.getBinaryName(e).toString());
      entry.setName(Plugin.EMPTY.equals(plugin.elementType()) ? alias : plugin.elementType());
      entry.setPrintable(plugin.printObject());
      entry.setDefer(plugin.deferChildren());
      entry.setCategory(plugin.category());
      entries.add(entry);
    }
    return entries;
  }
}

代码示例来源:origin: ops4j/org.ops4j.pax.logging

@Override
  public PluginEntry visitType(final TypeElement e, final Plugin plugin) {
    Objects.requireNonNull(plugin, "Plugin annotation is null.");
    final PluginEntry entry = new PluginEntry();
    entry.setKey(plugin.name().toLowerCase(Locale.US));
    entry.setClassName(elements.getBinaryName(e).toString());
    entry.setName(Plugin.EMPTY.equals(plugin.elementType()) ? plugin.name() : plugin.elementType());
    entry.setPrintable(plugin.printObject());
    entry.setDefer(plugin.deferChildren());
    entry.setCategory(plugin.category());
    return entry;
  }
}

代码示例来源:origin: ops4j/org.ops4j.pax.logging

for (final Class<?> clazz : resolver.getClasses()) {
  final Plugin plugin = clazz.getAnnotation(Plugin.class);
  final String categoryLowerCase = plugin.category().toLowerCase();
  List<PluginType<?>> list = newPluginsByCategory.get(categoryLowerCase);
  if (list == null) {
  mainEntry.setKey(plugin.name().toLowerCase());
  mainEntry.setName(plugin.name());
  mainEntry.setCategory(plugin.category());
  mainEntry.setClassName(clazz.getName());
  mainEntry.setPrintable(plugin.printObject());
      aliasEntry.setKey(alias.trim().toLowerCase());
      aliasEntry.setName(plugin.name());
      aliasEntry.setCategory(plugin.category());
      aliasEntry.setClassName(clazz.getName());
      aliasEntry.setPrintable(plugin.printObject());

相关文章