|
|
The AnswerOption instances are ES6 classes which extend AbstractAnswerOption.
|
|
|
|
|
|
AbstractAnswerOption implements most default behavior which can be overriden by the sub classes.
|
|
|
Currently the only available subclass is the DefaultAnswerOption.
|
|
|
|
|
|
AbstractAnswerOption defines getter and setter methods and hides the instance attributes by using [Symbols](https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/Symbol). Due to this architecture it is __not__ possible to transform this instance directly to JSON. Instead the .serialize() method has to be invoked before. The result of this method can be parsed to JSON.
|
|
|
|
|
|
It is possible to deserialize the plain JS Object by passing the Object to the constructor of the AbstractAnswerOption implementation.
|
|
|
|
|
|
### API introduced by AbstractAnswerOption
|
|
|
```
|
|
|
getHashtag();
|
|
|
Returns the hashtag identifying the corresponding session
|
|
|
```
|
|
|
```
|
|
|
getQuestionIndex();
|
|
|
Returns the questionIndex this AnswerOption belongs to
|
|
|
```
|
|
|
```
|
|
|
getAnswerText();
|
|
|
Returns the currently set answer text displayed during a quiz
|
|
|
```
|
|
|
```
|
|
|
setAnswerText(text);
|
|
|
Sets the answer text for this AnswerOption instance
|
|
|
```
|
|
|
```
|
|
|
getAnswerOptionNumber();
|
|
|
Returns the answerOptionNumber identifying this AnswerOption instance
|
|
|
```
|
|
|
```
|
|
|
getIsCorrect();
|
|
|
Returns whether this AnswerOption instance is currently marked as correct
|
|
|
```
|
|
|
```
|
|
|
setIsCorrect(value);
|
|
|
Set the correct-mark for this AnswerOption instance
|
|
|
```
|
|
|
```
|
|
|
serialize();
|
|
|
Serialize the instance object to a JSON compatible object
|
|
|
```
|
|
|
```
|
|
|
isValid();
|
|
|
Checks if the properties of this instance are valid
|
|
|
```
|
|
|
```
|
|
|
equals();
|
|
|
Checks for equivalence relations to another AnswerOption instance. Also part of the EJSON interface
|
|
|
```
|
|
|
```
|
|
|
typeName();
|
|
|
Part of EJSON interface
|
|
|
```
|
|
|
```
|
|
|
toJSONValue();
|
|
|
Part of EJSON interface
|
|
|
```
|
|
|
|
|
|
### API introduced by DefaultAnswerOption
|
|
|
```
|
|
|
clone();
|
|
|
Part of EJSON interface
|
|
|
``` |
|
|
\ No newline at end of file |