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

pub.codex.apix.context.OperationContext Maven / Gradle / Ivy

There is a newer version: 5.0.2
Show newest version
package pub.codex.apix.context;

import com.google.common.base.Optional;
import org.springframework.core.MethodParameter;
import org.springframework.http.HttpMethod;
import org.springframework.web.bind.annotation.RequestMethod;
import pub.codex.apix.build.OperationBuilder;

import java.lang.annotation.Annotation;
import java.util.List;

public class OperationContext {

    private final RequestMethod requestMethod;

    private final RequestMappingContext requestContext;

    private final OperationBuilder operationBuilder;


    public OperationContext(RequestMethod requestMethod, RequestMappingContext requestContext) {
        this.requestMethod = requestMethod;
        this.requestContext = requestContext;
        this.operationBuilder = new OperationBuilder();
    }

    public String getName() {
        return requestContext.getName();
    }


    public OperationBuilder operationBuilder() {
        return operationBuilder;
    }


    public HttpMethod httpMethod() {
        return HttpMethod.valueOf(requestMethod.toString());
    }

    public  Optional findAnnotation(Class annotation) {
        return requestContext.findAnnotation(annotation);
    }

    public List  getParameterAnnotation(Class annotation) {
        return requestContext.getParameterAnnotation(annotation);
    }
    public List  getParameter() {
        return requestContext.getParameter();
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy