Previous Page | Next Page

Java Object Language Elements

SETSTATICtypeFIELD Method



Modifies the value of a static field for a java object.
Category: Field reference

Syntax
Arguments
Details
Comparisons
Example
See Also

Syntax

object.SETSTATICtypeFIELD("field-name", value);


Arguments

object

specifies the name of a java object.

type

specifies the type for the Java field. The type can be one of the following values:

BOOLEAN

specifies that the field type is BOOLEAN.

BYTE

specifies that the field type is BYTE.

CHAR

specifies that the field type is CHAR.

DOUBLE

specifies that the field type is DOUBLE.

FLOAT

specifies that the field type is FLOAT.

INT

specifies that the field type is INT.

LONG

specifies that the field type is LONG.

SHORT

specifies that the field type is SHORT.

STRING

specifies that the field type is STRING.

See Also: Type Issues in SAS Language Reference: Concepts
field-name

specifies the Java field name.

Requirement: The field name must be enclosed in either single or double quotation marks.
value

specifies the value.


Details

Once you instantiate a java object, you can access and modify its public fields through method calls on the java object. The SETSTATICtypeFIELD method enables you to modify static fields.

Note:   type 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.  [cautionend]


Comparisons

The SETSTATICtypeFIELD method modifies the value of a static field for a java object. To modify the value of a non-static field, use the SETtypeFIELD method.


Example

The following example creates a simple class that contains three static fields. The java object j is instantiated, the field values are set by using the SETSTATICtypeFIELD method and then retrieved.

/* 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.callSetStaticDoubleField("d", 3.14159);
   j.callStaticDoubleMethod("dm", d);
   put d=;
run;

The following line is written to the SAS log:

d=3.14159


See Also

Method:

GETSTATICtypeFIELD Method

SETtypeFIELD Method

Previous Page | Next Page | Top of Page