package org.injava.build.cutebuild.maven.pom.elements.generic;

import static java.util.Arrays.asList;
import static org.injava.lang.designbycontract.Preconditions.requireNonNull;

import java.util.List;

import org.injava.build.cutebuild.maven.pom.PomElement;
import org.injava.build.cutebuild.maven.pom.PomGenerator;
import org.injava.build.cutebuild.maven.pom.xmlwriter.Text;
import org.injava.build.cutebuild.maven.pom.xmlwriter.XmlWriter;

public class Url implements PomElement {
	private static final String URL = "url";
	
	private final Text text;

	public Url(final String text) {
		requireNonNull(text);
		this.text = new Text(text);
	}

	public Text getText() {
		return text;
	}

	public void open(XmlWriter writer) {
		writer.openTag(URL);
	}

	public void close(XmlWriter writer) {
		writer.openTag(URL);
	}

	public List<? extends PomElement> getContent() {
		return asList(text);
	}

	public boolean isContainer() {
		return true;
	}

	public void writeContent(XmlWriter xmlWriter) {
	}
}