CALLSTATICtypeMETHOD Method

Invokes an instance method on a Java object from a static Java method.
Category: Method reference
Applies to: Java object

Syntax

Arguments

object
specifies the name of the Java object.
type
specifies the result type for the static Java method. The type can be one of the following values:
BOOLEAN
specifies that the result type is BOOLEAN.
BYTE
specifies that the result type is BYTE.
CHAR
specifies that the result type is CHAR.
DOUBLE
specifies that the result type is DOUBLE.
FLOAT
specifies that the result type is FLOAT.
INT
specifies that the result type is INT.
LONG
specifies that the result type is LONG.
SHORT
specifies that the result type is SHORT.
STRING
specifies that the result type is STRING.
VOID
specifies that the result type is VOID.
See:Type Issues in SAS Language Reference: Concepts
method-name
specifies the name of the static Java method.
Requirement:The method name must be enclosed in either single or double quotation marks.
method-argument
specifies the parameters to pass to the method.
return-value
specifies the return value if the method returns one.

Details

Once you instantiate a Java object, you can access any static Java method through method calls on the Java object by using the CALLSTATICtypeMETHOD method.
Note: The type argument represents a Java data type. For more information about how Java data types relate to SAS data types, see Type Issues in SAS Language Reference: Concepts.

Comparisons

Use the CALLSTATICtypeMETHOD method for static Java methods. If the Java method is not static, use the CALLtypeMETHOD method.

Example: Setting and Retrieving Static Fields

The following example creates a simple class that contains three static fields. The Java object j is instantiated, and then the field values are set and retrieved using the CALLSTATICtypeFIELD method.
/* Java code */
import java.util.*;
import java.lang.*;
public class ttestc
{
   public static double d;
   public static double dm()
   {
      return d;
   }
/* DATA step code */
data x;
   declare javaobj j("ttestc");
   length d 8;
   j.SetStaticDoubleField("d", 3.14159);
   j.callStaticDoubleMethod("dm", d);
   put d=;
run;
The following line is written to the SAS log:
d=3.14159

See Also