@Test public void testBind() throws Exception { final Date now = new Date(); PostmanUpdater postman = new PostmanUpdater() { @Override protected Context update(final String group) { Context context = new Context(); context.put("threads", 2); context.put("ratio", 2.0); context.put("overWrite", false); context.put("node", "yyyy"); context.put("startTime", now); return context; } }; postman.start(); try { Context context = postman.get("sync"); Assert.assertNotNull(context); SyncJob job = new SyncJob(); Binders.bind(context, job); Assert.assertEquals(job.getThreads(), 2); Assert.assertEquals(job.getRatio(), 2.0, 0); Assert.assertEquals(job.isOverWrite(), false); Assert.assertEquals(job.getNode(), "yyyy"); Assert.assertEquals(job.getStartTime(), now); job = new SyncJob(); postman.addListener("sync", new BinderListener(job)); Assert.assertEquals(job.getThreads(), 2); Assert.assertEquals(job.getRatio(), 2.0, 0); } finally { postman.stop(); } }
public Object put(final String key, final Object value) { return parameters.put(key, value); }
Context implements Serializable, Cloneable { public Object put(final String key, final Object value) { return parameters.put(key, value); } }
Context implements Serializable, Cloneable { public Object put(final String key, final Object value) { return parameters.put(key, value); } Context();  Context(final Map<String, Object> parameters); }
Context implements Serializable, Cloneable { public Object put(final String key, final Object value) { return parameters.put(key, value); } Context();  Context(final Map<String, Object> parameters); T getObject(final String name, final Class<T> clazz); Object getObject(final String name); String getString(final String name, final String defaultValue); Byte getByte(final String name, final Byte defaultValue); Short getShort(final String name, final Short defaultValue); Integer getInteger(final String name, final Integer defaultValue); Long getLong(final String name, final Long defaultValue); Float getFloat(final String name, final Float defaultValue); Double getDouble(final String name, final Double defaultValue); Boolean getBoolean(final String name, final Boolean defaultValue); Date getDate(final String key, final Date defaultValue); Date getDate(final String key, final SimpleDateFormat format, final Date defaultValue); Byte getPositive(final String name, final Byte defaultValue); Short getPositive(final String name, final Short defaultValue); Integer getPositive(final String name, final Integer defaultValue); Long getPositive(final String name, final Long defaultValue); Short getNatural(final String name, final Short defaultValue); Byte getNatural(final String name, final Byte defaultValue); Integer getNatural(final String name, final Integer defaultValue); Long getNatural(final String name, final Long defaultValue); Object put(final String key, final Object value); Object putIfAbsent(final String key, final Object value); void put(final Map<String, ?> map); void put(final Context context); Object remove(final String key); void remove(); Map<String, Object> toMap(); Iterator<Map.Entry<String, Object>> iterator(); @Override Context clone(); @Override boolean equals(Object o); @Override int hashCode(); }
Context implements Serializable, Cloneable { public Object put(final String key, final Object value) { return parameters.put(key, value); } Context();  Context(final Map<String, Object> parameters); T getObject(final String name, final Class<T> clazz); Object getObject(final String name); String getString(final String name, final String defaultValue); Byte getByte(final String name, final Byte defaultValue); Short getShort(final String name, final Short defaultValue); Integer getInteger(final String name, final Integer defaultValue); Long getLong(final String name, final Long defaultValue); Float getFloat(final String name, final Float defaultValue); Double getDouble(final String name, final Double defaultValue); Boolean getBoolean(final String name, final Boolean defaultValue); Date getDate(final String key, final Date defaultValue); Date getDate(final String key, final SimpleDateFormat format, final Date defaultValue); Byte getPositive(final String name, final Byte defaultValue); Short getPositive(final String name, final Short defaultValue); Integer getPositive(final String name, final Integer defaultValue); Long getPositive(final String name, final Long defaultValue); Short getNatural(final String name, final Short defaultValue); Byte getNatural(final String name, final Byte defaultValue); Integer getNatural(final String name, final Integer defaultValue); Long getNatural(final String name, final Long defaultValue); Object put(final String key, final Object value); Object putIfAbsent(final String key, final Object value); void put(final Map<String, ?> map); void put(final Context context); Object remove(final String key); void remove(); Map<String, Object> toMap(); Iterator<Map.Entry<String, Object>> iterator(); @Override Context clone(); @Override boolean equals(Object o); @Override int hashCode();  }