sysLib.javaSetField

The system function sysLib.javaSetField sets the value of a field in a native Java object or class. sysLib.javaSetField is one of several Java access functions.


sysLib.javaSetField syntax diagram

identifierOrClass

This argument is one of the following entities:

  • An identifier that refers to an object in the object space; or

  • 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. If you are specifying an identifier of an object, 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.

field

The name of the field to change.

This argument is either a string literal or an item of type CHAR, DBCHAR, MBCHAR, or UNICODE. Single- and double-byte blanks are stripped from the beginning and end of the string, which is case sensitive.

value

The value itself.

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 assign a short to a field that is declared as an int.

An example is as follows:

  sysLib.javaSetField( (objID)"myId", "myField", 
    (short)myNumItem );

An error during processing of sysLib.javaSetField 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
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
00001009 An identifier rather than a class name must be specified; the method or field is not static

Related concepts
Java access functions
Syntax diagram

Related reference
Java access (system words)
sysLib.java
sysLib.javaGetField
sysLib.javaIsNull
sysLib.javaIsObjID
sysLib.javaRemove
sysLib.javaRemoveAll
sysLib.javaStore
sysLib.javaStoreCopy
sysLib.javaStoreField
sysLib.javaStoreNew
sysLib.javaType