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

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

Best Java code snippets using org.eclipse.lsp4j.jsonrpc.json.adapters.EitherTypeAdapter.createRight (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.adaptersEitherTypeAdaptercreateRight

Popular methods of EitherTypeAdapter

  • <init>
  • create
  • createLeft

Popular in Java

  • Finding current android device location
  • scheduleAtFixedRate (Timer)
  • notifyDataSetChanged (ArrayAdapter)
  • getExternalFilesDir (Context)
  • Component (java.awt)
    A component is an object having a graphical representation that can be displayed on the screen and t
  • SecureRandom (java.security)
    This class generates cryptographically secure pseudo-random numbers. It is best to invoke SecureRand
  • BitSet (java.util)
    The BitSet class implements abit array [http://en.wikipedia.org/wiki/Bit_array]. Each element is eit
  • HashSet (java.util)
    HashSet is an implementation of a Set. All optional operations (adding and removing) are supported.
  • Timer (java.util)
    Timers schedule one-shot or recurring TimerTask for execution. Prefer java.util.concurrent.Scheduled
  • Options (org.apache.commons.cli)
    Main entry-point into the library. Options represents a collection of Option objects, which describ
  • Top 17 Free Sublime Text Plugins
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