Skip to content

Instantly share code, notes, and snippets.

@jarrodhroberson
Last active September 28, 2015 22:19
Show Gist options
  • Save jarrodhroberson/516b0cf13b0f781ed305 to your computer and use it in GitHub Desktop.
Save jarrodhroberson/516b0cf13b0f781ed305 to your computer and use it in GitHub Desktop.
package com.vertigrated.rtti;
import com.google.common.collect.ImmutableSortedMap;
import org.junit.Test;
import java.io.Serializable;
public class MapAsJavaBeanProxyTest
{
@Test
public void testMapAsJavaBeanProxy()
{
final ImmutableSortedMap<String, Object> ism = ImmutableSortedMap.of("getString", "This is a String", "getInteger", Integer.MAX_VALUE, "getBoolean", true);
final TestInterface t = MapBackedJavaBeanProxy.as(TestInterface.class).from(ism);
System.out.println("t.getString() = " + t.getString());
System.out.println("t.getInteger() = " + t.getInteger());
System.out.println("t.getBoolean() = " + t.getBoolean());
System.out.println("t.toString() = " + t.toString());
}
}
package com.vertigrated.rtti;
interface TestInterface
{
public String getString();
public Integer getInteger();
public Boolean getBoolean();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment