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

com.linkedin.restli.client.InboundRequestContextImpl Maven / Gradle / Ivy

There is a newer version: 4.0.1
Show newest version
package com.linkedin.restli.client;

import java.util.Optional;

class InboundRequestContextImpl implements InboundRequestContext {

  private final String _name;
  private final String _method;
  private final Optional _finderName;
  private final Optional _actionName;

  public InboundRequestContextImpl(String name, String method, Optional finderName,
      Optional actionName) {
    if (finderName.isPresent()) {
      if (!method.equalsIgnoreCase("FINDER")) {
        throw new IllegalArgumentException("Finder name declared but menthod is not FINDER, it is: " + method);
      }
      if (actionName.isPresent()) {
        throw new IllegalArgumentException("Action name declared but method if FINDER");
      }
    }
    if (actionName.isPresent()) {
      if (!method.equalsIgnoreCase("ACTION")) {
        throw new IllegalArgumentException("Action name declared but menthod is not ACTION, it is: " + method);
      }
    }
    _name = name;
    _method = method;
    _finderName = finderName;
    _actionName = actionName;
  }

  @Override
  public String getName() {
    return _name;
  }

  @Override
  public String getMethod() {
    return _method;
  }

  @Override
  public Optional getFinderName() {
    return _finderName;
  }

  @Override
  public Optional getActionName() {
    return _actionName;
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy