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

NpsSDK.SimpleElement Maven / Gradle / Ivy

There is a newer version: 1.1.0
Show newest version
package NpsSDK;

import java.util.ArrayList;
import java.util.List;

public class SimpleElement extends BaseElement
{
	private String value;

	private String escapeSpecialCharacters(String value){
		value = value.replace("&", "&");
		value = value.replace("<", "<");
		value = value.replace(">", ">");
		return value;
	}

	@Override
	public String serialize() {
		return String.format("<%1$s>%2$s", this.getName(), this.escapeSpecialCharacters(value));
	}
	
	void trim(int maxLength){
		if (value.length() > maxLength){
			value = value.substring(0, maxLength);
		}
	}
	
	private static List emptyChildren = new ArrayList();
	
	@Override
	List getChildren() {
		return emptyChildren;
	}
	
	
	@Override
	String getConcatenatedValues() {
		return this.value;
	}  
	
    public SimpleElement(String name, String value) {
		this.setName(name);
		this.value = value;
	}
  
}

	




© 2015 - 2024 Weber Informatics LLC | Privacy Policy