Package org.epics.pvdata.factory
Class BasePVUnion
- java.lang.Object
-
- org.epics.pvdata.factory.AbstractPVField
-
- org.epics.pvdata.factory.BasePVUnion
-
- All Implemented Interfaces:
PVField,PVUnion,Serializable
public class BasePVUnion extends AbstractPVField implements PVUnion
Base class for a PVUnion.- Author:
- mse
-
-
Field Summary
-
Fields inherited from class org.epics.pvdata.factory.AbstractPVField
convert
-
Fields inherited from interface org.epics.pvdata.pv.PVUnion
UNDEFINED_INDEX
-
-
Constructor Summary
Constructors Constructor Description BasePVUnion(Union union)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddeserialize(ByteBuffer buffer, DeserializableControl control)Deserialize buffer.booleanequals(Object obj)PVFieldget()Get thePVFieldvalue stored in the field.<T extends PVField>
Tget(Class<T> c)Get thePVFieldvalue stored in the field.StringgetSelectedFieldName()Get selected field name.intgetSelectedIndex()Get selected field index.UniongetUnion()Get the union introspection interface.inthashCode()PVFieldselect(int index)Select field (set index) and get the field at the index.<T extends PVField>
Tselect(Class<T> c, int index)Select field (set index) and get the field at the index.<T extends PVField>
Tselect(Class<T> c, String fieldName)Select field (set index) and get the field by given name.PVFieldselect(String fieldName)Select field (set index) and get the field by given name.voidserialize(ByteBuffer buffer, SerializableControl flusher)Serialize field into given buffer.voidset(int index, PVField value)Set thePVField(by reference!) as field at given index.voidset(String fieldName, PVField value)Set thePVField(by reference!) as field by given name.voidset(PVField value)Set thePVField(by reference!) as selected field.-
Methods inherited from class org.epics.pvdata.factory.AbstractPVField
changeField, getField, getFieldName, getFieldOffset, getFullName, getNextFieldOffset, getNumberFields, getParent, isImmutable, postPut, setData, setImmutable, setPostHandler, toString, toString, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.epics.pvdata.pv.PVField
getField, getFieldName, getFieldOffset, getFullName, getNextFieldOffset, getNumberFields, getParent, isImmutable, postPut, setImmutable, setPostHandler, toString, toString, toString
-
-
-
-
Constructor Detail
-
BasePVUnion
public BasePVUnion(Union union)
Constructor.- Parameters:
union- the reflection interface for the PVUnion data.
-
-
Method Detail
-
getUnion
public Union getUnion()
Description copied from interface:PVUnionGet the union introspection interface.
-
get
public PVField get()
Description copied from interface:PVUnionGet thePVFieldvalue stored in the field.
-
get
public <T extends PVField> T get(Class<T> c)
Description copied from interface:PVUnionGet thePVFieldvalue stored in the field.
-
getSelectedIndex
public int getSelectedIndex()
Description copied from interface:PVUnionGet selected field index.- Specified by:
getSelectedIndexin interfacePVUnion- Returns:
- selected field index
-
getSelectedFieldName
public String getSelectedFieldName()
Description copied from interface:PVUnionGet selected field name.- Specified by:
getSelectedFieldNamein interfacePVUnion- Returns:
- selected field name
-
select
public PVField select(int index)
Description copied from interface:PVUnionSelect field (set index) and get the field at the index.
-
select
public PVField select(String fieldName)
Description copied from interface:PVUnionSelect field (set index) and get the field by given name.
-
select
public <T extends PVField> T select(Class<T> c, int index)
Description copied from interface:PVUnionSelect field (set index) and get the field at the index.- Specified by:
selectin interfacePVUnion- Type Parameters:
T- the expected type of the PVField of the requested field- Parameters:
c- class object modeling the class T of expected type of the requested fieldindex- index of the field to select.- Returns:
- corresponding PVField (of undetermined value),
nullifindex == UNDEFINED_INDEX
-
select
public <T extends PVField> T select(Class<T> c, String fieldName)
Description copied from interface:PVUnionSelect field (set index) and get the field by given name.- Specified by:
selectin interfacePVUnion- Type Parameters:
T- the expected type of the PVField of the requested field- Parameters:
c- class object modeling the class T of expected type of the requested fieldfieldName- the name of the field to select- Returns:
- corresponding PVField (of undetermined value)
-
set
public void set(PVField value)
Description copied from interface:PVUnionSet thePVField(by reference!) as selected field.
-
set
public void set(int index, PVField value)Description copied from interface:PVUnionSet thePVField(by reference!) as field at given index. If a value is not a valid union field anIllegalArgumentExceptionexception is thrown. Useselect(int)to put by value.- Specified by:
setin interfacePVUnion- Parameters:
index- index of a field to put.value- the field to set.- See Also:
PVUnion.select(int)
-
set
public void set(String fieldName, PVField value)
Description copied from interface:PVUnionSet thePVField(by reference!) as field by given name. If a value is not a valid union field anIllegalArgumentExceptionexception is thrown. Useselect(String)to put by value.- Specified by:
setin interfacePVUnion- Parameters:
fieldName- Name of the field to putvalue- the field to set- See Also:
PVUnion.select(String)
-
serialize
public void serialize(ByteBuffer buffer, SerializableControl flusher)
Description copied from interface:SerializableSerialize field into given buffer.- Specified by:
serializein interfaceSerializable- Parameters:
buffer- the serialization bufferflusher- 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
-
-