Last active
August 29, 2015 14:07
-
-
Save neilellis/c554c8a28ba3799e70c1 to your computer and use it in GitHub Desktop.
An example of the http://github.com/cazcade/dollar library in action. And yes this is all valid Java!
This file contains hidden or 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 com.cazcade.dollar.Script; | |
| import com.cazcade.dollar.SecondScript; | |
| import com.cazcade.dollar.var; | |
| import java.util.Date; | |
| /** | |
| * @author <a href="http://uk.linkedin.com/in/neilellis">Neil Ellis</a> | |
| */ | |
| public class HelloScript extends Script { | |
| static { | |
| $THIS = HelloScript.class; | |
| } | |
| { | |
| var a = $("A"); | |
| var profile = $( | |
| $("name", "Neil"), | |
| $("age", new Date().getYear() + 1900 - 1970), | |
| $("gender", "male"), | |
| $("projects", $jsonArray("snapito", "dollar_vertx")), | |
| $("location", | |
| $("city", "brighton"), | |
| $("postcode", "bn1 6jj"), | |
| $("number", 343) | |
| )); | |
| profile.pass(SecondScript.class).out(); | |
| profile.out(); | |
| System.out.println(args); | |
| System.out.println(a); | |
| System.out.println(in); | |
| } | |
| } |
This file contains hidden or 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
| package com.cazcade.dollar; | |
| /** | |
| * @author <a href="http://uk.linkedin.com/in/neilellis">Neil Ellis</a> | |
| */ | |
| public class SecondScript extends Script { | |
| static { | |
| $THIS = SecondScript.class; | |
| } | |
| { | |
| out = in.$("test", 123); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment