diff options
author | efiacor <fiachra.corcoran@est.tech> | 2019-07-19 11:48:13 +0000 |
---|---|---|
committer | efiacor <fiachra.corcoran@est.tech> | 2019-07-19 11:48:13 +0000 |
commit | 534c164c124950a2019acf71d253ac96be12c78c (patch) | |
tree | 1da3caf7ae28c39e1604846cc647c9066f0e8ce2 | |
parent | e78963869f8f55101d22b0afc06a5c6d6577dbb0 (diff) |
Removing unused code
Change-Id: Ic200975ad20525789c37cc16f3aeeb9e26808ffd
Issue-ID: DMAAP-1226
Signed-off-by: efiacor <fiachra.corcoran@est.tech>
15 files changed, 3 insertions, 420 deletions
diff --git a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeConfigManager.java b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeConfigManager.java index 9ffc8ae8..786befce 100644 --- a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeConfigManager.java +++ b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeConfigManager.java @@ -497,13 +497,6 @@ public class NodeConfigManager implements DeliveryQueueHelper { } /** - * Is a destination redirected. - */ - public boolean isDestRedirected(DestInfo destinfo) { - return (followredirects && rdmgr.isRedirected(destinfo.getSubId())); - } - - /** * Set up redirection on receipt of a 3XX from a target URL. */ public boolean handleRedirection(DestInfo destinationInfo, String redirto, String fileid) { @@ -521,23 +514,6 @@ public class NodeConfigManager implements DeliveryQueueHelper { } /** - * Set up redirection on receipt of a 3XX from a target URL. - */ - public boolean handleRedirectionSubLevel(DeliveryTask task, DestInfo destinfo, String redirto, String fileid) { - fileid = "/" + fileid; - String subid = destinfo.getSubId(); - String purl = destinfo.getURL(); - if (task.getFollowRedirects() && subid != null && redirto.endsWith(fileid)) { - redirto = redirto.substring(0, redirto.length() - fileid.length()); - if (!redirto.equals(purl)) { - rdmgr.redirect(subid, purl, redirto); - return true; - } - } - return false; - } - - /** * Handle unreachable target URL. */ public void handleUnreachable(DestInfo destinationInfo) { @@ -607,16 +583,6 @@ public class NodeConfigManager implements DeliveryQueueHelper { } /** - * Get the creation date for a feed. - * - * @param feedid The feed ID - * @return the timestamp of creation date of feed id passed - */ - public String getCreatedDate(String feedid) { - return (config.getCreatedDate(feedid)); - } - - /** * Get the spool directory for temporary files. */ public String getSpoolDir() { @@ -811,30 +777,14 @@ public class NodeConfigManager implements DeliveryQueueHelper { return enabledprotocols; } - public void setEnabledprotocols(String[] enabledprotocols) { - this.enabledprotocols = enabledprotocols.clone(); - } - public String getAafType() { return aafType; } - public void setAafType(String aafType) { - this.aafType = aafType; - } - - public void setAafInstance(String aafInstance) { - this.aafInstance = aafInstance; - } - public String getAafAction() { return aafAction; } - public void setAafAction(String aafAction) { - this.aafAction = aafAction; - } - /* * Get aafURL from SWM variable * */ @@ -842,18 +792,10 @@ public class NodeConfigManager implements DeliveryQueueHelper { return aafURL; } - public void setAafURL(String aafURL) { - this.aafURL = aafURL; - } - public boolean getCadiEnabled() { return cadiEnabled; } - public void setCadiEnabled(boolean cadiEnabled) { - this.cadiEnabled = cadiEnabled; - } - /** * Builds the permissions string to be verified. * diff --git a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/eelf/JettyFilter.java b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/eelf/JettyFilter.java index 39b7d8e2..69f51d82 100644 --- a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/eelf/JettyFilter.java +++ b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/eelf/JettyFilter.java @@ -17,6 +17,7 @@ * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ + package org.onap.dmaap.datarouter.node.eelf; import ch.qos.logback.classic.spi.ILoggingEvent; diff --git a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/eelf/MetricsFilter.java b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/eelf/MetricsFilter.java index 235dcb2d..0fa57d4a 100644 --- a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/eelf/MetricsFilter.java +++ b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/eelf/MetricsFilter.java @@ -17,6 +17,7 @@ * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ + package org.onap.dmaap.datarouter.node.eelf; import ch.qos.logback.classic.Level; diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/BaseServlet.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/BaseServlet.java index 3993b4df..c6b1cde7 100755 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/BaseServlet.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/BaseServlet.java @@ -622,16 +622,6 @@ public class BaseServlet extends HttpServlet implements ProvDataProvider { } /** - * [DATARTR-27] Poke all the DR nodes - * Get an array of all node names in the DR network. - * - * @return an array of Strings - */ - public static String[] getDRNodes() { - return drnodes; - } - - /** * Get an array of all node InetAddresses in the DR network. * * @return an array of InetAddresses diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/GroupServlet.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/GroupServlet.java index 544a4800..4432913f 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/GroupServlet.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/GroupServlet.java @@ -88,31 +88,6 @@ public class GroupServlet extends ProxyServlet { return; } - // Check with the Authorizer - /*AuthorizationResponse aresp = authz.decide(req); - if (! aresp.isAuthorized()) { - message = POLICY_ENGINE; - elr.setMessage(message); - elr.setResult(HttpServletResponse.SC_FORBIDDEN); - eventlogger.error(elr.toString()); - resp.sendError(HttpServletResponse.SC_FORBIDDEN, message); - return; - }*/ - - - /*ContentHeader ch = getContentHeader(req); - String ver = ch.getAttribute("version"); - if (!ch.getType().equals(GROUPLIST_CONTENT_TYPE) || !(ver.equals("1.0") || ver.equals("2.0"))) { - intlogger.debug("Content-type is: "+req.getHeader("Content-Type")); - message = "Incorrect content-type"; - elr.setMessage(message); - elr.setResult(HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE); - eventlogger.error(elr.toString()); - resp.sendError(HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE, message); - return; - }*/ - - int groupid = getIdFromPath(req); if (groupid < 0) { message = "Missing or bad group number."; diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/DeliveryExtraRecord.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/DeliveryExtraRecord.java index 2a959f3d..0e5342a6 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/DeliveryExtraRecord.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/DeliveryExtraRecord.java @@ -44,12 +44,7 @@ public class DeliveryExtraRecord extends BaseLogRecord { this.subid = Integer.parseInt(pp[4]);
this.contentLength2 = Long.parseLong(pp[6]);
}
- public DeliveryExtraRecord(ResultSet rs) throws SQLException {
- super(rs);
- // Note: because this record should be "rare" these fields are mapped to unconventional fields in the DB
- this.subid = rs.getInt("DELIVERY_SUBID");
- this.contentLength2 = rs.getInt("CONTENT_LENGTH_2");
- }
+
@Override
public void load(PreparedStatement ps) throws SQLException {
ps.setString(1, "dlx"); // field 1: type
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/Feed.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/Feed.java index cab4d3d2..1cfd0f6b 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/Feed.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/Feed.java @@ -497,14 +497,6 @@ public class Feed extends Syncable { this.suspended = suspended;
}
- public Date getLast_mod() {
- return last_mod;
- }
-
- public Date getCreated_date() {
- return created_date;
- }
-
@Override
public JSONObject asJSONObject() {
JSONObject jo = new JSONObject();
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/FeedEndpointID.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/FeedEndpointID.java index cd482c61..384d9f64 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/FeedEndpointID.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/FeedEndpointID.java @@ -39,10 +39,6 @@ public class FeedEndpointID implements JSONable { private String id;
private String password;
- public FeedEndpointID() {
- this("", "");
- }
-
public FeedEndpointID(String id, String password) {
this.id = id;
this.password = password;
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/Group.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/Group.java index be4c6409..da682d74 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/Group.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/Group.java @@ -133,54 +133,6 @@ public class Group extends Syncable { return max;
}
- public static Collection<String> getGroupsByClassfication(String classfication) {
- List<String> list = new ArrayList<>();
- String sql = "select * from GROUPS where classification = ?";
- try {
- DB db = new DB();
- @SuppressWarnings("resource")
- Connection conn = db.getConnection();
- try (PreparedStatement stmt = conn.prepareStatement(sql)) {
- stmt.setString(1, classfication);
- try (ResultSet rs = stmt.executeQuery()) {
- while (rs.next()) {
- int groupid = rs.getInt("groupid");
-
- }
- }
- }
- db.release(conn);
- } catch (SQLException e) {
- intlogger.error("PROV0002 getGroupsByClassfication: " + e.getMessage(), e);
- }
- return list;
- }
-
- /**
- * Return a count of the number of active subscriptions in the DB.
- *
- * @return the count
- */
- public static int countActiveSubscriptions() {
- int count = 0;
- try {
- DB db = new DB();
- @SuppressWarnings("resource")
- Connection conn = db.getConnection();
- try (Statement stmt = conn.createStatement()) {
- try (ResultSet rs = stmt.executeQuery("select count(*) from SUBSCRIPTIONS")) {
- if (rs.next()) {
- count = rs.getInt(1);
- }
- }
- }
- db.release(conn);
- } catch (SQLException e) {
- intlogger.warn("PROV0008 countActiveSubscriptions: " + e.getMessage(), e);
- }
- return count;
- }
-
public Group() {
this("", "", "");
}
@@ -251,14 +203,6 @@ public class Group extends Syncable { Group.intlogger = intlogger;
}
- public static int getNext_groupid() {
- return next_groupid;
- }
-
- public static void setNext_groupid(int next_groupid) {
- Group.next_groupid = next_groupid;
- }
-
public String getAuthid() {
return authid;
}
@@ -295,19 +239,6 @@ public class Group extends Syncable { return members;
}
- public void setMembers(String members) {
- this.members = members;
- }
-
- public Date getLast_mod() {
- return last_mod;
- }
-
- public void setLast_mod(Date last_mod) {
- this.last_mod = last_mod;
- }
-
-
@Override
public JSONObject asJSONObject() {
JSONObject jo = new JSONObject();
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/IngressRoute.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/IngressRoute.java index 4332d7d7..329e77fa 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/IngressRoute.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/IngressRoute.java @@ -189,38 +189,6 @@ public class IngressRoute extends NodeClass implements Comparable<IngressRoute> return v;
}
- /**
- * Get a collection of all Ingress Routes with a particular sequence number.
- *
- * @param seq the sequence number to look for
- * @return the collection (may be empty).
- */
- public static Collection<IngressRoute> getIngressRoute(int seq) {
- Collection<IngressRoute> rv = new ArrayList<IngressRoute>();
- try {
- DB db = new DB();
- @SuppressWarnings("resource")
- Connection conn = db.getConnection();
- String sql = "select FEEDID, USERID, SUBNET, NODESET from INGRESS_ROUTES where SEQUENCE = ?";
- try (PreparedStatement ps = conn.prepareStatement(sql)) {
- ps.setInt(1, seq);
- try (ResultSet rs = ps.executeQuery()) {
- while (rs.next()) {
- int feedid = rs.getInt("FEEDID");
- String user = rs.getString("USERID");
- String subnet = rs.getString("SUBNET");
- int nodeset = rs.getInt("NODESET");
- rv.add(new IngressRoute(seq, feedid, user, subnet, nodeset));
- }
- }
- }
- db.release(conn);
- } catch (SQLException e) {
- intlogger.error("PROV0004 getIngressRoute: " + e.getMessage(), e);
- }
- return rv;
- }
-
public IngressRoute(int seq, int feedid, String user, String subnet, Collection<String> nodes)
throws IllegalArgumentException {
this(seq, feedid, user, subnet);
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/NetworkRoute.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/NetworkRoute.java index eeca0903..6ac05445 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/NetworkRoute.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/NetworkRoute.java @@ -113,10 +113,6 @@ public class NetworkRoute extends NodeClass implements Comparable<NetworkRoute> return tonode;
}
- public int getVianode() {
- return vianode;
- }
-
@Override
public boolean doDelete(Connection c) {
boolean rv = true;
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/Parameters.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/Parameters.java index 357444e4..9e7071bb 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/Parameters.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/Parameters.java @@ -156,10 +156,6 @@ public class Parameters extends Syncable { return keyname;
}
- public void setKeyname(String keyname) {
- this.keyname = keyname;
- }
-
public String getValue() {
return value;
}
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/PubFailRecord.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/PubFailRecord.java index 88d48826..a38d8bd2 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/PubFailRecord.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/PubFailRecord.java @@ -24,7 +24,6 @@ package org.onap.dmaap.datarouter.provisioning.beans;
import java.sql.PreparedStatement;
-import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Types;
import java.text.ParseException;
@@ -49,15 +48,6 @@ public class PubFailRecord extends BaseLogRecord { this.error = pp[11];
}
- public PubFailRecord(ResultSet rs) throws SQLException {
- super(rs);
- // Note: because this record should be "rare" these fields are mapped to unconventional fields in the DB
- this.contentLengthReceived = rs.getLong("CONTENT_LENGTH_2");
- this.sourceIP = rs.getString("REMOTE_ADDR");
- this.user = rs.getString("USER");
- this.error = rs.getString("FEED_FILEID");
- }
-
public long getContentLengthReceived() {
return contentLengthReceived;
}
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/SubDelivery.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/SubDelivery.java index 98981a30..5a3457b9 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/SubDelivery.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/SubDelivery.java @@ -43,10 +43,6 @@ public class SubDelivery implements JSONable { private String password;
private boolean use100;
- public SubDelivery() {
- this("", "", "", false);
- }
-
public SubDelivery(String url, String user, String password, boolean use100) {
this.url = url;
this.user = user;
@@ -90,10 +86,6 @@ public class SubDelivery implements JSONable { return use100;
}
- public void setUse100(boolean use100) {
- this.use100 = use100;
- }
-
@Override
public JSONObject asJSONObject() {
JSONObject jo = new JSONObject();
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/LOGJSONObject.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/LOGJSONObject.java index f7e08748..1140a1ce 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/LOGJSONObject.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/LOGJSONObject.java @@ -186,13 +186,11 @@ public class LOGJSONObject { } } - /** * The map where the JSONObject's properties are kept. */ private final Map<String, Object> map; - /** * It is sometimes more convenient and less ambiguous to have a * <code>NULL</code> object than to use Java's <code>null</code> value. @@ -201,7 +199,6 @@ public class LOGJSONObject { */ public static final Object NULL = new Null(); - /** * Construct an empty JSONObject. */ @@ -209,7 +206,6 @@ public class LOGJSONObject { this.map = new LinkedHashMap<>(); } - /** * Construct a JSONObject from a subset of another JSONObject. * An array of strings is used to identify the keys that should be copied. @@ -229,7 +225,6 @@ public class LOGJSONObject { } } - /** * Construct a JSONObject from a JSONTokener. * @@ -287,7 +282,6 @@ public class LOGJSONObject { } } - /** * Construct a JSONObject from a Map. * @@ -309,7 +303,6 @@ public class LOGJSONObject { } } - /** * Construct a JSONObject from an Object using bean getters. * It reflects on all of the public methods of the object. @@ -334,7 +327,6 @@ public class LOGJSONObject { this.populateMap(bean); } - /** * Construct a JSONObject from an Object, using reflection to find the * public members. The resulting JSONObject's keys will be the strings @@ -359,7 +351,6 @@ public class LOGJSONObject { } } - /** * Construct a JSONObject from a source JSON text string. * This is the most commonly used JSONObject constructor. @@ -374,7 +365,6 @@ public class LOGJSONObject { this(new JSONTokener(source)); } - /** * Construct a JSONObject from a ResourceBundle. * @@ -415,7 +405,6 @@ public class LOGJSONObject { } } - /** * Accumulate values under a key. It is similar to the put method except * that if there is already an object stored under the key then a @@ -451,7 +440,6 @@ public class LOGJSONObject { return this; } - /** * Append values to the array under a key. If the key does not exist in the * JSONObject, then the key is put in the JSONObject with its value being a @@ -478,7 +466,6 @@ public class LOGJSONObject { return this; } - /** * Produce a string from a double. The string "null" will be returned if * the number is not finite. @@ -506,7 +493,6 @@ public class LOGJSONObject { return string; } - /** * Get the value object associated with a key. * @@ -526,7 +512,6 @@ public class LOGJSONObject { return object; } - /** * Get the boolean value associated with a key. * @@ -549,7 +534,6 @@ public class LOGJSONObject { "] is not a Boolean."); } - /** * Get the double value associated with a key. * @@ -570,7 +554,6 @@ public class LOGJSONObject { } } - /** * Get the int value associated with a key. * @@ -591,7 +574,6 @@ public class LOGJSONObject { } } - /** * Get the JSONArray value associated with a key. * @@ -609,7 +591,6 @@ public class LOGJSONObject { "] is not a JSONArray."); } - /** * Get the JSONObject value associated with a key. * @@ -627,7 +608,6 @@ public class LOGJSONObject { "] is not a JSONObject."); } - /** * Get the long value associated with a key. * @@ -648,7 +628,6 @@ public class LOGJSONObject { } } - /** * Get an array of field names from a JSONObject. * @@ -669,30 +648,6 @@ public class LOGJSONObject { return names; } - - /** - * Get an array of field names from an Object. - * - * @return An array of field names, or null if there are no names. - */ - public static String[] getNames(Object object) { - if (object == null) { - return null; - } - Class<? extends Object> klass = object.getClass(); - Field[] fields = klass.getFields(); - int length = fields.length; - if (length == 0) { - return null; - } - String[] names = new String[length]; - for (int i = 0; i < length; i += 1) { - names[i] = fields[i].getName(); - } - return names; - } - - /** * Get the string associated with a key. * @@ -709,7 +664,6 @@ public class LOGJSONObject { "] not a string."); } - /** * Determine if the JSONObject contains a specific key. * @@ -720,7 +674,6 @@ public class LOGJSONObject { return this.map.containsKey(key); } - /** * Increment a property of a JSONObject. If there is no such property, * create one with a value of 1. If there is such a property, and if @@ -749,20 +702,6 @@ public class LOGJSONObject { return this; } - - /** - * Determine if the value associated with the key is null or if there is - * no value. - * - * @param key A key string. - * @return true if there is no value associated with the key or if - * the value is the JSONObject.NULL object. - */ - public boolean isNull(String key) { - return LOGJSONObject.NULL.equals(this.opt(key)); - } - - /** * Get an enumeration of the keys of the JSONObject. * @@ -772,7 +711,6 @@ public class LOGJSONObject { return this.keySet().iterator(); } - /** * Get a set of keys of the JSONObject. * @@ -782,7 +720,6 @@ public class LOGJSONObject { return this.map.keySet(); } - /** * Get the number of keys stored in the JSONObject. * @@ -792,7 +729,6 @@ public class LOGJSONObject { return this.map.size(); } - /** * Produce a JSONArray containing the names of the elements of this * JSONObject. @@ -838,7 +774,6 @@ public class LOGJSONObject { return string; } - /** * Get an optional value associated with a key. * @@ -849,20 +784,6 @@ public class LOGJSONObject { return key == null ? null : this.map.get(key); } - - /** - * Get an optional boolean associated with a key. - * It returns false if there is no such key, or if the value is not - * Boolean.TRUE or the String "true". - * - * @param key A key string. - * @return The truth. - */ - public boolean optBoolean(String key) { - return this.optBoolean(key, false); - } - - /** * Get an optional boolean associated with a key. * It returns the defaultValue if there is no such key, or if it is not @@ -881,21 +802,6 @@ public class LOGJSONObject { } } - - /** - * Get an optional double associated with a key, - * or NaN if there is no such key or if its value is not a number. - * If the value is a string, an attempt will be made to evaluate it as - * a number. - * - * @param key A string which is the key. - * @return An object which is the value. - */ - public double optDouble(String key) { - return this.optDouble(key, Double.NaN); - } - - /** * Get an optional double associated with a key, or the * defaultValue if there is no such key or if its value is not a number. @@ -915,21 +821,6 @@ public class LOGJSONObject { } } - - /** - * Get an optional int value associated with a key, - * or zero if there is no such key or if the value is not a number. - * If the value is a string, an attempt will be made to evaluate it as - * a number. - * - * @param key A key string. - * @return An object which is the value. - */ - public int optInt(String key) { - return this.optInt(key, 0); - } - - /** * Get an optional int value associated with a key, * or the default if there is no such key or if the value is not a number. @@ -949,21 +840,6 @@ public class LOGJSONObject { } } - - /** - * Get an optional JSONArray associated with a key. - * It returns null if there is no such key, or if its value is not a - * JSONArray. - * - * @param key A key string. - * @return A JSONArray which is the value. - */ - public JSONArray optJSONArray(String key) { - Object o = this.opt(key); - return o instanceof JSONArray ? (JSONArray) o : null; - } - - /** * Get an optional JSONObject associated with a key. * It returns null if there is no such key, or if its value is not a @@ -977,21 +853,6 @@ public class LOGJSONObject { return object instanceof LOGJSONObject ? (LOGJSONObject) object : null; } - - /** - * Get an optional long value associated with a key, - * or zero if there is no such key or if the value is not a number. - * If the value is a string, an attempt will be made to evaluate it as - * a number. - * - * @param key A key string. - * @return An object which is the value. - */ - public long optLong(String key) { - return this.optLong(key, 0); - } - - /** * Get an optional long value associated with a key, * or the default if there is no such key or if the value is not a number. @@ -1010,20 +871,6 @@ public class LOGJSONObject { } } - - /** - * Get an optional string associated with a key. - * It returns an empty string if there is no such key. If the value is not - * a string and is not null, then it is converted to a string. - * - * @param key A key string. - * @return A string which is the value. - */ - public String optString(String key) { - return this.optString(key, ""); - } - - /** * Get an optional string associated with a key. * It returns the defaultValue if there is no such key. @@ -1037,7 +884,6 @@ public class LOGJSONObject { return NULL.equals(object) ? defaultValue : object.toString(); } - private void populateMap(Object bean) { Class<? extends Object> klass = bean.getClass(); @@ -1086,7 +932,6 @@ public class LOGJSONObject { } } - /** * Put a key/boolean pair in the JSONObject. * @@ -1100,7 +945,6 @@ public class LOGJSONObject { return this; } - /** * Put a key/value pair in the JSONObject, where the value will be a * JSONArray which is produced from a Collection. @@ -1115,7 +959,6 @@ public class LOGJSONObject { return this; } - /** * Put a key/double pair in the JSONObject. * @@ -1129,7 +972,6 @@ public class LOGJSONObject { return this; } - /** * Put a key/int pair in the JSONObject. * @@ -1143,7 +985,6 @@ public class LOGJSONObject { return this; } - /** * Put a key/long pair in the JSONObject. * @@ -1157,7 +998,6 @@ public class LOGJSONObject { return this; } - /** * Put a key/value pair in the JSONObject, where the value will be a * JSONObject which is produced from a Map. @@ -1172,7 +1012,6 @@ public class LOGJSONObject { return this; } - /** * Put a key/value pair in the JSONObject. If the value is null, * then the key will be removed from the JSONObject if it is present. @@ -1208,7 +1047,6 @@ public class LOGJSONObject { return this; } - /** * Put a key/value pair in the JSONObject, but only if the key and the * value are both non-null, and only if there is not already a member @@ -1229,7 +1067,6 @@ public class LOGJSONObject { return this; } - /** * Put a key/value pair in the JSONObject, but only if the * key and the value are both non-null. @@ -1248,7 +1085,6 @@ public class LOGJSONObject { return this; } - /** * Produce a string in double quotes with backslash sequences in all the * right places. A backslash will be inserted within </, producing <\/, @@ -1394,7 +1230,6 @@ public class LOGJSONObject { return string; } - /** * Throw an exception if the object is a NaN or infinite number. * @@ -1417,7 +1252,6 @@ public class LOGJSONObject { } } - /** * Produce a JSONArray containing the values of the members of this * JSONObject. @@ -1459,7 +1293,6 @@ public class LOGJSONObject { } } - /** * Make a prettyprinted JSON text of this JSONObject. * <p> @@ -1593,21 +1426,6 @@ public class LOGJSONObject { } } - - /** - * Write the contents of the JSONObject as JSON text to a writer. - * For compactness, no whitespace is added. - * <p> - * Warning: This method assumes that the data structure is acyclical. - * - * @return The writer. - * @throws JSONException - */ - public Writer write(Writer writer) throws JSONException { - return this.write(writer, 0, 0); - } - - @SuppressWarnings("unchecked") static final Writer writeValue(Writer writer, Object value, int indentFactor, int indent) throws JSONException, IOException { |