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 CheckSum
checkSum()
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 givenByteBuffer
java.lang.String
file()
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
)void
load(java.nio.ByteBuffer data)
Load the entry from aByteBuffer
java.nio.ByteBuffer
save()
Save the entry to aByteBuffer
void
set(java.lang.String argumentName, java.lang.String value)
Set the argument of the entry to a specific valuevoid
setCheckSum(CheckSum checkSum)
Set the checksum of the given entryvoid
setFile(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
String
that 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
- anString
that 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
String
that 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
-String
that hold the argument we want to changevalue
-String
the 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:
evaluate
in classSerializer
- Parameters:
data
- hold anByteBuffer
that will be used to load the data- Returns:
- An Optional that contains a map of
String
andByteBuffer
-
load
public void load(java.nio.ByteBuffer data)
Load the entry from aByteBuffer
- Parameters:
data
-ByteBuffer
that hold the data from which the entry is loaded
-
save
public java.nio.ByteBuffer save()
Save the entry to aByteBuffer
- Returns:
ByteBuffer
that contains an encoded version of the entry (that can be loaded with the load methods)
-
-