Back to project page apps-android-commons.
The source code is released under:
Apache License
If you think the Android project apps-android-commons listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package org.wikimedia.commons.modifications; // www.ja va 2 s.c o m import android.os.Bundle; import org.json.JSONException; import org.json.JSONObject; public abstract class PageModifier { public static PageModifier fromJSON(JSONObject data) { String name = data.optString("name"); if(name.equals(CategoryModifier.MODIFIER_NAME)) { return new CategoryModifier(data.optJSONObject("data")); } else if(name.equals(TemplateRemoveModifier.MODIFIER_NAME)) { return new TemplateRemoveModifier(data.optJSONObject("data")); } return null; } protected String name; protected JSONObject params; protected PageModifier(String name) { this.name = name; params = new JSONObject(); } public abstract String doModification(String pageName, String pageContents); public abstract String getEditSumary(); public JSONObject toJSON() { JSONObject data = new JSONObject(); try { data.putOpt("name", name); data.put("data", params); } catch (JSONException e) { throw new RuntimeException(e); } return data; } }