Author: Timo Laitinen
Date: 2004-10-19
Contents
1. What are Limited Java Expressions?
2. What expressions are available?
3. Limited nesting capabilities
1. What are Limited Java Expressions?
The term Limited Java Expressions refers to that subset of Java expressions that is supported by the JIC Language. LJ expressions are used in the attributes action
and instance
.
LJ expressions are used because:
- The method or constructor to be invoked was best expressed with a Java-expression. Some kind of reflection-based Java-code-parser was needed.
- However, JICE is not intended to be a Java scripting engine. The JIC-files must not contain too complex Java-code fragments - the actual code belongs to the Java classes, not into JIC files.
- A full-featured Java parser would probably have been more resource-intensive than a simple parser that needs to parse only a few kinds of expressions.
Therefore JICE supports only a very limited set of Java expressions. That is enough and more is not needed.
2. What expressions are available?
A LJ expression can be:
- an atom
- a boolean:
true
orfalse
- a String, enclosed within single quotes:
'Hello World'
- a number:
- an int:
12344
- a double:
123.44
(or123.44d
or123.44D
) - a long:
12344l
(or12344L
) - a float:
123.44f
(or123.44F
)
- an int:
- a variable:
myVariable1
,yourVariable2
, etc.
- a boolean:
- a 'new' operation:
new full.package.name.ClassName(parameters)
, where parameters is a comma-separated list of atoms. - a method call
- a static method call:
full.package.name.ClassName.methodName(parameters)
, where parameters is a comma-separated list of atoms.-
java.lang.Integer.parseInt(1234)
-
java.util.Calendar.getInstance(locale, timeZone)
-
- a method call:
actor.methodName(parameters)
, where actor is a variable that specifies the instance whose method is called, and parameters is a comma separated list of atoms.-
map.put('key', 'value')
-
object.toString()
-
- a static method call:
3. Limited nesting capabilities
Especially the nesting is very limited: the composite expressions (method call and 'new'-operation) may contain only atoms, not other composite expressions!