Package org.epics.pvdata.factory
Class BaseStructure
- java.lang.Object
-
- org.epics.pvdata.factory.BaseField
-
- org.epics.pvdata.factory.BaseStructure
-
- All Implemented Interfaces:
Field,Serializable,Structure
public class BaseStructure extends BaseField implements Structure
Base interface for a Structure. It is also a complete implementation.- Author:
- mrk
-
-
Field Summary
-
Fields inherited from interface org.epics.pvdata.pv.Structure
DEFAULT_ID
-
-
Constructor Summary
Constructors Constructor Description BaseStructure(String[] fieldNames, Field[] fields)Constructor for a structure field.BaseStructure(String id, String[] fieldNames, Field[] fields)Constructor for a structure field.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddeserialize(ByteBuffer buffer, DeserializableControl control)Deserialize buffer.booleanequals(Object obj)FieldgetField(int fieldIndex)Get a sub fields by index.<T extends Field>
TgetField(Class<T> c, int fieldOffset)Get a subfield by index.<T extends Field>
TgetField(Class<T> c, String fieldName)Get the Field for the specified fieldNameFieldgetField(String name)Get the Field for the specified fieldNameintgetFieldIndex(String name)Get the index of the specified field.StringgetFieldName(int fieldIndex)Get the name of the subfield by index.String[]getFieldNames()Get the array of the subfield names.Field[]getFields()Get all the subfields of the structure.StringgetID()Get the identification string.inthashCode()voidserialize(ByteBuffer buffer, SerializableControl control)Serialize field into given buffer.voidtoString(StringBuilder buf, int indentLevel)Convert to a string
-
-
-
Constructor Detail
-
BaseStructure
public BaseStructure(String[] fieldNames, Field[] fields)
Constructor for a structure field.- Parameters:
fieldNames- The field names for the subfieldsfields- The array of nodes definitions for the nodes of the structure.
-
BaseStructure
public BaseStructure(String id, String[] fieldNames, Field[] fields)
Constructor for a structure field.- Parameters:
id- The identification string for the structure.fieldNames- The field names for the subfieldsfields- The array of nodes definitions for the nodes of the structure.- Throws:
IllegalArgumentException- if id is null or empty.
-
-
Method Detail
-
getField
public Field getField(String name)
Description copied from interface:StructureGet the Field for the specified fieldName
-
getFieldIndex
public int getFieldIndex(String name)
Description copied from interface:StructureGet the index of the specified field.- Specified by:
getFieldIndexin interfaceStructure- Parameters:
name- the name of the field- Returns:
- the index or -1 if fieldName is not a field in the structure
-
getField
public Field getField(int fieldIndex)
Description copied from interface:StructureGet a sub fields by index.
-
getField
public <T extends Field> T getField(Class<T> c, String fieldName)
Description copied from interface:StructureGet the Field for the specified fieldName- Specified by:
getFieldin interfaceStructure- Type Parameters:
T- the expected type of the Field of the requested field- Parameters:
c- class object modeling the class T of expected type of the requested fieldfieldName- the fieldName- Returns:
- The Field or null if the field does not exist, or the field is not of type
T
-
getField
public <T extends Field> T getField(Class<T> c, int fieldOffset)
Description copied from interface:StructureGet a subfield by index.- Specified by:
getFieldin interfaceStructure- Type Parameters:
T- the expected type of the Field of the requested field- Parameters:
c- class object modeling the class T of expected type of the requested fieldfieldOffset- the index- Returns:
- the Field or null if the field does not exist, or the field is not of type
T
-
getFieldNames
public String[] getFieldNames()
Description copied from interface:StructureGet the array of the subfield names.- Specified by:
getFieldNamesin interfaceStructure- Returns:
- the array
-
getFieldName
public String getFieldName(int fieldIndex)
Description copied from interface:StructureGet the name of the subfield by index.- Specified by:
getFieldNamein interfaceStructure- Parameters:
fieldIndex- the field index- Returns:
- the name of the field
-
getFields
public Field[] getFields()
Description copied from interface:StructureGet all the subfields of the structure.
-
toString
public void toString(StringBuilder buf, int indentLevel)
Description copied from interface:FieldConvert to a string
-
serialize
public void serialize(ByteBuffer buffer, SerializableControl control)
Description copied from interface:SerializableSerialize field into given buffer.- Specified by:
serializein interfaceSerializable- Parameters:
buffer- the serialization buffercontrol- the flush interface
-
deserialize
public void deserialize(ByteBuffer buffer, DeserializableControl control)
Description copied from interface:SerializableDeserialize buffer.- Specified by:
deserializein interfaceSerializable- Parameters:
buffer- the serialization buffercontrol- the deserialization control
-
-