Customer Service Center
Home
Knowledge Base
Contact Support
License Activation
|
Contact Support
|
License Activation
|
Spirent KB Article
Doc ID: FAQ17592
Printer Friendly
Email Article Link
TTworkbench: How do I implement the return value for an external function in Java?
Environment/Versions
TTworkbench 32/64 Bit Linux/Windows
Answer
Example:
Definition of the external function and return type
enum1
in TTCN-3 :
external function f (integer i1, integer i2) return enum1;
Where
enum1
is defined as follows:
type enumerated enum1{
success (0),
error (1),
timeout (2)
}
Definition
of the
external function in Java:
public EnumeratedValue f (IntegerValue i1, IntegerValue i2){
.....
//
1.
An instance of
enum1
is created with the
method
newTypeForNameValue
from the
abstract class
AbstractValuePlugin
,
EnumeratedValue retval = (EnumeratedValue)newTypeForNameValue("MyTTCN-3ModuleName.enum1");
//
2. The values of the enum can be set.
retval.setEnum("success");
retval.setEnum("error");
retval.setEnum("timeout");
return(retval);
}
Version
1.0
Publish Date
2017-03-22
Categories
Product : TTCN-3 Language
Related Articles