Package COM.activesw.api.client
Class NativeStruct
- java.lang.Object
-
- COM.activesw.api.client.BrokerField
-
- COM.activesw.api.client.NativeField
-
- COM.activesw.api.client.NativeStruct
-
public class NativeStruct extends NativeField
Native Java implementation of a struct field value
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.LinkedList
fieldList
protected java.util.HashMap
fieldMap
-
Fields inherited from class COM.activesw.api.client.NativeField
name, PACK_HINT_NAME_IS_STRING8
-
Fields inherited from class COM.activesw.api.client.BrokerField
NOT_FOUND, type, value
-
-
Constructor Summary
Constructors Constructor Description NativeStruct()
Construct a new struct fieldNativeStruct(int memberCount)
Construct a new struct fieldNativeStruct(java.lang.String name)
Construct a new struct fieldNativeStruct(java.lang.String name, int memberCount, short packHints)
Construct a new struct fieldNativeStruct(java.lang.String name, short packHints)
Construct a new struct field
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
boolean
clearField(java.lang.String fieldName)
Clear field.protected java.lang.Object
duplicate()
boolean
equals(java.lang.Object another)
Tests equality.NativeField
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.NativeFieldIterator
getIterator()
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.void
renameField(java.lang.String oldName, java.lang.String newName)
Renames a member field.void
setField(NativeField field)
Sets a member field.void
validate(BrokerTypeDef def)
-
Methods inherited from class COM.activesw.api.client.NativeField
elementExists, getElements, getElementType, getElementValue, getLength, getName, getType, isPrimitive, isSequence, isStruct, isStructOrEvent, setElements, setElementValue, setLength, setValue
-
-
-
-
Constructor Detail
-
NativeStruct
public NativeStruct()
Construct a new struct field
-
NativeStruct
public NativeStruct(int memberCount)
Construct a new struct field- Parameters:
memberCount
- - the default number of members
-
NativeStruct
public NativeStruct(java.lang.String name)
Construct a new struct field- Parameters:
name
- - the name of the struct field
-
NativeStruct
public NativeStruct(java.lang.String name, short packHints)
Construct a new struct field- Parameters:
name
- - the name of the struct field
-
NativeStruct
public NativeStruct(java.lang.String name, int memberCount, short packHints)
Construct a new struct field- Parameters:
memberCount
- - the default number of membersname
- - the name of the struct field
-
-
Method Detail
-
clearField
public boolean clearField(java.lang.String fieldName) throws BrokerException
Clear field.- Overrides:
clearField
in classNativeField
- Parameters:
fieldName
- the name of the field to clear- Returns:
- false if field was not set
- Throws:
BrokerException
BrokerFieldTypeMismatchException
- if field is not a struct
-
getField
public NativeField getField(java.lang.String fieldName) throws BrokerException
Returns a field.- Overrides:
getField
in classNativeField
- Parameters:
fieldName
- the name of the field to get- Returns:
- null if field was not found
- Throws:
BrokerFieldTypeMismatchException
- if field is not a structBrokerException
-
getFieldCount
public int getFieldCount() throws BrokerException
Returns the number of fields in the struct.- Overrides:
getFieldCount
in classNativeField
- Throws:
BrokerFieldTypeMismatchException
- if field is not a structBrokerException
-
getFieldNames
public java.lang.String[] getFieldNames() throws BrokerException
Returns all field names in the struct.- Overrides:
getFieldNames
in classNativeField
- Throws:
BrokerFieldTypeMismatchException
- if field is not a structBrokerException
-
getValue
public java.lang.Object getValue(short type) throws BrokerException
Returns the value of the field.- Overrides:
getValue
in classNativeField
- Parameters:
type
- requested field type- Returns:
- the field's value
- Throws:
BrokerFieldTypeMismatchException
- if value type does not match typeBrokerFieldTypeMismatchException
- if value type does not match typeBrokerException
-
isFieldSet
public boolean isFieldSet(java.lang.String fieldName) throws BrokerException
Returns true if field is set.- Overrides:
isFieldSet
in classNativeField
- Parameters:
fieldName
- the name of the field to test- Throws:
BrokerFieldTypeMismatchException
- if field is not a structBrokerException
-
setField
public void setField(NativeField field) throws BrokerException
Sets a member field.- Overrides:
setField
in classNativeField
- Parameters:
field
- the name of the field to set- Throws:
BrokerFieldTypeMismatchException
- if field is not a structBrokerException
-
renameField
public void renameField(java.lang.String oldName, java.lang.String newName) throws BrokerException
Renames a member field.- Parameters:
oldName
- the old name of the field to setnewName
- the new name of the field to set if field is not a struct- Throws:
BrokerException
-
getIterator
public NativeFieldIterator getIterator()
-
clear
public void clear()
-
duplicate
protected java.lang.Object duplicate() throws BrokerException
- Overrides:
duplicate
in classNativeField
- Throws:
BrokerException
-
validate
public void validate(BrokerTypeDef def) throws BrokerException
- Throws:
BrokerException
-
equals
public boolean equals(java.lang.Object another)
Description copied from class:NativeField
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 classNativeField
- Parameters:
another
- - object to test against- Returns:
- boolean
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classNativeField
-
-