@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); }
/** * 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); }
/** * 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); } }
/** * 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); }
/** * 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); }
@PluginFactory public static Mask create(@PluginValue("value") final String value, @PluginAttribute("enabled") final String enabled) { return new Mask(value, enabled != null && Boolean.parseBoolean(enabled)); }
public PluginValueVisitor() { super(PluginValue.class); }