package mediawiki.info.wikibase.snaks; import java.net.MalformedURLException; import java.net.URL; import javat.xml.Element; import mediawiki.info.wikibase.ValueSnak; import org.json.JSONException; import org.json.JSONObject; public class URLSnak extends ValueSnak<URL> { public URLSnak(URL value) { super(value); } @Override public JSONObject toJSONObject() throws JSONException { return null; } @Override public Object toReferenceRepresentation() throws JSONException { JSONObject o = new JSONObject(); o.put("type", "string"); o.put("value", getValue().toExternalForm()); return o; } @Override public String toClaimRepresentation() throws JSONException { return "\""+getValue().toExternalForm()+"\""; } @Override public void convert(Element element) throws MalformedURLException { setValue(new URL(element.getAttribute("value").getValue())); } @Override public String getDatatype() { return "url"; } }