Mappings in Generated Java Files

In the Java files generated by Uniface, the mappings between Java classes, methods, and parameters and Uniface components, operations, and parameters are based on definitions defined for the Java call-in component implementation.

If the Java call-in implementation does not specify any mappings, Uniface generates default mappings based on the Uniface component implementation.

Converting Names

Java names are case-sensitive, but Uniface names are not. According to Java conventions, the class name starts with an uppercase letter, and variable and method names start with a lowercase letter. When generating Java classes, the following rules are applied:

  • If a customized mapping is provided in the Java call-in implementation, the specified names are used. Otherwise, names are derived from the Uniface component implementation.
  • Underscores are removed from Uniface names.
  • Uppercase is used for the first letter of component names and for the first letter after an underscore
  • Lowercase is used for everything else
Examples of Default Name Mappings
  Uniface Name Java Name
Component Name MY_COMP

MYCOMP

MyComp

Mycomp

Operation Name MY_OPER

MYOPER

myOper

myoper

Parameter Name PARAM_ONE

PARAMONE

paramOne

paramone

If a name derived from a component, operation, or parameter is a keyword in Java, or is one of the Uniface data type classes, an underscore is added to the beginning of a name. For more information, see Uniface and Java Reserved Words.

Classes for Components

Each Uniface component is mapped to a Java class that extends the UnifaceComponent base class in the Uniface Java Call-in API. By default, the corresponding generated Java class is defined as follows and is visible outside the package:

public class MySvc extends UnifaceComponent

Methods for Operations

Each operation in the signature is mapped to a Java method that uses the activate API. For example, the following Java code is generated for the QUIT operation:

/** Operation quit. */
public int quit ()
  throws UnifaceException {
    Object params[] = new Object[1];
  int status = activate ("quit", params);
return status;
}

For more information, see UnifaceComponent

Parameters

Uniface operation parameters can have a data type, which may be a basic (scalar) data type, entity, or occurrence.

Java has no real support for IN parameters, so holder classes are used to support them. These classes are contained in the ujci20.jar file in the \bin directory of your Uniface installation. Data type conversions are handled by Uniface and the Uniface*.class files included in the ujci20.jar file. For more information, see Data Type Mapping Between Uniface and Java.

Avoid passing OUT parameters through holder classes when possible. Passing one OUT value as a return value is preferable, but is possible if there is only one OUT or INOUT parameter in the operation.

If the information of the Uniface component implementation is used, and there is only one OUT or INOUT parameter, the Java code generator automatically selects this parameter as the return value in the generated Java source files.

The table shows a list of classes for IN and OUT parameters:

Data Types for IN and OUT Parameters
IN Data Type OUT Data Type
boolean BooleanHolder
Boolean _BooleanHolder
byte ByteHolder
Byte _ByteHolder
byte[] UnifaceRawHolder
char CharHolder
Character CharacterHolder
double DoubleHolder
Double _DoubleHolder
float FloatHolder
Float _FloatHolder
int IntHolder
Integer IntegerHolder
Image ImageHolder
long LongHolder
Long _LongHolder
short ShortHolder
Short _ShortHolder
String

StringHolder

UnifaceDateTime

UnifaceDateTimeHolder
UnifaceEntity UnifaceEntityHolder
UnifaceOccurrence UnifaceOccurrenceHolder