Enum Class AnswerType

java.lang.Object
java.lang.Enum<AnswerType>
com.ubs.backend.classes.enums.AnswerType
All Implemented Interfaces:
Serializable, Comparable<AnswerType>, Constable

public enum AnswerType extends Enum<AnswerType>
Enum to identify different types of Answers
Since:
17.07.2021
Author:
Marc, Tim Irmler
  • Enum Constant Details

    • DEFAULT

      public static final AnswerType DEFAULT
      Normal Answer with one Response String
      Since:
      17.07.2021
    • JOKE

      public static final AnswerType JOKE
      Answer which contains a random joke
      Since:
      17.07.2021
    • FACTS

      public static final AnswerType FACTS
      Enum with facts about the bot
      Since:
      08.08.2021
    • STATISTICS

      public static final AnswerType STATISTICS
      Contains procedurally generated answers with statistics about the bot
      Since:
      12.08.2021
    • ERROR

      public static final AnswerType ERROR
      used if we return an error! can't be used as an actual answertype
      Since:
      13.08.2021
  • Field Details

    • handler

      private final InstructionHandler handler
      The Object which is being used to handle the Answer
      Since:
      17.07.2021
    • name

      private final String name
      The name of the answer type, used to display on the website
      Since:
      17.07.2021
    • canBeUserMade

      private final boolean canBeUserMade
      boolean to determine if a user can create an answer with this type
      Since:
      17.07.2021
    • groupedTags

      private final boolean groupedTags
      boolean to determine if all answers share the same tags or if they don't
      Since:
      17.07.2021
    • hidden

      private final boolean hidden
      defines if all answers are hidden in the statistics or not. is only the default value. if not forced, user can define something else
      Since:
      21.07.2021
    • forceHidden

      private final boolean forceHidden
      need all the answers of this type to be hidden/not hidden?
      Since:
      08.08.2021
    • values

      private static final AnswerType[] 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

      public static AnswerType[] 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

      public static AnswerType valueOf(String name)
      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 name
      NullPointerException - if the argument is null
    • handle

      public Answer handle(Answer answer)
      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

      public InstructionHandler getHandler()
      get the handler object
      Returns:
      the handler object
      Since:
      17.07.2021
    • getName

      public String 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

      public static AnswerType[] getValues()
      Returns:
      the cached values, containing all enum elements
      Since:
      17.07.2021
    • isHidden

      public boolean isHidden()
    • getAnswerTypeByName

      public static AnswerType getAnswerTypeByName(String name)
      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

      public String toString()
      Overrides:
      toString in class Enum<AnswerType>