sysLib.javaStoreNew
The system function sysLib.javaStoreNew invokes the constructor of a class and places the new object into the EGL Java object space. If the identifier is already in the object space, the action is equivalent to the following steps:
- Running sysLib.javaRemove on the identifier to remove the object previously associated with the identifier
- Relating the new object with the identifier
sysLib.javaStoreNew is one of several Java access functions.
- storeId
- The identifier to store with the new object.
This argument is either a string literal or an item of type CHAR, DBCHAR, MBCHAR, or UNICODE. The identifier must be cast to objID, as in a later example. EGL strips single- and double-byte blanks from the beginning and end of the argument value, which is case sensitive.
- class
The fully qualified name of a Java class.
This argument is either a string literal or an item of type CHAR, DBCHAR, MBCHAR, or UNICODE. EGL strips single- and double-byte blanks from the beginning and end of the argument value, which is case sensitive.
- argument
- A value passed to the constructor.
A cast may be required, as specified in Java access (system words).
The Java type-conversion rules are in effect. No error occurs, for example, if you pass a short to a constructor parameter that is declared as an int.
To avoid losing precision, use an EGL float item for a Java double, and an EGL smallfloat item for a Java float. Using one of the other EGL types will probably result in a value being rounded.
The memory area in the invoking program does not change regardless of what the constructor does.
An example is as follows:
sysLib.javaStoreNew( (objId)"storeId", "myClass", 36 );An error during processing of sysLib.javaStoreNew can set sysVar.errorCode to a value listed in the next table.
Value in sysVar.errorCode Description 00001000 An exception was thrown by an invoked method or as a result of a class initialization 00001001 The object was null, or the specified identifier was not in the object space 00001002 A public method, field, or class with the specified name does not exist or cannot be loaded 00001003 The EGL primitive type does not match the type expected in Java 00001006 The class of an argument cast to null could not be loaded 00001007 A SecurityException or IllegalAccessException was thrown during an attempt to get information about a method or field; or an attempt was made to set the value of a field that was declared final 00001008 The constructor cannot be called; the class name refers to an interface or abstract class
Related concepts
Java access functions
Related tasks
Syntax diagram
Related reference
Java access (system words)
sysLib.java
sysLib.javaGetField
sysLib.javaIsNull
sysLib.javaIsObjID
sysLib.javaRemove
sysLib.javaRemoveAll
sysLib.javaSetField
sysLib.javaStore
sysLib.javaStoreCopy
sysLib.javaStoreField
sysLib.javaType