public class BaseUnion extends BaseField implements Union
ANY_ID, DEFAULT_ID
Constructor and Description |
---|
BaseUnion()
Constructor for a variant union (aka any type).
|
BaseUnion(String[] fieldNames,
Field[] fields)
Constructor for an union field.
|
BaseUnion(String id,
String[] fieldNames,
Field[] fields)
Constructor for an union field.
|
Modifier and Type | Method and Description |
---|---|
void |
deserialize(ByteBuffer buffer,
DeserializableControl control)
Deserialize buffer.
|
boolean |
equals(Object obj) |
Field |
getField(int fieldIndex)
Get a sub fields by index.
|
Field |
getField(String name)
Get the Field for the specified fieldName
|
int |
getFieldIndex(String name)
Get the index of the specified field.
|
String |
getFieldName(int fieldIndex)
Get the name of the subfield by index.
|
String[] |
getFieldNames()
Get the array of the subfield names.
|
Field[] |
getFields()
Get a list of union fields (members).
|
String |
getID()
Get the identification string.
|
int |
hashCode() |
boolean |
isVariant()
Check if this union is variant union (aka any type).
|
void |
serialize(ByteBuffer buffer,
SerializableControl control)
Serialize field into given buffer.
|
void |
toString(StringBuilder buf,
int indentLevel)
Convert to a string
|
public BaseUnion()
public BaseUnion(String[] fieldNames, Field[] fields)
fieldNames
- The field names for the subfieldsfields
- The array of nodes definitions for the nodes of the structure.public BaseUnion(String id, String[] fieldNames, Field[] fields)
id
- The identification string for the union.fieldNames
- The field names for the subfieldsfields
- The union fields (members).IllegalArgumentException
- if id is null or empty.public Field getField(String name)
Union
public int getFieldIndex(String name)
Union
getFieldIndex
in interface Union
name
- The name of the field.public Field getField(int fieldIndex)
Union
public String[] getFieldNames()
Union
getFieldNames
in interface Union
public String getFieldName(int fieldIndex)
Union
getFieldName
in interface Union
fieldIndex
- The field index.public Field[] getFields()
Union
public boolean isVariant()
Union
public void toString(StringBuilder buf, int indentLevel)
Field
public void serialize(ByteBuffer buffer, SerializableControl control)
Serializable
serialize
in interface Serializable
buffer
- serialization buffer.control
- flush interface.public void deserialize(ByteBuffer buffer, DeserializableControl control)
Serializable
deserialize
in interface Serializable
buffer
- serialization buffer.control
- deserialization control.Copyright © 2014. All Rights Reserved.