Package net.starype.quiz.api.parser
Class DBEntry
- java.lang.Object
-
- net.starype.quiz.api.util.Serializer
-
- net.starype.quiz.api.parser.DBEntry
-
public class DBEntry extends Serializer
Stores an entry for each corresponding argument defined in theDBTable
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class net.starype.quiz.api.util.Serializer
Serializer.Builder
-
-
Method Summary
Modifier and Type Method Description CheckSumcheckSum()Get the checksum argument of the entryjava.util.Optional<java.util.Map<java.lang.String,java.nio.ByteBuffer>>evaluate(java.nio.ByteBuffer data)Load an Entry from a givenByteBufferjava.lang.Stringfile()Get the file argument of the entryjava.util.Optional<java.lang.String>get(java.lang.String entry)Get the entry corresponding to a given namejava.util.Set<ArgumentValue<java.lang.String>>getIndexedArguments()Retrieve a list of all the argument hold by the current entry (seeArgumentValue)voidload(java.nio.ByteBuffer data)Load the entry from aByteBufferjava.nio.ByteBuffersave()Save the entry to aByteBuffervoidset(java.lang.String argumentName, java.lang.String value)Set the argument of the entry to a specific valuevoidsetCheckSum(CheckSum checkSum)Set the checksum of the given entryvoidsetFile(java.lang.String file)Sets the file argument of the entry-
Methods inherited from class net.starype.quiz.api.util.Serializer
evaluate
-
-
-
-
Method Detail
-
checkSum
public CheckSum checkSum()
Get the checksum argument of the entry- Returns:
- The checksum hold by the current entry (see
CheckSum)
-
setCheckSum
public void setCheckSum(CheckSum checkSum)
Set the checksum of the given entry- Parameters:
checkSum- the new checkSum value (seeCheckSum)
-
file
public java.lang.String file()
Get the file argument of the entry- Returns:
- An
Stringthat hold the file from which the entry has been loaded
-
setFile
public void setFile(java.lang.String file)
Sets the file argument of the entry- Parameters:
file- anStringthat hold the file from which the current entry has been loaded
-
getIndexedArguments
public java.util.Set<ArgumentValue<java.lang.String>> getIndexedArguments()
Retrieve a list of all the argument hold by the current entry (seeArgumentValue)- Returns:
- A set of argument values
-
get
public java.util.Optional<java.lang.String> get(java.lang.String entry)
Get the entry corresponding to a given name- Parameters:
entry- the name of the argument we wanted to retrieveString- Returns:
- An optional
Stringthat hold the result (or empty if the argument doesn't exists in the entry)
-
set
public void set(java.lang.String argumentName, java.lang.String value)Set the argument of the entry to a specific value- Parameters:
argumentName-Stringthat hold the argument we want to changevalue-Stringthe new value hold by the argument
-
evaluate
public java.util.Optional<java.util.Map<java.lang.String,java.nio.ByteBuffer>> evaluate(java.nio.ByteBuffer data)
Load an Entry from a givenByteBuffer- Overrides:
evaluatein classSerializer- Parameters:
data- hold anByteBufferthat will be used to load the data- Returns:
- An Optional that contains a map of
StringandByteBuffer
-
load
public void load(java.nio.ByteBuffer data)
Load the entry from aByteBuffer- Parameters:
data-ByteBufferthat hold the data from which the entry is loaded
-
save
public java.nio.ByteBuffer save()
Save the entry to aByteBuffer- Returns:
ByteBufferthat contains an encoded version of the entry (that can be loaded with the load methods)
-
-