@Test public void test_simple_struct() { Slime slime = new Slime(); addStructFields(slime.setObject().setObject("simple"), "foobar", "MALE", new String[] { "foo@bar", "bar@foo" }); StructtypesConfig config = new ConfigPayload(slime).toInstance(StructtypesConfig.class, ""); assertThat(config.simple().name(), is("foobar")); assertThat(config.simple().gender(), is(StructtypesConfig.Simple.Gender.Enum.MALE)); assertThat(config.simple().emails(0), is("foo@bar")); assertThat(config.simple().emails(1), is("bar@foo")); }
public <ConfigType extends ConfigInstance> ConfigType toInstance(Class<ConfigType> clazz, String configId) { return ConfigInstanceUtil.getNewInstance(clazz, configId, this); }
ConfigPayload { public <ConfigType extends ConfigInstance> ConfigType toInstance(Class<ConfigType> clazz, String configId) { return ConfigInstanceUtil.getNewInstance(clazz, configId, this); } }
ConfigPayload { public <ConfigType extends ConfigInstance> ConfigType toInstance(Class<ConfigType> clazz, String configId) { return ConfigInstanceUtil.getNewInstance(clazz, configId, this); } ConfigPayload(Slime slime); }
ConfigPayload { public <ConfigType extends ConfigInstance> ConfigType toInstance(Class<ConfigType> clazz, String configId) { return ConfigInstanceUtil.getNewInstance(clazz, configId, this); } ConfigPayload(Slime slime); static ConfigPayload fromInstance(ConfigInstance instance); static ConfigPayload fromBuilder(ConfigPayloadBuilder builder); Slime getSlime(); void serialize(OutputStream os, SlimeFormat format); @Override String toString(); String toString(boolean compact); ConfigPayload applyDefaultsFromDef(InnerCNode clientDef); static ConfigPayload empty(); static ConfigPayload fromString(String jsonString); boolean isEmpty(); Utf8Array toUtf8Array(boolean compact); static ConfigPayload fromUtf8Array(Utf8Array payload); ConfigType toInstance(Class<ConfigType> clazz, String configId); }
ConfigPayload { public <ConfigType extends ConfigInstance> ConfigType toInstance(Class<ConfigType> clazz, String configId) { return ConfigInstanceUtil.getNewInstance(clazz, configId, this); } ConfigPayload(Slime slime); static ConfigPayload fromInstance(ConfigInstance instance); static ConfigPayload fromBuilder(ConfigPayloadBuilder builder); Slime getSlime(); void serialize(OutputStream os, SlimeFormat format); @Override String toString(); String toString(boolean compact); ConfigPayload applyDefaultsFromDef(InnerCNode clientDef); static ConfigPayload empty(); static ConfigPayload fromString(String jsonString); boolean isEmpty(); Utf8Array toUtf8Array(boolean compact); static ConfigPayload fromUtf8Array(Utf8Array payload); ConfigType toInstance(Class<ConfigType> clazz, String configId);  }