Package com.linkedin.restli.common

Examples of com.linkedin.restli.common.ResourceMethod


      crudBuilderClasses.put(ResourceMethod.BATCH_GET, BatchGetRequestBuilderBase.class);
    }

    for (Map.Entry<ResourceMethod, Class<?>> entry : crudBuilderClasses.entrySet())
    {
      ResourceMethod method = entry.getKey();
      if (supportedMethods.contains(method))
      {
        String methodName = RestLiToolsUtils.normalizeUnderscores(method.toString());

        JClass builderClass = getCodeModel().ref(entry.getValue()).narrow(keyClass, valueClass);
        JDefinedClass derivedBuilder;
        if (_config.isRestli2Format())
        {
View Full Code Here


  private RoutingResult findMethodDescriptor(final ResourceModel resource,
                                             final ResourceLevel resourceLevel,
                                             final ServerResourceContext context)
  {
    ResourceMethod type = mapResourceMethod(context, resourceLevel);

    String methodName = context.getRequestActionName();
    if (methodName == null)
    {
      methodName = context.getRequestFinderName();
View Full Code Here

    };

    for (int ii = 0; ii < config.length; ii += 2)
    {
      ResourceMethodMatchKey key = (ResourceMethodMatchKey) config[ii];
      ResourceMethod method = (ResourceMethod) config[ii + 1];
      ResourceMethod prevValue = result.put(key, method);
      if (prevValue != null)
      {
        throw new RestLiInternalException("Routing Configuration conflict: "
            + prevValue.toString() + " conflicts with " + method.toString());
      }
    }

    return result;
  }
View Full Code Here

    if (_errorResponseFormat.showHeaders())
    {
      final ProtocolVersion protocolVersion = ProtocolVersionUtil.extractProtocolVersion(headers);
      headers.put(HeaderUtil.getErrorResponseHeaderName(protocolVersion), RestConstants.HEADER_VALUE_ERROR);
    }
    final ResourceMethod type;
    if (routingResult != null && routingResult.getResourceMethod() != null)
    {
      type = routingResult.getResourceMethod().getMethodType();
    }
    else
View Full Code Here

  @SuppressWarnings("deprecation")
  public void testDeprecatedRequestCreation()
      throws URISyntaxException, RemoteInvocationException
  {
    URI uri = new URI("greetings/1");
    ResourceMethod method = ResourceMethod.GET;
    RecordTemplate inputRecord = null;
    Map<String, String> headers = Collections.emptyMap();
    RestResponseDecoder<Greeting> decoder = new EntityResponseDecoder<Greeting>(Greeting.class);
    ResourceSpec resourceSpec = new ResourceSpecImpl(EnumSet.of(method), null, null, Long.class, Greeting.class, Collections.<String, Object>emptyMap());
    Request<Greeting> request = new Request<Greeting>(uri, method, inputRecord, headers, decoder, resourceSpec);
View Full Code Here

  private void buildSupportsArray(final ResourceModel resourceModel, final StringArray supportsArray)
  {
    List<String> supportsStrings = new ArrayList<String>();
    for (ResourceMethodDescriptor resourceMethodDescriptor : resourceModel.getResourceMethodDescriptors())
    {
      ResourceMethod type = resourceMethodDescriptor.getType();
      if (! type.equals(ResourceMethod.FINDER) &&
          ! type.equals(ResourceMethod.ACTION))
      {
        supportsStrings.add(type.toString());
      }
    }

    Collections.sort(supportsStrings);
View Full Code Here

      return;
    }

    for (ResourceMethodDescriptor descriptor : model.getResourceMethodDescriptors())
    {
      ResourceMethod type = descriptor.getType();

      if (!RestConstants.SIMPLE_RESOURCE_METHODS.contains(type))
      {
        throw new ResourceConfigException(
            String.format(
                "Resource '%s' is a simple resource but it contains a method of type %s" +
                " which is not supported on simple resources.",
                                                        model.getName(),
                                                        type.toString()));
      }
    }
  }
View Full Code Here

  {
    Map<ResourceMethod, ResourceMethodDescriptor> crudMethods =
        new HashMap<ResourceMethod, ResourceMethodDescriptor>();
    for (ResourceMethodDescriptor descriptor : model.getResourceMethodDescriptors())
    {
      ResourceMethod type = descriptor.getType();
      switch (type)
      {
        case ACTION:
          continue;
        case FINDER:
          continue;
        default:
          if (crudMethods.containsKey(type))
          {
            ResourceMethodDescriptor oldDescriptor = crudMethods.get(type);
            throw new ResourceConfigException(String.format("Resource '%s' contains duplicate methods of type '%s'.  Methods are '%s' and '%s'.",
                                                            model.getName(),
                                                            type.toString(),
                                                            oldDescriptor.getMethod()
                                                                         .getName(),
                                                            descriptor.getMethod()
                                                                      .getName()));
          }
View Full Code Here

    List<Class<?>> parameterTypes = Arrays.asList(method.getParameterTypes());
    boolean partial =
        parameterTypes.contains(PatchRequest.class)
            || parameterTypes.contains(BatchPatchRequest.class);
    ResourceMethod resourceMethod =
        ResourceMethodLookup.fromResourceMethodName(method.getName(), partial);

    if (resourceMethod != null)
    {
      if (!Modifier.isPublic(method.getModifiers()))
View Full Code Here

                                            final Method method)
  {
    boolean restMethodAnnotationFound = false;
    for (Annotation methodAnnotation : method.getAnnotations())
    {
      ResourceMethod resourceMethod =
          RestMethod.getResourceMethod(methodAnnotation.annotationType());
      if (resourceMethod != null)
      {
        if (restMethodAnnotationFound)
        {
View Full Code Here

TOP

Related Classes of com.linkedin.restli.common.ResourceMethod

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.