Zeus is a custom scripting language designed to be embedded into Java code to allow users to execute scripts in an enviroment that is fully manageable by the developer(s).
Simply add the library as a dependency. Replace {version} with the version you would like, a list can be found here.
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.github.Arraying</groupId>
<artifactId>Zeus</artifactId>
<version>{version}</version>
</dependency>
</dependencies>
repositories {
maven {
url 'https://jitpack.io'
}
}
dependencies {
compile 'com.github.Arraying:Zeus:{version}'
}
It's fairly forward creating the things inside of java. The documented version of the example can be found here. The file mentioned, example.zeus, can be found here.
package de.arraying.zeus;
import de.arraying.zeus.backend.ZeusException;
import de.arraying.zeus.backend.annotations.ZeusMethod;
import de.arraying.zeus.runtime.ZeusRuntime;
import de.arraying.zeus.runtime.ZeusRuntimeBuilder;
import de.arraying.zeus.runtime.ZeusTask;
import de.arraying.zeus.utils.ZeusVariableUtil;
import de.arraying.zeus.variable.VariableType;
import java.io.File;
public class Example {
@ZeusMethod
public void show_my_variable(String variableValue) {
System.out.println("My variable's value is: " + variableValue + "!");
}
public static void main(String[] args) {
try {
ZeusRuntimeBuilder builder = new ZeusRuntimeBuilder(ZeusRuntimeBuilder.Configuration.STANDARD);
builder.withMethods(new Example());
builder.withVariables(ZeusVariableUtil.createVariable(VariableType.CONSTANT, "my_var", "My Variable"));
ZeusRuntime runtime = builder.build();
ZeusTask task = runtime.evaluate(new File("example.zeus"), Throwable::printStackTrace);
} catch(ZeusException exception) { // Exceptions can occur during the building process, too.
exception.printStackTrace();
}
}
}
For information concering the actual language please visit the wiki. All methods are documented, a JavaDoc is coming soon.
Zeus is still in heavy development and no where near complete. Should you fix any bugs or add features please make a pull request.