Record Class InvocationResult
java.lang.Object
java.lang.Record
com.github.thought2code.mcp.annotated.reflect.InvocationResult
public record InvocationResult(@NotNull Object result, Immutable<Exception> exception)
extends Record
This record represents the result of reflection invocation of Java method.
- Author:
- codeboyzhou
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classThis class implements the builder pattern for creating a new instance ofInvocationResult. -
Constructor Summary
ConstructorsConstructorDescriptionInvocationResult(@NotNull Object result, Immutable<Exception> exception) Creates an instance of aInvocationResultrecord class. -
Method Summary
Modifier and TypeMethodDescriptionstatic InvocationResult.Builderbuilder()Returns a new instance ofBuilderfor creating a newInvocationResult.final booleanIndicates whether some other object is "equal to" this one.Returns the value of theexceptionrecord component.final inthashCode()Returns a hash code value for this object.booleanisError()Returns whether the invocation resulted in an error.@NotNull Objectresult()Returns the value of theresultrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
InvocationResult
Creates an instance of aInvocationResultrecord class.- Parameters:
result- the value for theresultrecord componentexception- the value for theexceptionrecord component
-
-
Method Details
-
isError
public boolean isError()Returns whether the invocation resulted in an error.- Returns:
trueif the invocation resulted in an error,falseotherwise
-
builder
Returns a new instance ofBuilderfor creating a newInvocationResult.- Returns:
- a new instance of
Builder
-
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. -
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. -
equals
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 withObjects::equals(Object,Object). -
result
Returns the value of theresultrecord component.- Returns:
- the value of the
resultrecord component
-
exception
Returns the value of theexceptionrecord component.- Returns:
- the value of the
exceptionrecord component
-