NodeParameters implements Serializable { public NodeParameters() { } NodeParameters();  NodeParameters(boolean def);  NodeParameters(long def);  NodeParameters(double def);  NodeParameters(String def); void clear(); static NodeParameters create(); Set<String> getKeySet(); Type getKeyType(String key); boolean containsKey(String key); NodeParameters set(String key, boolean value); NodeParameters set(String key, long value); NodeParameters set(String key, double value); NodeParameters set(String key, String value); boolean getBoolean(String key); long getLong(String key); double getDouble(String key); String getString(String key); boolean get(String key, boolean def); long get(String key, long def); double get(String key, double def); String get(String key, String def); String getAsString(String key); String getAsSimpleString(String key); void remove(String key); @Override NodeParameters clone(); @Override boolean equals(Object o); @Override String toString(); String toSimpleString(Set<String> ignoreParams, String operator); ArrayList<String> collectCombineWeightList(); void parseSet(String key, String value); boolean needsToBeEscaped(String text, boolean typeProtection); String escapeAsNecessary(String text, boolean typeProtection); boolean isString(String key); boolean isBoolean(String key); boolean isDouble(String key); boolean isLong(String key); static final Pattern looksLikeDouble; }
@Test public void testNodeParameters() { NodeParameters p = new NodeParameters(); p.set("bool", true); p.set("long", 1234L); p.set("double", 0.1234); p.set("string", "test string"); assertEquals(true, p.getBoolean("bool")); assertEquals(1234, p.getLong("long")); assertEquals(0.1234, p.getDouble("double"), 0.0001); assertEquals("test string", p.getString("string")); Exception e = null; try { p.set("bool", "fail"); } catch (Exception except) { e = except; } assertNotNull(e); assertEquals("true", p.getAsString("bool")); assertEquals("1234", p.getAsString("long")); assertEquals("0.1234", p.getAsString("double")); assertEquals("test string", p.getAsString("string")); String paramString = p.toString(); assertEquals(":bool=true" + ":double=0.1234:long=1234" + ":string=test string", paramString); Node n = new Node("op", p, new ArrayList(), 0); Node m = StructuredQuery.parse(n.toString()); NodeParameters p2 = m.getNodeParameters(); assertTrue(p2.isBoolean("bool")); assertTrue (p2.isLong("long")); assertTrue(p2.isDouble("double")); assertTrue(p2.isString("string")); }