Package com.ubs.backend.classes.enums
Enum Class AnswerType
- All Implemented Interfaces:
Serializable,Comparable<AnswerType>,Constable
Enum to identify different types of Answers
- Since:
- 17.07.2021
- Author:
- Marc, Tim Irmler
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionNormal Answer with one Response Stringused if we return an error!Enum with facts about the botAnswer which contains a random jokeContains procedurally generated answers with statistics about the bot -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanboolean to determine if a user can create an answer with this typeprivate booleanneed all the answers of this type to be hidden/not hidden?private booleanboolean to determine if all answers share the same tags or if they don'tprivate InstructionHandlerThe Object which is being used to handle the Answerprivate booleandefines if all answers are hidden in the statistics or not.private StringThe name of the answer type, used to display on the websiteprivate static AnswerType[]cached values -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateAnswerType(String name, InstructionHandler handler, boolean canBeUserMade, boolean groupedTags, boolean hidden, boolean forceHidden)Default constructor -
Method Summary
Modifier and TypeMethodDescriptionbooleanget the boolean to determine if this answer type can be used by users to create an answer with itstatic AnswerTypegetAnswerTypeByName(String name)method to get an answerType by its nameget the handler objectgetName()get the name of the answer typestatic AnswerType[]Handles the Answer String for the Type of Answerbooleanbooleanget the boolean to determine if this answer type has grouped tags or notbooleanisHidden()toString()static AnswerTypeReturns the enum constant of this class with the specified name.static AnswerType[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
DEFAULT
Normal Answer with one Response String- Since:
- 17.07.2021
-
JOKE
Answer which contains a random joke- Since:
- 17.07.2021
-
FACTS
Enum with facts about the bot- Since:
- 08.08.2021
-
STATISTICS
Contains procedurally generated answers with statistics about the bot- Since:
- 12.08.2021
-
ERROR
used if we return an error! can't be used as an actual answertype- Since:
- 13.08.2021
-
-
Field Details
-
handler
The Object which is being used to handle the Answer- Since:
- 17.07.2021
-
name
The name of the answer type, used to display on the website- Since:
- 17.07.2021
-
canBeUserMade
private final boolean canBeUserMadeboolean to determine if a user can create an answer with this type- Since:
- 17.07.2021
-
groupedTags
private final boolean groupedTagsboolean to determine if all answers share the same tags or if they don't- Since:
- 17.07.2021
-
forceHidden
private final boolean forceHiddenneed all the answers of this type to be hidden/not hidden?- Since:
- 08.08.2021
-
values
cached values- Since:
- 17.07.2021
-
-
Constructor Details
-
AnswerType
private AnswerType(String name, InstructionHandler handler, boolean canBeUserMade, boolean groupedTags, boolean hidden, boolean forceHidden)Default constructor- Parameters:
name-canBeUserMade-groupedTags-- Since:
- 17.07.2021
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
handle
Handles the Answer String for the Type of Answer- Parameters:
answer- the answer which is going to be used- Returns:
- the Response which is being sent to the client
- Since:
- 17.07.2021
-
getHandler
get the handler object- Returns:
- the handler object
- Since:
- 17.07.2021
-
getName
get the name of the answer type- Returns:
- the name of the answer type
- Since:
- 17.07.2021
-
canBeUserMade
public boolean canBeUserMade()get the boolean to determine if this answer type can be used by users to create an answer with it- Returns:
- the boolean to determine if this answer type can be used to create an answer with it
- Since:
- 17.07.2021
-
isGroupedTags
public boolean isGroupedTags()get the boolean to determine if this answer type has grouped tags or not- Returns:
- the boolean to determine if this answer type has grouped tags or not
- Since:
- 17.07.2021
-
getValues
- Returns:
- the cached values, containing all enum elements
- Since:
- 17.07.2021
-
isHidden
public boolean isHidden() -
getAnswerTypeByName
method to get an answerType by its name- Parameters:
name- the name we provide to search for an answer type- Returns:
- the found answer type, if none is found it returns null
- Since:
- 17.07.2021
-
isForceHidden
public boolean isForceHidden() -
toString
- Overrides:
toStringin classEnum<AnswerType>
-