VariantType

Overview

This class is designed to read and write a Delphi-compatible variant type. The variant type can be used to represent a piece of data of unknown type and can hold different/changing types of data at runtime. A number of properties are defined in this class to access the data as regular Java types. The class tries to convert the data in all possible ways but if the data conversion is impossible in the particular case (e.g. a GUID can not be converted to a number) an exception with name VariantTypeException will be thrown. The similar exception is thrown in response to attempt to treat the data as an array while a single value is stored.

Location

 

constructor

Creates EmptyVariant.

 

constructor

 

VariantType()

constructor (VariantTypeCode, Object)

Creates VariantType with given type and value.

 

constructor(aDataType: VariantTypeCode; aValue: Object)

 

VariantType(VariantTypeCode aDataType, Object aValue)

Parameters:


constructor (Object)

Creates VariantType with given object.

 

constructor(aValue: Object)

 

VariantType(Object aValue)

Parameters:

  • aValue: Given object.

ArrayDataType

 

property ArrayDataType: VariantTypeCode read;

 

VariantTypeCode ArrayDataType { __get; }

ArraySize

 

property ArraySize: Integer read;

 

Integer ArraySize { __get; }

AsBoolean

 

property AsBoolean: Boolean read write;

 

Boolean AsBoolean { __get; __set; }

AsData

 

property AsData: array of SByte read write;

 

SByte[] AsData { __get; __set; }

AsDate

 

property AsDate: Date read write;

 

Date AsDate { __get; __set; }

AsDecimal

 

property AsDecimal: BigDecimal read write;

 

BigDecimal AsDecimal { __get; __set; }

AsDouble

 

property AsDouble: Double read write;

 

Double AsDouble { __get; __set; }

AsInt32

 

property AsInt32: Integer read write;

 

Integer AsInt32 { __get; __set; }

AsInt64

 

property AsInt64: Int64 read write;

 

Int64 AsInt64 { __get; __set; }

AsString

 

property AsString: String read write;

 

String AsString { __get; __set; }

AsUtfString

 

property AsUtfString: String read write;

 

String AsUtfString { __get; __set; }

AsUuid

 

property AsUuid: UUID read write;

 

UUID AsUuid { __get; __set; }

AsVariant

 

property AsVariant: VariantType read write;

 

VariantType AsVariant { __get; __set; }

DataType

 

property DataType: VariantTypeCode read;

 

VariantTypeCode DataType { __get; }

emptyVariant

Creates empty Variant.

 

class method emptyVariant: VariantType

 

static VariantType emptyVariant()

getItemAtIndex

Returns object in a specific position.

 

method getItemAtIndex(anIndex: Integer): VariantType

 

VariantType getItemAtIndex(Integer anIndex)

Parameters:

  • anIndex: Given position.

getVariantCode

 

class method getVariantCode(value: VariantTypeCode): Integer

 

static Integer getVariantCode(VariantTypeCode value)

Parameters:

  • value:

getVariantType

 

class method getVariantType(value: Integer): VariantTypeCode

 

static VariantTypeCode getVariantType(Integer value)

Parameters:

  • value:

IsEmpty

 

property IsEmpty: Boolean read;

 

Boolean IsEmpty { __get; }

IsNull

 

property IsNull: Boolean read;

 

Boolean IsNull { __get; }

nullVariant

Creates a null Variant value.

 

class method nullVariant: VariantType

 

static VariantType nullVariant()

setArrayLength

Calls to create variant array type, or increase/decrease array size.

 

method setArrayLength(aLength: Integer; aDataType: VariantTypeCode)

 

void setArrayLength(Integer aLength, VariantTypeCode aDataType)

Parameters:


setEmpty

Sets variant as empty.

 

method setEmpty

 

void setEmpty()

setItem

Sets specific object to specific index in an Variant array.

 

method setItem(anItem: VariantType; anIndex: Integer)

 

void setItem(VariantType anItem, Integer anIndex)

Parameters:

  • anItem: Given value.
  • anIndex: Given position.

setNull

Sets variant as null.

 

method setNull

 

void setNull()

Value

 

property Value: Object read;

 

Object Value { __get; }

variantWithBoolean

Creates new Variant as boolean.

 

class method variantWithBoolean(aValue: Boolean): VariantType

 

static VariantType variantWithBoolean(Boolean aValue)

Parameters:

  • aValue: Given boolean value.

variantWithString

Creates new Variant as string.

 

class method variantWithString(aValue: String): VariantType

 

static VariantType variantWithString(String aValue)

Parameters:

  • aValue: Given String value.

 

ArrayDataType

 

property ArrayDataType: VariantTypeCode read;

 

VariantTypeCode ArrayDataType { __get; }

ArraySize

 

property ArraySize: Integer read;

 

Integer ArraySize { __get; }

AsBoolean

 

property AsBoolean: Boolean read write;

 

Boolean AsBoolean { __get; __set; }

AsData

 

property AsData: array of SByte read write;

 

SByte[] AsData { __get; __set; }

AsDate

 

property AsDate: Date read write;

 

Date AsDate { __get; __set; }

AsDecimal

 

property AsDecimal: BigDecimal read write;

 

BigDecimal AsDecimal { __get; __set; }

AsDouble

 

property AsDouble: Double read write;

 

Double AsDouble { __get; __set; }

AsInt32

 

property AsInt32: Integer read write;

 

Integer AsInt32 { __get; __set; }

AsInt64

 

property AsInt64: Int64 read write;

 

Int64 AsInt64 { __get; __set; }

AsString

 

property AsString: String read write;

 

String AsString { __get; __set; }

AsUtfString

 

property AsUtfString: String read write;

 

String AsUtfString { __get; __set; }

AsUuid

 

property AsUuid: UUID read write;

 

UUID AsUuid { __get; __set; }

AsVariant

 

property AsVariant: VariantType read write;

 

VariantType AsVariant { __get; __set; }

DataType

 

property DataType: VariantTypeCode read;

 

VariantTypeCode DataType { __get; }

IsEmpty

 

property IsEmpty: Boolean read;

 

Boolean IsEmpty { __get; }

IsNull

 

property IsNull: Boolean read;

 

Boolean IsNull { __get; }

Value

 

property Value: Object read;

 

Object Value { __get; }

 

emptyVariant

Creates empty Variant.

 

class method emptyVariant: VariantType

 

static VariantType emptyVariant()

getVariantCode

 

class method getVariantCode(value: VariantTypeCode): Integer

 

static Integer getVariantCode(VariantTypeCode value)

Parameters:

  • value:

getVariantType

 

class method getVariantType(value: Integer): VariantTypeCode

 

static VariantTypeCode getVariantType(Integer value)

Parameters:

  • value:

nullVariant

Creates a null Variant value.

 

class method nullVariant: VariantType

 

static VariantType nullVariant()

variantWithBoolean

Creates new Variant as boolean.

 

class method variantWithBoolean(aValue: Boolean): VariantType

 

static VariantType variantWithBoolean(Boolean aValue)

Parameters:

  • aValue: Given boolean value.

variantWithString

Creates new Variant as string.

 

class method variantWithString(aValue: String): VariantType

 

static VariantType variantWithString(String aValue)

Parameters:

  • aValue: Given String value.

 

constructor

Creates EmptyVariant.

 

constructor

 

VariantType()

constructor (VariantTypeCode, Object)

Creates VariantType with given type and value.

 

constructor(aDataType: VariantTypeCode; aValue: Object)

 

VariantType(VariantTypeCode aDataType, Object aValue)

Parameters:


constructor (Object)

Creates VariantType with given object.

 

constructor(aValue: Object)

 

VariantType(Object aValue)

Parameters:

  • aValue: Given object.

getItemAtIndex

Returns object in a specific position.

 

method getItemAtIndex(anIndex: Integer): VariantType

 

VariantType getItemAtIndex(Integer anIndex)

Parameters:

  • anIndex: Given position.

setArrayLength

Calls to create variant array type, or increase/decrease array size.

 

method setArrayLength(aLength: Integer; aDataType: VariantTypeCode)

 

void setArrayLength(Integer aLength, VariantTypeCode aDataType)

Parameters:


setEmpty

Sets variant as empty.

 

method setEmpty

 

void setEmpty()

setItem

Sets specific object to specific index in an Variant array.

 

method setItem(anItem: VariantType; anIndex: Integer)

 

void setItem(VariantType anItem, Integer anIndex)

Parameters:

  • anItem: Given value.
  • anIndex: Given position.

setNull

Sets variant as null.

 

method setNull

 

void setNull()