Class DhApiResult<T>

java.lang.Object
com.seibel.distanthorizons.api.objects.DhApiResult<T>
Type Parameters:
T - The payload type this result contains, can be Void if the result is just used to notify success/failure.

public class DhApiResult<T> extends Object
Allows for more descriptive non-critical failure states.
Since:
API 1.0.0
  • Field Details

    • success

      public final boolean success
      True if the action succeeded, false otherwise.
    • message

      public final String message
      If the action failed this will contain the reason as to why.
      If the action was successful this will generally be the empty string.
    • payload

      public final T payload
      Whatever object the API Method generated/returned.
      Will be null/Void if this result is just used to notify success/failure.
  • Method Details

    • createSuccess

      public static <Pt> DhApiResult<Pt> createSuccess()
    • createSuccess

      public static <Pt> DhApiResult<Pt> createSuccess(Pt payload)
    • createSuccess

      public static <Pt> DhApiResult<Pt> createSuccess(String message, Pt payload)
    • createFail

      public static <Pt> DhApiResult<Pt> createFail(String message)
    • createFail

      public static <Pt> DhApiResult<Pt> createFail(String message, Pt payload)