- java.lang.Object
-
- de.haumacher.msgbuf.data.AbstractDataObject
-
- de.haumacher.msgbuf.graph.cmd.Command
-
- de.haumacher.msgbuf.graph.cmd.ListUpdate
-
- All Implemented Interfaces:
BinaryDataObject,DataObject,ReflectiveDataObject,Observable
- Direct Known Subclasses:
InsertElement,RemoveElement
public abstract class ListUpdate extends Command
Base class for operations internally changing the values of repeated properties.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceListUpdate.Visitor<R,A,E extends Throwable>Visitor interface for theListUpdatehierarchy.-
Nested classes/interfaces inherited from class de.haumacher.msgbuf.graph.cmd.Command
Command.TypeKind
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedListUpdate()Creates aListUpdateinstance.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Objectget(String field)Retrieves value of the field with the given name.intgetIndex()The list index that is modified.ListUpdategetNext()Pointer to chain updates for the same property.booleanhasNext()Checks, whethergetNext()has a value.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 ListUpdatereadListUpdate(DataReader in)Reads a new instance from the given reader.static ListUpdatereadListUpdate(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.ListUpdatesetIndex(int value)ListUpdatesetNext(ListUpdate value)<R,A,E extends Throwable>
Rvisit(Command.Visitor<R,A,E> v, A arg)Accepts the given visitor.abstract <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.Command
getId, getNode, getProperty, hasNode, kind, readCommand, readCommand, registerListener, setId, setNode, setProperty, typeId, unregisterListener, writeTo, writeTo
-
Methods inherited from class de.haumacher.msgbuf.data.AbstractDataObject
readContent, readFields, toString, writeContent
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface de.haumacher.msgbuf.data.ReflectiveDataObject
jsonType
-
-
-
-
Field Detail
-
INDEX
public static final String INDEX
- See Also:
getIndex(), Constant Field Values
-
NEXT
public static final String NEXT
- See Also:
getNext(), Constant Field Values
-
INDEX__ID
public static final int INDEX__ID
Identifier for the propertygetIndex()in binary format.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ListUpdate
protected ListUpdate()
Creates aListUpdateinstance.
-
-
Method Detail
-
getIndex
public final int getIndex()
The list index that is modified.
-
setIndex
public final ListUpdate setIndex(int value)
- See Also:
getIndex()
-
getNext
public final ListUpdate getNext()
Pointer to chain updates for the same property.
-
setNext
public final ListUpdate setNext(ListUpdate value)
- See Also:
getNext()
-
hasNext
public final boolean hasNext()
Checks, whethergetNext()has a value.
-
properties
public List<String> properties()
Description copied from interface:ReflectiveDataObjectAll properties that are supported by this object.- Specified by:
propertiesin interfaceReflectiveDataObject- Overrides:
propertiesin classCommand- 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 classCommand- 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 classCommand- Parameters:
field- The name of the property to update.value- The new value of the property.- See Also:
ReflectiveDataObject.get(String)
-
readListUpdate
public static ListUpdate readListUpdate(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 classCommand- 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 classCommand- Parameters:
in- The reader to take the value from.field- The name of the field whose value should be read.- Throws:
IOException
-
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 classCommand- Parameters:
out- The binary output to write to.- Throws:
IOException- If writing fails.
-
readListUpdate
public static ListUpdate readListUpdate(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 classCommand- Throws:
IOException
-
visit
public abstract <R,A,E extends Throwable> R visit(ListUpdate.Visitor<R,A,E> v, A arg) throws E extends Throwable
Accepts the given visitor.- Throws:
E extends Throwable
-
-