congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
EitherTypeAdapter.createLeft
Code IndexAdd Tabnine to your IDE (free)

How to use
createLeft
method
in
org.eclipse.lsp4j.jsonrpc.json.adapters.EitherTypeAdapter

Best Java code snippets using org.eclipse.lsp4j.jsonrpc.json.adapters.EitherTypeAdapter.createLeft (Showing top 2 results out of 315)

origin: eclipse/lsp4j

protected Either<L, R> create(JsonToken nextToken, JsonReader in) throws IOException {
  boolean matchesLeft = left.isAssignable(nextToken);
  boolean matchesRight = right.isAssignable(nextToken);
  if (matchesLeft && matchesRight) {
    if (leftChecker != null || rightChecker != null) {
      JsonElement element = new JsonParser().parse(in);
      if (leftChecker != null && leftChecker.test(element))
        // Parse the left alternative from the JSON element tree
        return createLeft(left.read(element));
      if (rightChecker != null && rightChecker.test(element))
        // Parse the right alternative from the JSON element tree
        return createRight(right.read(element));
    }
    throw new JsonParseException("Ambiguous Either type: token " + nextToken + " matches both alternatives.");
  } else if (matchesLeft) {
    // Parse the left alternative from the JSON stream
    return createLeft(left.read(in));
  } else if (matchesRight) {
    // Parse the right alternative from the JSON stream
    return createRight(right.read(in));
  } else {
    throw new JsonParseException("Unexpected token " + nextToken + ": expected " + left + " | " + right + " tokens.");
  }
}

origin: org.eclipse.lsp4j/org.eclipse.lsp4j.jsonrpc

protected Either<L, R> create(JsonToken nextToken, JsonReader in) throws IOException {
  boolean matchesLeft = left.isAssignable(nextToken);
  boolean matchesRight = right.isAssignable(nextToken);
  if (matchesLeft && matchesRight) {
    if (leftChecker != null || rightChecker != null) {
      JsonElement element = new JsonParser().parse(in);
      if (leftChecker != null && leftChecker.test(element))
        // Parse the left alternative from the JSON element tree
        return createLeft(left.read(element));
      if (rightChecker != null && rightChecker.test(element))
        // Parse the right alternative from the JSON element tree
        return createRight(right.read(element));
    }
    throw new JsonParseException("Ambiguous Either type: token " + nextToken + " matches both alternatives.");
  } else if (matchesLeft) {
    // Parse the left alternative from the JSON stream
    return createLeft(left.read(in));
  } else if (matchesRight) {
    // Parse the right alternative from the JSON stream
    return createRight(right.read(in));
  } else {
    throw new JsonParseException("Unexpected token " + nextToken + ": expected " + left + " | " + right + " tokens.");
  }
}

org.eclipse.lsp4j.jsonrpc.json.adaptersEitherTypeAdaptercreateLeft

Popular methods of EitherTypeAdapter

  • <init>
  • create
  • createRight

Popular in Java

  • Creating JSON documents from java classes using gson
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • putExtra (Intent)
  • scheduleAtFixedRate (Timer)
  • BufferedImage (java.awt.image)
    The BufferedImage subclass describes an java.awt.Image with an accessible buffer of image data. All
  • BitSet (java.util)
    The BitSet class implements abit array [http://en.wikipedia.org/wiki/Bit_array]. Each element is eit
  • Map (java.util)
    A Map is a data structure consisting of a set of keys and values in which each key is mapped to a si
  • ExecutorService (java.util.concurrent)
    An Executor that provides methods to manage termination and methods that can produce a Future for tr
  • Servlet (javax.servlet)
    Defines methods that all servlets must implement. A servlet is a small Java program that runs within
  • HttpServletRequest (javax.servlet.http)
    Extends the javax.servlet.ServletRequest interface to provide request information for HTTP servlets.
  • 14 Best Plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now