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

com.cerner.beadledom.resteasy.ResteasyGenericResponseBuilder Maven / Gradle / Ivy

There is a newer version: 4.1.2
Show newest version
package com.cerner.beadledom.resteasy;

import com.cerner.beadledom.jaxrs.GenericResponse;
import com.cerner.beadledom.jaxrs.GenericResponseBuilder;
import java.lang.annotation.Annotation;
import javax.ws.rs.core.Response;

/**
 * An implementation of {@link GenericResponseBuilder} for Resteasy.
 *
 * @author John Leacox
 * @since 1.3
 */
class ResteasyGenericResponseBuilder extends GenericResponseBuilder {

  private ResteasyGenericResponseBuilder(int status, T body) {
    super(Response.status(status));
    if (body != null) {
      this.entity(body);
    }
  }

  private ResteasyGenericResponseBuilder(int status, T body, Annotation[] annotations) {
    super(Response.status(status));
    if (body != null) {
      this.entity(body, annotations);
    }
  }

  static  ResteasyGenericResponseBuilder create(int status) {
    return new ResteasyGenericResponseBuilder(status, null);
  }

  static  ResteasyGenericResponseBuilder create(int status, T body) {
    return new ResteasyGenericResponseBuilder(status, body);
  }

  static  ResteasyGenericResponseBuilder create(
      int status, T body, Annotation[] annotations) {
    return new ResteasyGenericResponseBuilder(status, body, annotations);
  }

  @Override
  protected GenericResponse build(T body, Response rawResponse) {
    return BuiltGenericResponse.create(body, rawResponse);
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy