All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.anysoft.selector.impl.Template Maven / Gradle / Ivy

There is a newer version: 1.6.17
Show newest version
package com.anysoft.selector.impl;

import org.apache.commons.lang3.StringUtils;
import org.w3c.dom.Element;

import com.anysoft.formula.DataProvider;
import com.anysoft.selector.Selector;
import com.anysoft.util.DataProviderProperties;
import com.anysoft.util.Properties;
import com.anysoft.util.PropertiesConstants;

/**
 * Template
 * @author yyduan
 * @since 1.6.6.13
 */
public class Template extends Selector {	
	protected String template = "";	
	
	public void onConfigure(Element _e, Properties _p) {
		template = PropertiesConstants.getString(_p, "selector-template", template,true);
	}

	@Override
	public String onSelect(DataProvider provider) {
		DataProviderProperties p = new DataProviderProperties(provider);
		String value = p.transform(template);		
		return StringUtils.isEmpty(value)?getDefaultValue():value;
	}


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy