org.junit.jupiter.api.extension.ReflectiveInvocationContext Maven / Gradle / Ivy
Show all versions of junit-jupiter-api Show documentation
/*
* Copyright 2015-2021 the original author or authors.
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v2.0 which
* accompanies this distribution and is available at
*
* https://www.eclipse.org/legal/epl-v20.html
*/
package org.junit.jupiter.api.extension;
import static org.apiguardian.api.API.Status.EXPERIMENTAL;
import java.lang.reflect.Executable;
import java.util.List;
import java.util.Optional;
import org.apiguardian.api.API;
/**
* {@code ReflectiveInvocationContext} encapsulates the context of
* a reflective invocation of an executable (method or constructor).
*
* This interface is not intended to be implemented by clients.
*
* @since 5.5
*/
@API(status = EXPERIMENTAL, since = "5.5")
public interface ReflectiveInvocationContext {
/**
* Get the target class of this invocation context.
*
* If this invocation context represents an instance method, this
* method returns the class of the object the method will be invoked on,
* not the class it is declared in. Otherwise, if this invocation
* represents a static method or constructor, this method returns the
* class the method or constructor is declared in.
*
* @return the target class of this invocation context; never
* {@code null}
*/
Class> getTargetClass();
/**
* Get the method or constructor of this invocation context.
*
* @return the executable of this invocation context; never {@code null}
*/
T getExecutable();
/**
* Get the arguments of the executable in this invocation context.
*
* @return the arguments of the executable in this invocation context;
* immutable and never {@code null}
*/
List