Record Class ForeignFunctionCallResult

java.lang.Object
java.lang.Record
net.jrodolfo.java_evolution.java22.foreign_function.ForeignFunctionCallResult
Record Components:
functionName - the native function that was called
input - the Java input copied into native memory
value - the value returned to Java
javaType - the Java type used for the returned value

public record ForeignFunctionCallResult(String functionName, String input, Number value, String javaType) extends Record
Captures the observable result of a small native function call.

The record keeps the examples easy to test without printing from the example classes. The Java type is included because foreign calls cross a boundary where C types and Java types must be mapped deliberately.

  • Constructor Details

    • ForeignFunctionCallResult

      public ForeignFunctionCallResult(String functionName, String input, Number value, String javaType)
      Creates an instance of a ForeignFunctionCallResult record class.
      Parameters:
      functionName - the value for the functionName record component
      input - the value for the input record component
      value - the value for the value record component
      javaType - the value for the javaType record component
  • Method Details

    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • functionName

      public String functionName()
      Returns the value of the functionName record component.
      Returns:
      the value of the functionName record component
    • input

      public String input()
      Returns the value of the input record component.
      Returns:
      the value of the input record component
    • value

      public Number value()
      Returns the value of the value record component.
      Returns:
      the value of the value record component
    • javaType

      public String javaType()
      Returns the value of the javaType record component.
      Returns:
      the value of the javaType record component