storeField()

The system function JavaLib.storeField places the value of a class field or object field into the EGL Java™ object space. If the identifier used to store the object is already in the object space, the action is equivalent to the following steps:

If the class or object field contains a Java primitive instead of an object, EGL stores an object that represents the primitive; for example, if the field contains an int, EGL stores an object of type java.lang.Integer.

  JavaLib.storeField(
    storeId javaObjId in,
    identifierOrClass javaObjIdOrClass in,
    field STRING in)
storeId
The identifier to store with the 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.

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. If you intend to specify a static field in the next argument, it is recommended that you specify a class in this argument.

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 that refers to an object.

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.

An example is as follows:
  JavaLib.storeField( (objId)"myStoreId", 
    (objId)"myId", "myField");

An error during processing of JavaLib.storeField 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
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
Syntax diagram for EGL functions

Related reference
EGL library JavaLib
getField()
invoke()
isNull()
isObjID()
qualifiedTypeName()
remove()
removeAll()
setField()
store()
storeCopy()
storeNew()

Related tasks
Syntax diagram for EGL statements and commands

Feedback
(C) Copyright IBM Corporation 2000, 2005. All Rights Reserved.