Created
March 1, 2012 20:43
-
-
Save k33g/1953094 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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