Skip to content

Instantly share code, notes, and snippets.

@neilellis
Last active August 29, 2015 14:07
Show Gist options
  • Save neilellis/c554c8a28ba3799e70c1 to your computer and use it in GitHub Desktop.
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!
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);
}
}
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