private Resource getResource() {
   final Resource.Builder builder = Resource.builder();
   builder
       .addMethod("GET")
       .produces(MediaType.TEXT_PLAIN_TYPE)
       .handledBy(
           new Inflector<ContainerRequestContext, String>() {
             @Override
             public String apply(ContainerRequestContext containerRequestContext) {
               return "inflector";
             }
           });
   return builder.build();
 }
    @Path("complex")
    public Resource complexSubResource() throws NoSuchMethodException {
      Resource.Builder builder = Resource.builder();
      builder
          .addChildResource("singleton-method")
          .addMethod("GET")
          .handledBy(
              SingletonResource.class, SingletonResource.class.getDeclaredMethod("getCounter"));

      builder.addChildResource(Resource.from(SingletonChild.class));
      builder.addChildResource(Resource.from(StandardChild.class));
      builder
          .addMethod("GET")
          .produces(MediaType.TEXT_PLAIN_TYPE)
          .handledBy(
              new Inflector<ContainerRequestContext, String>() {
                @Override
                public String apply(ContainerRequestContext containerRequestContext) {
                  return "inflector";
                }
              });
      return builder.build();
    }
  private Resource.Builder doCreateResourceBuilder() {
    if (!disableValidation) {
      checkForNonPublicMethodIssues();
    }

    final Class<?> annotatedResourceClass = ModelHelper.getAnnotatedResourceClass(handlerClass);
    final Path rPathAnnotation = annotatedResourceClass.getAnnotation(Path.class);

    final boolean keepEncodedParams = (null != annotatedResourceClass.getAnnotation(Encoded.class));

    final List<MediaType> defaultConsumedTypes =
        extractMediaTypes(annotatedResourceClass.getAnnotation(Consumes.class));
    final List<MediaType> defaultProducedTypes =
        extractMediaTypes(annotatedResourceClass.getAnnotation(Produces.class));
    final Collection<Class<? extends Annotation>> defaultNameBindings =
        ReflectionHelper.getAnnotationTypes(annotatedResourceClass, NameBinding.class);

    final MethodList methodList = new MethodList(handlerClass);

    checkResourceClassSetters(methodList, keepEncodedParams);
    checkResourceClassFields(keepEncodedParams, InvocableValidator.isSingleton(handlerClass));

    Resource.Builder resourceBuilder;

    if (null != rPathAnnotation) {
      resourceBuilder = Resource.builder(rPathAnnotation.value());
    } else {
      resourceBuilder = Resource.builder();
    }

    boolean extended = false;
    if (handlerClass.isAnnotationPresent(ExtendedResource.class)) {
      resourceBuilder.extended(true);
      extended = true;
    }

    resourceBuilder.name(handlerClass.getName());

    addResourceMethods(
        resourceBuilder,
        methodList,
        keepEncodedParams,
        defaultConsumedTypes,
        defaultProducedTypes,
        defaultNameBindings,
        extended);
    addSubResourceMethods(
        resourceBuilder,
        methodList,
        keepEncodedParams,
        defaultConsumedTypes,
        defaultProducedTypes,
        defaultNameBindings,
        extended);
    addSubResourceLocators(resourceBuilder, methodList, keepEncodedParams, extended);

    if (LOGGER.isLoggable(Level.FINEST)) {
      LOGGER.finest(
          LocalizationMessages.NEW_AR_CREATED_BY_INTROSPECTION_MODELER(resourceBuilder.toString()));
    }

    return resourceBuilder;
  }
 @Override
 protected ListPackagesResponse getResponse() {
   return ListPackagesResponse.builder()
       .pagination(
           Pagination.builder()
               .totalResults(3)
               .first(Link.builder().href("/v3/packages?page=1&per_page=2").build())
               .last(Link.builder().href("/v3/packages?page=2&per_page=2").build())
               .next(Link.builder().href("/v3/packages?page=2&per_page=2").build())
               .build())
       .resource(
           Resource.builder()
               .id("guid-2731172f-0714-430e-81e7-d662509d555b")
               .type("bits")
               .data("error", null)
               .data(
                   "hash",
                   StringMap.builder().entry("type", "sha1").entry("value", null).build())
               .state("AWAITING_UPLOAD")
               .createdAt("2016-01-26T22:20:12Z")
               .link(
                   "self",
                   Link.builder()
                       .href("/v3/packages/guid-2731172f-0714-430e-81e7-d662509d555b")
                       .build())
               .link(
                   "upload",
                   Link.builder()
                       .href("/v3/packages/guid-2731172f-0714-430e-81e7-d662509d555b/upload")
                       .method("POST")
                       .build())
               .link(
                   "download",
                   Link.builder()
                       .href("/v3/packages/guid-2731172f-0714-430e-81e7-d662509d555b/download")
                       .method("GET")
                       .build())
               .link(
                   "stage",
                   Link.builder()
                       .href("/v3/packages/guid-2731172f-0714-430e-81e7-d662509d555b/droplets")
                       .method("POST")
                       .build())
               .link(
                   "app",
                   Link.builder()
                       .href("/v3/apps/guid-f4384453-4610-4075-b2c3-c2290401dbb9")
                       .build())
               .build())
       .resource(
           Resource.builder()
               .id("guid-10217847-a68c-4c08-89d6-b247d8afe647")
               .type("docker")
               .data("image", "http://location-of-image.com")
               .state("READY")
               .createdAt("2016-01-26T22:20:12Z")
               .link(
                   "self",
                   Link.builder()
                       .href("/v3/packages/guid-10217847-a68c-4c08-89d6-b247d8afe647")
                       .build())
               .link(
                   "stage",
                   Link.builder()
                       .href("/v3/packages/guid-10217847-a68c-4c08-89d6-b247d8afe647/droplets")
                       .method("POST")
                       .build())
               .link(
                   "app",
                   Link.builder()
                       .href("/v3/apps/guid-f4384453-4610-4075-b2c3-c2290401dbb9")
                       .build())
               .build())
       .build();
 }