Java 类org.apache.logging.log4j.core.config.plugins.validation.constraints.Required 实例源码

项目:logging-log4j2    文件:LoggerConfig.java   
/**
 * Factory method to create a LoggerConfig.
 *
 * @param additivity true if additive, false otherwise.
 * @param level The Level to be associated with the Logger.
 * @param loggerName The name of the Logger.
 * @param includeLocation whether location should be passed downstream
 * @param refs An array of Appender names.
 * @param properties Properties to pass to the Logger.
 * @param config The Configuration.
 * @param filter A Filter.
 * @return A new LoggerConfig.
 * @since 2.6
 */
@PluginFactory
public static LoggerConfig createLogger(
     // @formatter:off
    @PluginAttribute(value = "additivity", defaultBoolean = true) final boolean additivity,
    @PluginAttribute("level") final Level level,
    @Required(message = "Loggers cannot be configured without a name") @PluginAttribute("name") final String loggerName,
    @PluginAttribute("includeLocation") final String includeLocation,
    @PluginElement("AppenderRef") final AppenderRef[] refs,
    @PluginElement("Properties") final Property[] properties,
    @PluginConfiguration final Configuration config,
    @PluginElement("Filter") final Filter filter
    // @formatter:on
) {
    final String name = loggerName.equals(ROOT) ? Strings.EMPTY : loggerName;
    return new LoggerConfig(name, Arrays.asList(refs), filter, level, additivity, properties, config,
        includeLocation(includeLocation));
}
项目:SkyEye    文件:KafkaAppender.java   
@PluginFactory
public static KafkaAppender createAppender(
        @PluginElement("Layout") final Layout<? extends Serializable> layout,
        @PluginElement("Filter") final Filter filter,
        @Required(message = "No name provided for KafkaAppender") @PluginAttribute("name") final String name,
        @Required(message = "No topic provided for KafkaAppender") @PluginAttribute("topic") final String topic,
        @Required(message = "No zkServers provided for KafkaAppender") @PluginAttribute("zkServers") final String zkServers,
        @Required(message = "No mail provided for KafkaAppender") @PluginAttribute("mail") final String mail,
        @Required(message = "No rpc provided for KafkaAppender") @PluginAttribute("rpc") final String rpc,
        @Required(message = "No app provided for KafkaAppender") @PluginAttribute("app") final String app,
        @PluginElement("Properties") final Property[] properties,
        @PluginConfiguration final Configuration configuration) {
    final KafkaManager kafkaManager = new KafkaManager(configuration.getLoggerContext(), name, topic, zkServers, mail, rpc, app, SysUtil.host, properties);
    return new KafkaAppender(name, layout, filter, kafkaManager);
}
项目:GoMint    文件:TerminalConsoleAppender.java   
/**
 * Factory for log4j2
 *
 * @param name of the appender
 * @param filter for the appender
 * @param layout for the appender
 * @param ignoreExceptions controls if we should display exceptions
 * @return new jline terminal appender
 */
@PluginFactory
public static TerminalConsoleAppender createAppender(
    @Required( message = "No name provided for TerminalConsoleAppender" ) @PluginAttribute( "name" ) String name,
    @PluginElement( "Filter" ) Filter filter,
    @PluginElement( "Layout" ) @Nullable Layout<? extends Serializable> layout,
    @PluginAttribute( value = "ignoreExceptions", defaultBoolean = true ) boolean ignoreExceptions ) {

    Layout<? extends Serializable> finalLayout = layout;
    if ( layout == null ) {
        finalLayout = PatternLayout.createDefaultLayout();
    }

    return new TerminalConsoleAppender( name, filter, finalLayout, ignoreExceptions );
}
项目:logging-log4j2    文件:UsesLoggingAppender.java   
@PluginFactory
public static UsesLoggingAppender createAppender(
    @PluginAttribute("name") @Required(message = "A name for the Appender must be specified") final String name,
    @PluginAttribute("ignoreExceptions") final boolean ignore,
    @PluginElement("Layout") final Layout<?> layout,
    @PluginElement("Filter") final Filter filter) {
    return new UsesLoggingAppender(name, filter, layout, ignore);
}
项目:logging-log4j2    文件:HangingAppender.java   
@PluginFactory
public static HangingAppender createAppender(
        @PluginAttribute("name")
        @Required(message = "No name provided for HangingAppender")
        final String name,
        @PluginAttribute("delay") final long delay,
        @PluginAttribute("startupDelay") final long startupDelay,
        @PluginAttribute("shutdownDelay") final long shutdownDelay,
        @PluginElement("Layout") final Layout<? extends Serializable> layout,
        @PluginElement("Filter") final Filter filter) {
    return new HangingAppender(name, delay, startupDelay, shutdownDelay);
}
项目:logging-log4j2    文件:BlockingAppender.java   
@PluginFactory
public static BlockingAppender createAppender(
        @PluginAttribute("name")
        @Required(message = "No name provided for HangingAppender")
        final String name,
        @PluginElement("Layout") final Layout<? extends Serializable> layout,
        @PluginElement("Filter") final Filter filter) {
    return new BlockingAppender(name);
}
项目:logging-log4j2    文件:RequiredValidator.java   
@Override
public void initialize(final Required anAnnotation) {
    this.annotation = anAnnotation;
}
项目:logging-log4j2    文件:BlockingAppender.java   
@PluginFactory
public static BlockingAppender createAppender(
    @PluginAttribute("name") @Required(message = "A name for the Appender must be specified") final String name) {
    return new BlockingAppender(name);
}
项目:logging-log4j2    文件:AlwaysFailAppender.java   
@PluginFactory
public static AlwaysFailAppender createAppender(
    @PluginAttribute("name") @Required(message = "A name for the Appender must be specified") final String name) {
    return new AlwaysFailAppender(name);
}
项目:logging-log4j2    文件:FailOnceAppender.java   
@PluginFactory
public static FailOnceAppender createAppender(
    @PluginAttribute("name") @Required(message = "A name for the Appender must be specified") final String name) {
    return new FailOnceAppender(name);
}
项目:logging-log4j2    文件:DeadlockAppender.java   
@PluginFactory
public static DeadlockAppender createAppender(
    @PluginAttribute("name") @Required(message = "A name for the Appender must be specified") final String name) {
    return new DeadlockAppender(name);
}
项目:logging-log4j2    文件:ValidatingPluginWithGenericBuilder.java   
@PluginFactory
public static ValidatingPluginWithGenericBuilder newValidatingPlugin(
    @Required(message = "The name given by the factory is null") final String name) {
    return new ValidatingPluginWithGenericBuilder(name);
}
项目:logging-log4j2    文件:ValidatingPlugin.java   
@PluginFactory
public static ValidatingPlugin newValidatingPlugin(
    @Required(message = "The name given by the factory is null") final String name) {
    return new ValidatingPlugin(name);
}
项目:logging-log4j2    文件:ValidatingPluginWithTypedBuilder.java   
@PluginFactory
public static ValidatingPluginWithTypedBuilder newValidatingPlugin(
    @Required(message = "The name given by the factory is null") final String name) {
    return new ValidatingPluginWithTypedBuilder(name);
}