ConstructorArg Class

ConstructorArg Class

This Package | All Packages

public class ConstructorArg

Represents objects that are returned by the classes that implement the IConstructable.getConstructorArgs method. This encapsulates an (Object value, Class type) pair that can be used as an argument for a constructor. This class is primarily used by controls to persist the object at design time.

Constructors
Name Description
ConstructorArg(Object value, Class type) Creates a ConstructorArg object.

Methods
Name Description
getType() Retrieves the type of the ConstrutorArg object.
getValue() Retrieves the value of the ConstrutorArg object.

Constructors

ConstructorArg.ConstructorArg

Syntax
public ConstructorArg( Object value, Class type );
Parameters
value
The value expressed (cast) as the appropriate class object. For example,
Integer(entry.weight)

.

type
The class pertaining to the type. For example,
Integer.TYPE

.

Description

Creates a ConstructorArg object. The following code sample demonstrates creating a ConstructorArg array for a Point object.


    public ConstructorArg[] getConstructorArgs() {
      return new ConstructorArg[] {
        new ConstructorArg(new Integer(x), Integer.TYPE),
        new ConstructorArg(new Integer(y), Integer.TYPE)
      };

Methods

ConstructorArg.getType

Syntax
public Class getType();
Description

Retrieves the type of the ConstrutorArg object. This is a class, such as Integer or Boolean.

ConstructorArg.getValue

Syntax
public Object getValue();
Description

Retrieves the value of the ConstrutorArg object.