All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.jqwik.engine.support.MethodParameter Maven / Gradle / Ivy

There is a newer version: 1.9.1
Show newest version
package net.jqwik.engine.support;

import java.lang.annotation.*;
import java.lang.reflect.*;
import java.util.*;

import org.junit.platform.commons.support.*;

public class MethodParameter {

	private final Parameter parameter;
	private final TypeResolution resolution;

	public MethodParameter(Parameter parameter, TypeResolution resolution) {
		this.parameter = parameter;
		this.resolution = resolution;
	}

	public boolean isAnnotatedParameterized() {
		return (resolution.annotatedType() instanceof AnnotatedParameterizedType);
	}

	public boolean isAnnotated(Class annotationType) {
		return AnnotationSupport.isAnnotated(parameter, annotationType);
	}

	public  T getAnnotation(Class annotationClass) {
		return findAnnotation(annotationClass).orElse(null);
	}

	public  Optional findAnnotation(Class annotationClass) {
		return AnnotationSupport.findAnnotation(parameter, annotationClass);
	}

	public Type getType() {
		return resolution.type();
	}

	@Override
	public String toString() {
		return parameter.toString();
	}

	public List findAllAnnotations() {
		return JqwikAnnotationSupport.findAllAnnotations(parameter);
	}

	public AnnotatedParameterizedType getAnnotatedType() {
		if (isAnnotatedParameterized())
			return (AnnotatedParameterizedType) resolution.annotatedType();
		else
			return null;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy