Fujitsu J Adapter Class Generator Manual de usuario Pagina 25

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 98
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 24
Chapter 3. Developing Programs 25
An example of referencing the class variable AM_PM_FIELD (static field) of the
DateFormat class is shown below:
...
REPOSITORY.
CLASS J-DateFormat AS "java-text-DateFormat"
...
WORKING-STORAGE SECTION
01 FMT-Type PIC S9(9) COMP-5.
...
PROCEDURE DIVISION.
...
MOVE JF-AM_PM_FIELD OF J-DateFormat TO FMT-Type.
...
Comparing Object References
COBOL uses "=" to check whether multiple object references point to the same
object. To check whether the Java objects pointed to by the adapter objects are the
same, COBOL uses the J-EQUALS method of the adapter class instead of "=". The
adapter class always has the J-EQUALS method.
An example of comparing two Date objects is shown below. The condition is met
when Date-1 and Date-2 point to the same Java object.
...
REPOSITORY.
CLASS J-Date AS "java-util-Date"
...
WORKING-STORAGE SECTION
01 Date-1 OBJECT REFERENCE J-Date.
01 Date-2 OBJECT REFERENCE J-Date.
01 rst PIC 1.
...
PROCEDURE DIVISION.
...
INVOKE Date-1 "J-EQUALS" USING CONTENT Date-2 RETURNING rst.
IF rst = B"1" THEN
Condition met
...
Assignment to a Subclass
COBOL uses AS to assign an object to a subclass. However, it uses the J-NARROW
method instead of AS to assign an adapter object. The adapter class always has the
J-NARROW method.
Vista de pagina 24
1 2 ... 20 21 22 23 24 25 26 27 28 29 30 ... 97 98

Comentarios a estos manuales

Sin comentarios