Class Result<T>

java.lang.Object
dev.netcode.util.Result<T>
Type Parameters:
T - type of object the function should have returned

public class Result<T> extends Object
Instances of this class can be used when a function may encounter an error and wants to display the error message but you want to manually display it.
  • Constructor Details

    • Result

      public Result(T value, String error)
      Instantiates Result and sets either the value or error
      Parameters:
      value - if successful or null
      error - if failed or null
  • Method Details

    • wasSuccessful

      public boolean wasSuccessful()
      Returns:
      whether retrieving the result was successful
    • get

      public T get()
      Returns:
      the result
    • getError

      public String getError()
      Returns:
      the error