java.lang.Object
com.github.stephengold.joltjni.JoltPhysicsObject
com.github.stephengold.joltjni.template.Result<T>
Type Parameters:
T - the datatype produced when successful
All Implemented Interfaces:
ConstJoltPhysicsObject, AutoCloseable, Comparable<JoltPhysicsObject>
Direct Known Subclasses:
BcsResult, ConstraintResult, GroupFilterResult, PathResult, PhysicsMaterialResult, PhysicsSceneResult, RagdollResult, SbcsResult, SettingsResult, ShapeResult

public abstract class Result<T extends JoltPhysicsObject> extends JoltPhysicsObject
The result of an operation that might fail.
  • Constructor Details

    • Result

      protected Result()
      Instantiate with no native object assigned.

      This no-arg constructor was made explicit to avoid javadoc warnings from JDK 18+.

  • Method Details

    • get

      public abstract T get()
      Return the result of a successful operation.
      Returns:
      a new JVM object with a new native object assigned
    • getError

      public String getError()
      Return the error message.
      Returns:
      a string of text
    • hasError

      public boolean hasError()
      Test whether an error occurred.
      Returns:
      true if error, otherwise false
    • isValid

      public boolean isValid()
      Test whether the value returned by get() is valid.
      Returns:
      true if valid, otherwise false
    • getError

      protected abstract String getError(long resultVa)
      Return the error message.
      Parameters:
      resultVa - the virtual address of the result (not zero)
      Returns:
      a string of text
    • hasError

      protected abstract boolean hasError(long resultVa)
      Test whether an error occurred.
      Parameters:
      resultVa - the virtual address of the result (not zero)
      Returns:
      true if error, otherwise false
    • isValid

      protected abstract boolean isValid(long resultVa)
      Test whether the value returned by get() is valid.
      Parameters:
      resultVa - the virtual address of the result (not zero)
      Returns:
      true if valid, otherwise false