- java.lang.Object
-
- de.haumacher.msgbuf.data.AbstractDataObject
-
- de.haumacher.msgbuf.graph.cmd.Command
-
- de.haumacher.msgbuf.graph.cmd.ListUpdate
-
- de.haumacher.msgbuf.graph.cmd.InsertElement
-
- All Implemented Interfaces:
BinaryDataObject,DataObject,ReflectiveDataObject,Observable
public class InsertElement extends ListUpdate
An insert operation to a list value.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class de.haumacher.msgbuf.graph.cmd.ListUpdate
ListUpdate.Visitor<R,A,E extends Throwable>
-
Nested classes/interfaces inherited from class de.haumacher.msgbuf.graph.cmd.Command
Command.TypeKind
-
-
Field Summary
Fields Modifier and Type Field Description static StringELEMENTstatic StringINSERT_ELEMENT__TYPEIdentifier for theInsertElementtype in JSON format.static intINSERT_ELEMENT__TYPE_IDIdentifier for theInsertElementtype in binary format.-
Fields inherited from class de.haumacher.msgbuf.graph.cmd.ListUpdate
INDEX, INDEX__ID, NEXT
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedInsertElement()Creates aInsertElementinstance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static InsertElementcreate()Creates aInsertElementinstance.Objectget(String field)Retrieves value of the field with the given name.ObjectgetElement()Cache for the actual value that was inserted to the givenListUpdate.getIndex().booleanhasElement()Checks, whethergetElement()has a value.StringjsonType()The type identifier for this concrete sub-type.Command.TypeKindkind()The type code of this instance.List<String>properties()All properties that are supported by this object.protected voidreadField(DataReader in, int field)Consumes the value for the field with the given ID and assigns its value.protected voidreadField(JsonReader in, String field)Reads the given field from the given input.static InsertElementreadInsertElement(DataReader in)Reads a new instance from the given reader.static InsertElementreadInsertElement(JsonReader in)Reads a new instance from the given reader.voidset(String field, Object value)Sets the value of the property with the given name.InsertElementsetElement(Object value)inttypeId()The binary identifier for this concrete type in the polymorphicCommandhierarchy.<R,A,E extends Throwable>
Rvisit(ListUpdate.Visitor<R,A,E> v, A arg)Accepts the given visitor.protected voidwriteFields(DataWriter out)Serializes all fields of this instance to the given binary output.protected voidwriteFields(JsonWriter out)Writes all fields of this instance to the given output.-
Methods inherited from class de.haumacher.msgbuf.graph.cmd.ListUpdate
getIndex, getNext, hasNext, readListUpdate, readListUpdate, setIndex, setNext, visit
-
Methods inherited from class de.haumacher.msgbuf.graph.cmd.Command
getId, getNode, getProperty, hasNode, readCommand, readCommand, registerListener, setId, setNode, setProperty, unregisterListener, writeTo, writeTo
-
Methods inherited from class de.haumacher.msgbuf.data.AbstractDataObject
readContent, readFields, toString, writeContent
-
-
-
-
Field Detail
-
INSERT_ELEMENT__TYPE
public static final String INSERT_ELEMENT__TYPE
Identifier for theInsertElementtype in JSON format.- See Also:
- Constant Field Values
-
ELEMENT
public static final String ELEMENT
- See Also:
getElement(), Constant Field Values
-
INSERT_ELEMENT__TYPE_ID
public static final int INSERT_ELEMENT__TYPE_ID
Identifier for theInsertElementtype in binary format.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
InsertElement
protected InsertElement()
Creates aInsertElementinstance.- See Also:
create()
-
-
Method Detail
-
create
public static InsertElement create()
Creates aInsertElementinstance.
-
kind
public Command.TypeKind kind()
Description copied from class:CommandThe type code of this instance.
-
getElement
public final Object getElement()
Cache for the actual value that was inserted to the givenListUpdate.getIndex().
-
setElement
public final InsertElement setElement(Object value)
- See Also:
getElement()
-
hasElement
public final boolean hasElement()
Checks, whethergetElement()has a value.
-
jsonType
public String jsonType()
Description copied from interface:ReflectiveDataObjectThe type identifier for this concrete sub-type.
-
properties
public List<String> properties()
Description copied from interface:ReflectiveDataObjectAll properties that are supported by this object.- Specified by:
propertiesin interfaceReflectiveDataObject- Overrides:
propertiesin classListUpdate- See Also:
ReflectiveDataObject.get(String)
-
get
public Object get(String field)
Description copied from interface:ReflectiveDataObjectRetrieves value of the field with the given name.- Specified by:
getin interfaceReflectiveDataObject- Overrides:
getin classListUpdate- Parameters:
field- The name of the property.- Returns:
- The value of the property with the given name.
- See Also:
ReflectiveDataObject.properties()
-
set
public void set(String field, Object value)
Description copied from interface:ReflectiveDataObjectSets the value of the property with the given name.- Specified by:
setin interfaceReflectiveDataObject- Overrides:
setin classListUpdate- Parameters:
field- The name of the property to update.value- The new value of the property.- See Also:
ReflectiveDataObject.get(String)
-
readInsertElement
public static InsertElement readInsertElement(JsonReader in) throws IOException
Reads a new instance from the given reader.- Throws:
IOException
-
writeFields
protected void writeFields(JsonWriter out) throws IOException
Description copied from class:AbstractDataObjectWrites all fields of this instance to the given output.- Overrides:
writeFieldsin classListUpdate- Parameters:
out- The writer to write to.- Throws:
IOException- If writing fails.
-
readField
protected void readField(JsonReader in, String field) throws IOException
Description copied from class:AbstractDataObjectReads the given field from the given input.- Overrides:
readFieldin classListUpdate- Parameters:
in- The reader to take the value from.field- The name of the field whose value should be read.- Throws:
IOException
-
typeId
public int typeId()
Description copied from class:CommandThe binary identifier for this concrete type in the polymorphicCommandhierarchy.
-
writeFields
protected void writeFields(DataWriter out) throws IOException
Description copied from class:CommandSerializes all fields of this instance to the given binary output.- Overrides:
writeFieldsin classListUpdate- Parameters:
out- The binary output to write to.- Throws:
IOException- If writing fails.
-
readInsertElement
public static InsertElement readInsertElement(DataReader in) throws IOException
Reads a new instance from the given reader.- Throws:
IOException
-
readField
protected void readField(DataReader in, int field) throws IOException
Description copied from class:CommandConsumes the value for the field with the given ID and assigns its value.- Overrides:
readFieldin classListUpdate- Throws:
IOException
-
visit
public <R,A,E extends Throwable> R visit(ListUpdate.Visitor<R,A,E> v, A arg) throws E extends Throwable
Description copied from class:ListUpdateAccepts the given visitor.- Specified by:
visitin classListUpdate- Throws:
E extends Throwable
-
-