Beispiel #1
0
  /**
   * Finds a matching method in filterMethods for the given service method. A matching method has
   * the same signature as the service interface method, but with an additional parameter matching
   * the service interface itself.
   *
   * <p>The matching method signature from the list of filterMethods is removed and code generation
   * strategies for making the two methods call each other are added.
   */
  private void addBridgeMethod(MethodSignature ms, List filterMethods) {
    Iterator i = filterMethods.iterator();

    while (i.hasNext()) {
      MethodSignature fms = (MethodSignature) i.next();

      int position = _filterMethodAnalyzer.findServiceInterfacePosition(ms, fms);

      if (position >= 0) {
        addBridgeMethod(position, ms, fms);
        i.remove();
        return;
      }
    }

    String message = PipelineMessages.unmatchedServiceMethod(ms, _filterInterface);

    _errorLog.error(message, null, null);

    BodyBuilder b = new BodyBuilder();

    b.add("throw new org.ops4j.gaderian.ApplicationRuntimeException(");
    b.addQuoted(message);
    b.addln(");");

    _classFab.addMethod(Modifier.PUBLIC, ms, b.toString());
  }
 /**
  * Creates a new builder with a {@linkplain HttpStatus#CREATED CREATED} status and a location
  * header set to the given URI.
  *
  * @param location the location URI
  * @return the created builder
  * @since 4.1
  */
 public static BodyBuilder created(URI location) {
   BodyBuilder builder = status(HttpStatus.CREATED);
   return builder.location(location);
 }
 /**
  * A shortcut for creating a {@code ResponseEntity} with the given body and status set to
  * {@linkplain HttpStatus#OK OK}.
  *
  * @return the created {@code ResponseEntity}
  * @since 4.1
  */
 public static <T> ResponseEntity<T> ok(T body) {
   BodyBuilder builder = ok();
   return builder.body(body);
 }