Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The result of the query, given what's printed and the error you got is a <code>Map&lt;String, Map&lt;String, Integer&gt;&gt;</code> (or a <code>Map&lt;String, Map&lt;String, String&gt;&gt;</code> if the numbers are stored as Strings).</p> <p>The map has one single key : <code>"get_all_words_popularity"</code>. The associated valud contains 4 keys : <code>"keyphrase_limit"</code>, <code>"timeout_limit"</code>, <code>"cost_per_call"</code>, <code>"result_limit"</code>.</p> <p>So your code should rather look like this:</p> <pre><code>untypedResult = wt.queryPermissions(); resp.getWriter().println(" Response for QueryPermissions----"); if("No Error".equals(wt.errormsg)) { Map&lt;String, Map&lt;String, Integer&gt; hMap = (Map&lt;String, Map&lt;String, Integer&gt;) untypedResult; for (Map.Entry&lt;String, Map&lt;String, Integer&gt;&gt; me : hMap.entrySet()) { Map&lt;String, Integer&gt; value = me.getValue(); WtQueryPerm perm = new WtQueryPerm(value.get("keyphrase_limit"), value.get("timeout_limit"), value.get("cost_per_call"), value.get("result_limit")); resp.getWriter().println(me.getKey() + " : Cost per call=" + perm.getCostPerCall() + ", Keyphrase limit=" + perm.getKeyphraseLimit() + ", Result limit=" + perm.getResultLimit() + ", Timeout limit=" + perm.getTimeoutLimit()); } } </code></pre> <p>Note that my code</p> <ul> <li>respects the Java naming conventions</li> <li>always uses generic types, which avoid casts and compilation warnings</li> <li>doesn't compare Strings with ==, but uses equals, because == only compares the references and not the values.</li> <li>declare the variables with the smaller scope possible, only when needed.</li> <li>use getters to access the state of the constructed object.</li> </ul> <p>Also understand that a cast doesn't magically transform an object into another object type. It just allows referencing an object of type A as another type B, and only works if the object is effectively of type B (and thus B has A as ancestor or interface)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload