Top Fields Constructors Methods
org.junit.jupiter.engine.execution

pack-priv final Record DefaultParameterContext

extends Record
implements ParameterContext
Class Inheritance
All Implemented Interfaces
org.junit.jupiter.api.extension.ParameterContext, org.junit.jupiter.api.extension.AnnotatedElementContext
Record Components
parameter:Parameter 
index:int 
target:Optional<Object> 
Imports
java.lang.annotation.Annotation, java.lang.reflect.Parameter, java.util.List, .Optional, org.junit.jupiter.api.extension.ParameterContext, org.junit.platform.commons.util.AnnotationUtils, .Preconditions, .ToStringBuilder

Since
5.0

Field Summary

Modifier and TypeField and Description
private final int
index

Record Component accessed by index().

private final Parameter
parameter

Record Component accessed by parameter().

private final Optional<Object>
target

Record Component accessed by target().

Constructor Summary

AccessConstructor and Description
pack-priv
DefaultParameterContext(Parameter parameter, int index, Optional<Object> target)

Method Summary

Modifier and TypeMethod and Description
public final boolean
equals(Object o)

Implements abstract java.lang.Record.equals.

Indicates whether some other object is "equal to" this one.

public <A extends Annotation> Optional<A>
findAnnotation(Class<A> annotationType)

Overrides default org.junit.jupiter.api.extension.ParameterContext.findAnnotation.

Find the first annotation of annotationType that is either present or meta-present on the AnnotatedElement for this context.

public <A extends Annotation> List<A>
findRepeatableAnnotations(Class<A> annotationType)

Overrides default org.junit.jupiter.api.extension.ParameterContext.findRepeatableAnnotations.

Find all repeatable annotations of annotationType that are either present or meta-present on the AnnotatedElement for this context.

public int
getIndex()

Implements org.junit.jupiter.api.extension.ParameterContext.getIndex.

Get the index of the Parameter for this context within the parameter list of the Executable that declares the parameter.

public Parameter
public Optional<Object>
getTarget()

Implements org.junit.jupiter.api.extension.ParameterContext.getTarget.

Get the target on which the Executable that declares the Parameter for this context will be invoked, if available.

public final int
hashCode()

Implements abstract java.lang.Record.hashCode.

Returns a hash code value for the record.

public int
index()

Record Component getter of index.

public boolean
isAnnotated(Class<? extends Annotation> annotationType)

Overrides default org.junit.jupiter.api.extension.ParameterContext.isAnnotated.

Determine if an annotation of annotationType is either present or meta-present on the AnnotatedElement for this context.

public Parameter
parameter()

Record Component getter of parameter.

public Optional<Object>
target()

Record Component getter of target.

public String
toString()

Implements abstract java.lang.Record.toString.

Returns a string representation of the record.

Field Detail

indexback to summary
private final int index

Record Component accessed by index().

parameterback to summary
private final Parameter parameter

Record Component accessed by parameter().

targetback to summary
private final Optional<Object> target

Record Component accessed by target().

Constructor Detail

DefaultParameterContextback to summary
pack-priv DefaultParameterContext(Parameter parameter, int index, Optional<Object> target)

Method Detail

equalsback to summary
public final boolean equals(Object o)

Implements abstract java.lang.Record.equals.

Doc from java.lang.Record.equals.

Indicates whether some other object is "equal to" this one. In addition to the general contract of Object.equals, record classes must further obey the invariant that when a record instance is "copied" by passing the result of the record component accessor methods to the canonical constructor, as follows:

    R copy = new R(r.c1(), r.c2(), ..., r.cn());
then it must be the case that r.equals(copy).
findAnnotationback to summary
public <A extends Annotation> Optional<A> findAnnotation(Class<A> annotationType)

Overrides default org.junit.jupiter.api.extension.ParameterContext.findAnnotation.

Doc from org.junit.jupiter.api.extension.ParameterContext.findAnnotation.

Find the first annotation of annotationType that is either present or meta-present on the AnnotatedElement for this context.

WARNING

Favor the use of this method over directly invoking annotation lookup methods in the AnnotatedElement API due to a bug in javac on JDK versions prior to JDK 9.

Annotations
@Override
findRepeatableAnnotationsback to summary
public <A extends Annotation> List<A> findRepeatableAnnotations(Class<A> annotationType)

Overrides default org.junit.jupiter.api.extension.ParameterContext.findRepeatableAnnotations.

Doc from org.junit.jupiter.api.extension.ParameterContext.findRepeatableAnnotations.

Find all repeatable annotations of annotationType that are either present or meta-present on the AnnotatedElement for this context.

WARNING

Favor the use of this method over directly invoking annotation lookup methods in the AnnotatedElement API due to a bug in javac on JDK versions prior to JDK 9.

Annotations
@Override
getIndexback to summary
public int getIndex()

Implements org.junit.jupiter.api.extension.ParameterContext.getIndex.

Doc from org.junit.jupiter.api.extension.ParameterContext.getIndex.

Get the index of the Parameter for this context within the parameter list of the Executable that declares the parameter.

Annotations
@Override
getParameterback to summary
public Parameter getParameter()

Implements org.junit.jupiter.api.extension.ParameterContext.getParameter.

Doc from org.junit.jupiter.api.extension.ParameterContext.getParameter.

Get the Parameter for this context.

WARNING

When searching for annotations on the parameter in this context, favor isAnnotated(Class), findAnnotation(Class), and findRepeatableAnnotations(Class) over methods in the Parameter API due to a bug in javac on JDK versions prior to JDK 9.

Annotations
@Override
getTargetback to summary
public Optional<Object> getTarget()

Implements org.junit.jupiter.api.extension.ParameterContext.getTarget.

Doc from org.junit.jupiter.api.extension.ParameterContext.getTarget.

Get the target on which the Executable that declares the Parameter for this context will be invoked, if available.

Annotations
@Override
hashCodeback to summary
public final int hashCode()

Implements abstract java.lang.Record.hashCode.

Doc from java.lang.Record.hashCode.

Returns a hash code value for the record. Obeys the general contract of Object.hashCode. For records, hashing behavior is constrained by the refined contract of Record.equals, so that any two records created from the same components must have the same hash code.

indexback to summary
public int index()

Record Component getter of index.

isAnnotatedback to summary
public boolean isAnnotated(Class<? extends Annotation> annotationType)

Overrides default org.junit.jupiter.api.extension.ParameterContext.isAnnotated.

Doc from org.junit.jupiter.api.extension.ParameterContext.isAnnotated.

Determine if an annotation of annotationType is either present or meta-present on the AnnotatedElement for this context.

Note

This method does not find repeatable annotations. To check for repeatable annotations, use findRepeatableAnnotations(Class) and verify that the returned list is not empty.

WARNING

Favor the use of this method over directly invoking AnnotatedElement#isAnnotationPresent(Class) due to a bug in javac on JDK versions prior to JDK 9.

Annotations
@Override
parameterback to summary
public Parameter parameter()

Record Component getter of parameter.

targetback to summary
public Optional<Object> target()

Record Component getter of target.

toStringback to summary
public String toString()

Implements abstract java.lang.Record.toString.

Doc from java.lang.Record.toString.

Returns a string representation of the record. In accordance with the general contract of Object#toString(), the toString method returns a string that "textually represents" this record. The result should be a concise but informative representation that is easy for a person to read.

In addition to this general contract, record classes must further participate in the invariant that any two records which are equal must produce equal strings. This invariant is necessarily relaxed in the rare case where corresponding equal component values might fail to produce equal strings for themselves.

Annotations
@Override