UnifaceOccurrence

This constructor is used to create an occurrence for an entity with specific types of fields.

import com.compuware.uniface.*;

UnifaceOccurrence (int[]fieldTypes)

Return Values

Returns an occurrence. Throws a UnifaceException if an exception occurs.

Description

An occurrence data type, class UnifaceOccurrence, is a wrapper class around an entity data type, class UnifaceEntity, which holds one occurrence. The methods of the wrapper class guarantee that the embedded entity is always a valid occurrence (it contains one occurrence).

Constructor

The UnifaceOccurrence constructor uses the same fieldTypes parameters as UnifaceEntity, but returns an occurrence instead of an empty entity. UnifaceOccurrence also returns UnifaceException when an exception occurs.

UnifaceOccurrence (int[] fieldTypes)

The constants for field types are listed in the following table:

Field Type Constants
Constant Meaning
UTYPE_STRING Uniface string
UTYPE_BOOLEAN Uniface boolean
UTYPE_NUMERIC Uniface numeric
UTYPE_FLOAT Uniface float
UTYPE_DATE Uniface date
UTYPE_TIME Uniface time
UTYPE_DATETIME Uniface date time
UTYPE_RAW Uniface raw
UTYPE_IMAGE Uniface image

Methods

UnifaceOccurrence Methods
Method Meaning
int getNumberOfFields () Returns the number of fields in the occurrence.
int[] getFieldTypes () Returns the type of the occurrences fields.
int getFieldType (int fldNr) Returns the field type of a specific field, named in the fldNr parameter.
Object getField (int fldNr) Returns the specific field, named in the fldNr parameter, as an object.
void setField (int fldNr, Object obj) Sets the field’s data as an object, where the field is specified by the fldNr parameter.
String toString() Returns a string with the contents of the entity or single occurrence.