Package COM.activesw.api.client
Class NativeField
- java.lang.Object
-
- COM.activesw.api.client.BrokerField
-
- COM.activesw.api.client.NativeField
-
- Direct Known Subclasses:
NativeSequenceField
,NativeStruct
public class NativeField extends BrokerField
NativeField is a composite object that allows all field types- primatives, sequences, structs, and sequences of structs- to be treated uniformly so that field access algorithms can be greatly simplified.
-
-
Field Summary
Fields Modifier and Type Field Description java.lang.String
name
static short
PACK_HINT_NAME_IS_STRING8
-
Fields inherited from class COM.activesw.api.client.BrokerField
NOT_FOUND, type, value
-
-
Constructor Summary
Constructors Constructor Description NativeField()
Default constructorNativeField(java.lang.String name, short type, java.lang.Object value)
Construct a new NativeFieldNativeField(java.lang.String name, short type, java.lang.Object value, short packHints)
Construct a new NativeField
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
clearField(java.lang.String fieldName)
Clear field.protected java.lang.Object
duplicate()
boolean
elementExists(int[] indices)
Returns true if the element at the specified indices existsboolean
equals(java.lang.Object another)
Tests equality.java.lang.Object
getElements(int[] indices, int offset, int count)
Returns a one dimensional array of sequence elements starting at the specified indexshort
getElementType(int[] indices)
Returns the element type of the sequence at the specified indices.NativeField
getElementValue(int[] indices)
Returns the value of the element at the specified indicesNativeField
getField(java.lang.String fieldName)
Returns a field.int
getFieldCount()
Returns the number of fields in the struct.java.lang.String[]
getFieldNames()
Returns all field names in the struct.int
getLength(int[] indices)
Returns the length of the sequence at the specified indices.java.lang.String
getName()
Returns the field name.short
getType()
Returns the field type.java.lang.Object
getValue(short type)
Returns the value of the field.int
hashCode()
boolean
isFieldSet(java.lang.String fieldName)
Returns true if field is set.boolean
isPrimitive()
boolean
isSequence()
boolean
isStruct()
boolean
isStructOrEvent()
void
setElements(int[] indices, int srcOffset, int destOffset, int count, java.lang.Object srcArray)
Sets count elements of a sequence starting at destStart using element values obtained from the src array starting at srcStartvoid
setElementValue(int[] indices, java.lang.Object value)
Sets the value of the element at the specified indicesvoid
setField(NativeField field)
Sets a member field.void
setLength(int[] indices, int length)
Sets the length of the sequence at the specified indices.void
setValue(java.lang.Object value, short type)
Sets the value of the field
-
-
-
Field Detail
-
PACK_HINT_NAME_IS_STRING8
public static final short PACK_HINT_NAME_IS_STRING8
- See Also:
- Constant Field Values
-
name
public java.lang.String name
-
-
Constructor Detail
-
NativeField
public NativeField()
Default constructor
-
NativeField
public NativeField(java.lang.String name, short type, java.lang.Object value)
Construct a new NativeField
-
NativeField
public NativeField(java.lang.String name, short type, java.lang.Object value, short packHints)
Construct a new NativeField
-
-
Method Detail
-
equals
public boolean equals(java.lang.Object another)
Tests equality. Two NativeFields are equal if they share the same name. It is only intended to be used during field lookup in a field container.- Overrides:
equals
in classjava.lang.Object
- Parameters:
another
- - object to test against- Returns:
- boolean
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
getName
public java.lang.String getName()
Returns the field name.- Returns:
- the field name
-
getType
public short getType()
Returns the field type. See BrokerTypeDef.FIELD_TYPE_XXXX constants for allowable values.- Returns:
- short
- See Also:
BrokerTypeDef
-
getValue
public java.lang.Object getValue(short type) throws BrokerException
Returns the value of the field.- Parameters:
type
- requested field type- Returns:
- the field's value
- Throws:
BrokerFieldTypeMismatchException
- if value type does not match typeBrokerException
-
setValue
public void setValue(java.lang.Object value, short type) throws BrokerException
Sets the value of the field- Parameters:
type
- the value typevalue
- the new field value- Throws:
BrokerException
-
isPrimitive
public boolean isPrimitive()
-
isStruct
public boolean isStruct()
-
isStructOrEvent
public boolean isStructOrEvent()
-
isSequence
public boolean isSequence()
-
elementExists
public boolean elementExists(int[] indices) throws BrokerException
Returns true if the element at the specified indices exists- Parameters:
indices
- the indices of the element to test- Returns:
- true if element exists
- Throws:
BrokerFieldTypeMismatchException
- if field is not a sequenceBrokerException
-
getElements
public java.lang.Object getElements(int[] indices, int offset, int count) throws BrokerException
Returns a one dimensional array of sequence elements starting at the specified index- Parameters:
indices
- the indices of the sequence element whose values will be returnedoffset
- the index of the first elementcount
- the number of elements to return- Returns:
- a one dimensional array of elements
- Throws:
BrokerFieldTypeMismatchException
- if field is not a sequenceBrokerException
-
getElementValue
public NativeField getElementValue(int[] indices) throws BrokerException
Returns the value of the element at the specified indices- Parameters:
indices
- the indices of the element whose value will be returned- Returns:
- the element value
- Throws:
BrokerFieldTypeMismatchException
- if field is not a sequenceBrokerException
-
getElementType
public short getElementType(int[] indices) throws BrokerException
Returns the element type of the sequence at the specified indices. One dimensional sequences should pass null for indices.- Parameters:
indices
- the indices of the sequence whose length will be returned- Returns:
- the length of the sequence
- Throws:
BrokerFieldTypeMismatchException
- if field is not a sequenceBrokerException
-
getLength
public int getLength(int[] indices) throws BrokerException
Returns the length of the sequence at the specified indices. One dimensional sequences should pass null for indices.- Parameters:
indices
- the indices of the sequence whose length will be returned- Returns:
- the length of the sequence
- Throws:
BrokerFieldTypeMismatchException
- if field is not a sequenceBrokerException
-
setElements
public void setElements(int[] indices, int srcOffset, int destOffset, int count, java.lang.Object srcArray) throws BrokerException
Sets count elements of a sequence starting at destStart using element values obtained from the src array starting at srcStart- Parameters:
indices
- the indices of the sequence element whose values will be returnedsrcOffset
- starting index of source arraydestOffset
- starting index of destination sequencecount
- the number of elements to returnsrcArray
- the source array of elements- Throws:
BrokerFieldTypeMismatchException
- if field is not a sequenceBrokerException
-
setElementValue
public void setElementValue(int[] indices, java.lang.Object value) throws BrokerException
Sets the value of the element at the specified indices- Parameters:
indices
- the indices of the element to setvalue
- the value of the element- Throws:
BrokerFieldTypeMismatchException
- if field is not a sequenceBrokerException
-
setLength
public void setLength(int[] indices, int length) throws BrokerException
Sets the length of the sequence at the specified indices. To set the length of a one dimensional sequence pass null for indices.- Parameters:
indices
- the indices of the sequence whose length will be set- Throws:
BrokerFieldTypeMismatchException
- if field is not a sequenceBrokerException
-
clearField
public boolean clearField(java.lang.String fieldName) throws BrokerException
Clear field.- Parameters:
fieldName
-- Returns:
- false if field was not set
- Throws:
BrokerFieldTypeMismatchException
- if field is not a structBrokerException
-
getField
public NativeField getField(java.lang.String fieldName) throws BrokerException
Returns a field.- Parameters:
fieldName
- the name of the field- Throws:
BrokerFieldTypeMismatchException
- if field is not a structBrokerException
-
getFieldCount
public int getFieldCount() throws BrokerException
Returns the number of fields in the struct.- Throws:
BrokerFieldTypeMismatchException
- if field is not a structBrokerException
-
getFieldNames
public java.lang.String[] getFieldNames() throws BrokerException
Returns all field names in the struct.- Throws:
BrokerFieldTypeMismatchException
- if field is not a structBrokerException
-
isFieldSet
public boolean isFieldSet(java.lang.String fieldName) throws BrokerException
Returns true if field is set.- Parameters:
fieldName
- the name of the field- Throws:
BrokerFieldTypeMismatchException
- if field is not a structBrokerException
-
setField
public void setField(NativeField field) throws BrokerException
Sets a member field.- Parameters:
field
- the field to set- Throws:
BrokerFieldTypeMismatchException
- if field is not a structBrokerException
-
duplicate
protected java.lang.Object duplicate() throws BrokerException
- Throws:
BrokerException
-
-