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

io.cucumber.java.AbstractGlueDefinition Maven / Gradle / Ivy

There is a newer version: 7.20.1
Show newest version
package io.cucumber.java;

import io.cucumber.core.backend.Located;
import io.cucumber.core.backend.Lookup;

import java.lang.reflect.Method;

import static java.util.Objects.requireNonNull;

abstract class AbstractGlueDefinition implements Located {

    protected final Method method;
    protected final Lookup lookup;
    private String fullFormat;

    AbstractGlueDefinition(Method method, Lookup lookup) {
        this.method = requireNonNull(method);
        this.lookup = requireNonNull(lookup);
    }

    @Override
    public boolean isDefinedAt(StackTraceElement e) {
        return e.getClassName().equals(method.getDeclaringClass().getName()) && e.getMethodName().equals(method.getName());
    }

    @Override
    public final String getLocation() {
        return getFullLocationLocation();
    }

    private String getFullLocationLocation() {
        if (fullFormat == null) {
            fullFormat = MethodFormat.FULL.format(method);
        }
        return fullFormat;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy