org.apache.logging.log4j.core.config.plugins.Plugin Java Examples

The following examples show how to use org.apache.logging.log4j.core.config.plugins.Plugin. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ConstraintType.java    From logging-log4j-audit with Apache License 2.0 5 votes vote down vote up
default String getName() {
    Plugin annotation = this.getClass().getAnnotation(Plugin.class);
    if (annotation == null || annotation.name().length() == 0) {
        throw new NameNotFoundException("No name could be found for plugin class " + this.getClass().getName());
    }

    return annotation.name();
}
 
Example #2
Source File: PatternConverterTest.java    From Poseidon with Apache License 2.0 2 votes vote down vote up
/**
 * Tests the presence of certain annotations and converter key in a given Converter class
 *
 * @param clazz PatterConverter class to test
 * @param key Converter key to match
 */
private void testPatternAnnotation(Class<? extends AccessLogPatternConverter> clazz, String key) {
    assertTrue(clazz.isAnnotationPresent(Plugin.class));
    assertTrue(clazz.isAnnotationPresent(ConverterKeys.class));
    assertEquals(key, clazz.getAnnotation(ConverterKeys.class).value()[0]);
}