Skip to content

Instantly share code, notes, and snippets.

@k33g
Created March 1, 2012 20:43
Show Gist options
  • Save k33g/1953094 to your computer and use it in GitHub Desktop.
Save k33g/1953094 to your computer and use it in GitHub Desktop.
import org.k33g.bb.BBModel;
import java.util.ArrayList;
import java.util.Map;
import static org.k33g.bb.BBMap.$;
import static org.k33g.bb.BBMap.Attributes;
class Human extends BBModel {
public Human(Map attributes) {
super(attributes);
}
}
public class Demo {
public static void main(String[] args) {
Human bob = new Human( Attributes(
$("name", "Bob")
));
Human sam = new Human( Attributes(
$("firstName","Sam"),
$("lastName","LePirate"),
$("hands", new ArrayList<String>(){{
add("Right");
add("Left");
}}),
$("father",new Human( Attributes(
$("name","Daddy")
)))
));
System.out.println(sam.get("firstName"));
System.out.println(sam.get("lastName"));
sam.set("firstName","SAM");
System.out.println(sam.attributes);
System.out.println(sam.get("hands"));
System.out.println(sam.toJson());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment