Codota Logo
EitherTypeAdapter.createLeft
Code IndexAdd Codota 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)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
List l =
  • Codota Iconnew LinkedList()
  • Codota IconCollections.emptyList()
  • Codota Iconnew ArrayList()
  • Smart code suggestions by Codota
}
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

  • Parsing JSON documents to java classes using gson
  • onCreateOptionsMenu (Activity)
  • getSystemService (Context)
  • setRequestProperty (URLConnection)
    Sets the general request property. If a property with the key already exists, overwrite its value wi
  • Container (java.awt)
    A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT co
  • PrintWriter (java.io)
    Prints formatted representations of objects to a text-output stream. This class implements all of th
  • Enumeration (java.util)
    A legacy iteration interface.New code should use Iterator instead. Iterator replaces the enumeration
  • Iterator (java.util)
    An iterator over a collection. Iterator takes the place of Enumeration in the Java Collections Frame
  • JFrame (javax.swing)
  • Reflections (org.reflections)
    Reflections one-stop-shop objectReflections scans your classpath, indexes the metadata, allows you t
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now