Java 类org.apache.logging.log4j.core.config.plugins.PluginValue 实例源码

项目:logging-log4j2    文件:Script.java   
@PluginFactory
public static Script createScript(
        // @formatter:off
        @PluginAttribute("name") final String name,
        @PluginAttribute(ATTR_LANGUAGE) String language,
        @PluginValue(ATTR_SCRIPT_TEXT) final String scriptText) {
        // @formatter:on
    if (language == null) {
        LOGGER.error("No '{}' attribute provided for {} plugin '{}'", ATTR_LANGUAGE, PLUGIN_NAME, name);
        language = DEFAULT_LANGUAGE;
    }
    if (scriptText == null) {
        LOGGER.error("No '{}' attribute provided for {} plugin '{}'", ATTR_SCRIPT_TEXT, PLUGIN_NAME, name);
        return null;
    }
    return new Script(name, language, scriptText);

}
项目:log4j-plugin-fluency    文件:StaticField.java   
/**
 * Creates a Property.
 *
 * @param name The key.
 * @param value The value.
 * @return A Property.
 */
@PluginFactory
public static StaticField createStaticField(
        @PluginAttribute("name") final String name,
        @PluginValue("value") final String value) {
    if (name == null) {
        LOGGER.error("Property name cannot be null");
    }
    return new StaticField(name, value);
}
项目:openclouddb    文件:Property.java   
/**
 * Create a Property.
 * @param key The key.
 * @param value The value.
 * @return A Property.
 */
@PluginFactory
public static Property createProperty(
        @PluginAttribute("name") final String key,
        @PluginValue("value")final String value) {
    if (key == null) {
        LOGGER.error("Property key cannot be null");
    }

    if(value.contains("${")){
        List<String> keys = new ArrayList<String>();
        List<String> values = new ArrayList<String>();

        String _value = value;
        Matcher m = pat.matcher(_value);        
        while(m.find()){        
            String _key = m.group();
            keys.add(_key);
            values.add(System.getProperty(_key.substring(2, _key.lastIndexOf('}'))));
        }
        for(int i = 0; i < keys.size(); i++){
            _value = _value.replaceAll("[${][^$]["+keys.get(i)+"]*}", values.get(i));
        }
        return new Property(key, _value);
    }else{
        return new Property(key, value);
    }
}
项目:log4j2    文件:Property.java   
/**
 * Create a Property.
 * @param key The key.
 * @param value The value.
 * @return A Property.
 */
@PluginFactory
public static Property createProperty(
        @PluginAttribute("name") final String key,
        @PluginValue("value") final String value) {
    if (key == null) {
        LOGGER.error("Property key cannot be null");
    }
    return new Property(key, value);
}
项目:openclouddb    文件:Property.java   
/**
 * Create a Property.
 * @param key The key.
 * @param value The value.
 * @return A Property.
 */
@PluginFactory
public static Property createProperty(
        @PluginAttribute("name") final String key,
        @PluginValue("value")final String value) {
    if (key == null) {
        LOGGER.error("Property key cannot be null");
    }

    if(value.contains("${")){
        List<String> keys = new ArrayList<String>();
        List<String> values = new ArrayList<String>();

        String _value = value;
        Matcher m = pat.matcher(_value);        
        while(m.find()){        
            String _key = m.group();
            keys.add(_key);
            values.add(System.getProperty(_key.substring(2, _key.lastIndexOf('}'))));
        }
        for(int i = 0; i < keys.size(); i++){
            _value = _value.replaceAll("[${][^$]["+keys.get(i)+"]*}", values.get(i));
        }
        return new Property(key, _value);
    }else{
        return new Property(key, value);
    }
}
项目:logging-log4j2    文件:Property.java   
/**
 * Creates a Property.
 *
 * @param name The key.
 * @param value The value.
 * @return A Property.
 */
@PluginFactory
public static Property createProperty(
        @PluginAttribute("name") final String name,
        @PluginValue("value") final String value) {
    if (name == null) {
        LOGGER.error("Property name cannot be null");
    }
    return new Property(name, value);
}
项目:stackify-log-log4j2    文件:Mask.java   
@PluginFactory
public static Mask create(@PluginValue("value") final String value,
                          @PluginAttribute("enabled") final String enabled) {
    return new Mask(value, enabled != null && Boolean.parseBoolean(enabled));
}
项目:logging-log4j2    文件:PluginValueVisitor.java   
public PluginValueVisitor() {
    super(PluginValue.class);
}