Class RequirementResult

java.lang.Object
net.apartium.cocoabeans.commands.requirements.RequirementResult

public class RequirementResult extends Object
Represents the result of a requirement check This class encapsulates whether a requirement has been met, and optionally provides an error response and additional values if the requirement was met
  • Method Details

    • getError

      public BadCommandResponse getError()
      Returns the error response associated with this result.
      Returns:
      the error response, or null if no error
    • hasError

      public boolean hasError()
      Checks whether there is an error associated with this result.
      Returns:
      true if there is an error, false otherwise
    • meetRequirement

      public boolean meetRequirement()
      Indicates whether the requirement has been met.
      Returns:
      true if the requirement is met, false otherwise
    • getValues

      public RequirementResult.Value[] getValues()
      Returns the optional values associated with this result.
      Returns:
      optional values associated with this result
    • error

      @AvailableSince("0.0.30") public static RequirementResult error(BadCommandResponse error)
      Creates a RequirementResult representing an error condition.
      Parameters:
      error - the error response to be associated with this result
      Returns:
      a new RequirementResult instance with the specified error
    • meet

      @AvailableSince("0.0.30") public static RequirementResult meet()
      Creates a RequirementResult indicating that the requirement has been met without additional values.
      Returns:
      a new RequirementResult instance indicating the requirement is met
    • meet

      @AvailableSince("0.0.30") public static RequirementResult meet(RequirementResult.Value... values)
      Creates a RequirementResult indicating that the requirement has been met with optional values.
      Parameters:
      values - optional values associated with the result
      Returns:
      a new RequirementResult instance indicating the requirement is met with the specified values
    • valueOf

      @AvailableSince("0.0.30") public static RequirementResult.Value valueOf(Object value, Class<?> clazz)
      Creates a Value from the specified value and class.
      Parameters:
      value - the value
      clazz - the class of the value
      Returns:
      a new Value instance with the specified value and class type
    • valueOf

      @AvailableSince("0.0.30") public static RequirementResult.Value valueOf(Object value)
      Creates a Value from the specified value.
      Parameters:
      value - the value
      Returns:
      a new Value instance with Object#getClass as class type