JQuickLang Syntax Reference
May 3, 2026 · View on GitHub
Overview
JQuick Java is a lightweight Java-like scripting language, inherently designed for rule engines。 it perfectly integrates the strong type safety of Java with the dynamic flexibility of JavaScript, supporting dynamic loading, parsing, and execution of business rules at runtime ,whether it's complex logical judgments or data verification or process orchestration,jQuick Java enables you to tune business rules as if they were configuration parameters, no need to restart the application or redeploy, allowing your system to truly achieveseparation of rules and code.
Table of Contents
- Overview
- Core Features
- Program Structure
- Data Types
- Expressions
- Control Structures
- Invocation Styles
- Output
- Comments
- Code Samples
- Appendix
- Complete Examples
Core Features
1. Simplified Type System
- 7 Primitive types built-in
- Full generics support
- Flexible collections (List/Set/Map)
- dimensional arrays
// Primitive types
int counter = 0;
boolean enabled = true;
// Generic collections
List<String> names = ["Alice", "Bob"];
Map<String, Integer> scores = {"Math":90, "English":85};
Program Structure
import com.example.pkg as pkgAlias;
int x = 10;
console.log(x);
Import Declarations
| Component | Description |
|---|---|
| qualified.name | dot-separated path (e.g., java.lang.String) |
| as | alias name |
Variable Declarations
| Keyword | Example | Description |
|---|---|---|
| simpleType | int x = 10; | Type inferred |
| TypeName | String s = "hi"; | Explicit type (optional) |
Data Types
Primitive Types (simpleType)
| Type Keyword | Data Type | Example |
|---|---|---|
| short | Short integer | short s = 100; |
| int | Integer | int x = 42; |
| float | Floating point | float pi = 3.14; |
| double | Double | double d = 9.99; |
| long | Long integer | long big = 100; |
| boolean | Boolean | boolean flag = true; |
| byte | Byte | byte b = 0x1F; |
| Null | null | null |
| Date | Date | 2025-06-07 |
| Date | Date | 2025-06-07 12:00:01 |
Composite Types
| Type Format | Example |
|---|---|
| Generic (Type | List<String> names; |
| Generic Multi (Type<K,V>) | Map<String, Integer> scores; |
| List | List<Double> prices; |
| Set | Set<Employee> staff; |
| Array | int[] numbers = {1,2,3}; |
| Custom Class | MyClass obj = new MyClass(); |
| Import Alias | import java.util.Date as JDate; |
import List<java.lang.String> as StringList ;
StringList list=["A","B","C"];
Expressions
| Operator Group | Operators | Example | Desc |
|---|---|---|---|
| Mul | * | 1*1 | number * number |
| Div | / | 1/1 | number / number |
| Add | + | 1+1 | number + number string+string |
| Sub | - | 1-1 | number - number |
| GT | > | 1>1 | number > number |
| GE | >= | 1>=1 | number * number |
| LT | < | 1<1 | number < number |
| LE | <= | 1<=1 | number <= number |
| NE | != | 1 !=1 | number != number |
| EQ | == | 1==1 | number == number |
| AND | && | true&& true | boolean && boolean |
| OR | || | true || false | boolean|| boolean |
| PAREN | (expression) | (a + b) * 2 > 10 && x != y | boolean|| boolean |
sample code
(a + b) * 2 > 10 && x != y
Control Structures
if statement
if(false){
console.log(1);
}else if(true){
console.log(2);
}else if(false){
console.log(3);
}else{
console.log(4);
}
loop statement
for (int i = 0; i < 10; i = i + 1) {
for (int j = 0; j < 10; j = j + 1){
if(j==2){
continue;
}else{
console.log(i+","+j); }
}
};
while(true){
for (int a = 0; a<10; a=a+1){
if(a==2){
continue;
}else{
console.log("当前的变量a:"+a);
}
}
break;
}
method definition
int def funtionName(int:a, int:b) {
return a + b;
}
import List<java.lang.String> as StringList ;
StringList def funtionName(StringList:a, int:b) {
return a;
}
invocation Styles
| Type | Example |
|---|---|
| Static Method | Math::max(1, 2) |
| Constructor | new ArrayList() |
| Instance Method | list.add("item") |
| This-context | this.doSomething() |
Static Method
- sample
java.lang.Math::max(int:5, int:10);
output:10
- sample
java.lang.Math::pow(double:2, double:3);
output:8.0
- sample
java.lang.String::valueOf(int:123);
output:123
- sample
java.util.Objects::toString(java.lang.String:null);
output:null
- sample
java.lang.String::format(java.lang.String:"Number: %d, String: %s",int: 42, java.lang.String:"test");
output:Number: 42, String: test
- sample
java.lang.System::currentTimeMillis();
output:1754713207541
- sample
java.lang.String::join(java.lang.CharSequence:",", java.lang.CharSequence:"a",java.lang.CharSequence: "b", java.lang.CharSequence:"c");
output:a,b,c
- sample
com.github.paohaijiao.service.JService::sum(int:1,int:2);
output:3
Constructor Method
- sample
new com.github.paohaijiao.service.JService();
- sample
new com.github.paohaijiao.model.JStudent(int:42, float:3.14, boolean:true);
- sample
new com.github.paohaijiao.model.JStudent(java.lang.String:"test string");
- sample
new com.github.paohaijiao.model.JStudent(List<java.lang.Integer>:listVar);
- sample
new com.github.paohaijiao.model.JStudent(java.lang.String:"test", java.lang.Integer:123, java.lang.Boolean:true, List<java.lang.Integer>:listVar);
- sample
new java.util.ArrayList();
- sample
new com.github.paohaijiao.model.JStudent(java.lang.String:"a", java.lang.String:"b", java.lang.String:"c");
Instance Method
- sample
testObj.isEven(int:4);
output: true
- sample
testObj.noReturn();
- sample
testObj.addToList(java.util.ArrayList<java.lang.Integer>:listVar, java.lang.Integer:4);
- sample
testObj.methodWithMixedArgs(java.lang.String:"Test", int:42, boolean:true);
- sample
testObj.methodWithVarArgs(java.lang.String:"a", java.lang.String:"b", java.lang.String:"c");
output
console.log("Result: " + result);
Comments
// single-line
/*
multi-line
*/
code sample
java.lang.String def a(int:a,float:b) {
java.lang.String p=java.lang.String::format(java.lang.String:"Number: %d, String: %s",int: 42, java.lang.String:"test");
return p;
}
int c=1;
float d=8.1;
this.a(int:c,float:d);
java.util.HashMap<java.lang.String,java.lang.String> def a(int:a,float:b) {
java.lang.String str1 = new java.lang.String(java.lang.String:"Hello");
console.log(str1);
java.lang.String upperStr = str1.toUpperCase();
console.log(upperStr);
java.lang.String subStr = str1.substring(int:1, int:3);
console.log(subStr);
java.util.HashMap<java.lang.String,java.lang.String> result = new java.util.HashMap();
result.put(java.lang.String:"constructed1", java.lang.String:str1);
result.put(java.lang.String:"constructed2", java.lang.String:str1);
result.put(java.lang.String:"uppercased", java.lang.String:upperStr);
result.put(java.lang.String:"substring", java.lang.String:subStr);
return result;
}
int c=1;
float d=8.1;
this.a(int:c,float:d);
appendix
global,
short,
int,
float,
double,
long,
boolean,
byte,
new,
var,
return,
function,
null,
this,
import,
continue,
break,
as,
if,
else,
for,
while,
true,
false,
null
Identifier Rules
1.starts with letter/underscore
2.may contain letters, digits, underscores
3.case-sensitive
complete example
- sample 1
int def getSquare(int:a,int:b){
return a*b;
}
int a=1;
int b=2;
int c=this.getSquare(int:a,int:b);
- sample 2
java.util.HashMap<java.lang.String,java.lang.String> def a(int:a,float:b) {
java.lang.String str1 = new java.lang.String(java.lang.String:"Hello");
console.log(str1);
java.lang.String upperStr = str1.toUpperCase();
console.log(upperStr);
java.lang.String subStr = str1.substring(int:1, int:3);
console.log(subStr);
java.util.HashMap<java.lang.String,java.lang.String> result = new java.util.HashMap(); result.put(java.lang.String:"constructed1", java.lang.String:str1); result.put(java.lang.String:"constructed2", java.lang.String:str1);
result.put(java.lang.String:"uppercased", java.lang.String:upperStr); result.put(java.lang.String:"substring", java.lang.String:subStr);
return result;
}
int c=1;
float d=8.1;
this.a(int:c,float:d);
- sample 3
java.lang.String def a(int:a,float:b) {
java.lang.String p=java.lang.String::format(java.lang.String:"Number: %d, String: %s",int: 42, java.lang.String:"test");
return p;
}
int c=1;
float d=8.1;
this.a(int:c,float:d);
- sample 4
import java.lang.String as type1;
type1 def a(int:a,float:b) {
type1 p=type1::format(type1:"Number: %d, String: %s",int: 42, type1:"test");
return p;
}
int c=1;
float d=8.1;
this.a(int:c,float:d);
Generating Power with Love (and Caffeine) ☕
Thank you for using this open-source project! It is completely free and will be maintained continuously, but the developers do need your support.
How You Can Help
-
Buy Me a Coffee
If this project has saved you time or money, please consider supporting me with a small donation. -
Where Your Donation Goes
- Server costs to keep the project running.
- Feature development to add more value.
- Documentation optimization for a better user experience.
- Every Cent Counts
Even a donation of just 1 cent motivates me to debug late into the night!
Why Donate?
✔️ Keep the project free and ad-free forever.
✔️ Support timely responses to issues and community inquiries.
✔️ Enable planned features for the future.
Thank you for being a partner in making the open-source world better!
Additional Notes
- The project is maintained with love and caffeine.
- Your support ensures its sustainability and growth.
