Example usage for org.springframework.beans BeanUtils resolveSignature

List of usage examples for org.springframework.beans BeanUtils resolveSignature

Introduction

In this page you can find the example usage for org.springframework.beans BeanUtils resolveSignature.

Prototype

@Nullable
public static Method resolveSignature(String signature, Class<?> clazz) 

Source Link

Document

Parse a method signature in the form methodName[([arg_list])] , where arg_list is an optional, comma-separated list of fully-qualified type names, and attempts to resolve that signature against the supplied Class .

Usage

From source file:io.gravitee.gateway.el.SpelTemplateContext.java

public SpelTemplateContext() {
    context.registerFunction("jsonPath", BeanUtils.resolveSignature("evaluate", JsonPathFunction.class));
}

From source file:io.gravitee.gateway.services.healthcheck.EndpointHealthCheck.java

private void validateAssertions(final HealthStatus.Builder healthBuilder, final HealthCheckResponse response) {
    healthBuilder.success().status(response.getStatus());

    // Run assertions
    if (healthCheck.getExpectation().getAssertions() != null) {
        Iterator<String> assertionIterator = healthCheck.getExpectation().getAssertions().iterator();
        boolean success = true;
        while (success && assertionIterator.hasNext()) {
            String assertion = assertionIterator.next();
            ExpressionParser parser = new SpelExpressionParser();
            Expression expr = parser.parseExpression(assertion);

            StandardEvaluationContext context = new StandardEvaluationContext();
            context.registerFunction("jsonPath",
                    BeanUtils.resolveSignature("evaluate", JsonPathFunction.class));

            context.setVariable("response", response);

            success = expr.getValue(context, boolean.class);

            if (!success) {
                healthBuilder.message("Assertion can not be verified : " + assertion);
            }/*  ww  w. j a  v  a  2  s . c o  m*/
        }

        healthBuilder.success(success);
    }
}