Tabnine Logo
PolyglotEngineWithJavaScript$Moment.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
com.oracle.truffle.tck.impl.PolyglotEngineWithJavaScript$Moment
constructor

Best Java code snippets using com.oracle.truffle.tck.impl.PolyglotEngineWithJavaScript$Moment.<init> (Showing top 4 results out of 315)

origin: org.graalvm.truffle/truffle-tck

public void accessFieldsOfJavaObject() {
  Source src = Source.newBuilder("js", "" +
    "(function(t) {\n" +
    "  return 3600 * t.hours + 60 * t.minutes + t.seconds;\n" +
    "})\n",
    "MomentToSeconds.js").buildLiteral();
  final Moment javaMoment = new Moment(6, 30, 10);
  // Evaluate the JavaScript function definition
  Value jsFunction = context.eval(src);
  // Execute the JavaScript function, passing a Java object argument
  Value jsSeconds = jsFunction.execute(javaMoment);
  // Convert foreign object result to desired Java type
  int seconds = jsSeconds.as(Number.class).intValue();
  assertEquals(3600 * 6 + 30 * 60 + 10, seconds);
}
// END: com.oracle.truffle.tck.impl.PolyglotEngineWithJavaScript#accessFieldsOfJavaObject
origin: com.oracle.truffle/truffle-tck

public void accessFieldsOfJavaObject() {
  Source src = Source.newBuilder("js", "" +
    "(function(t) {\n" +
    "  return 3600 * t.hours + 60 * t.minutes + t.seconds;\n" +
    "})\n",
    "MomentToSeconds.js").buildLiteral();
  final Moment javaMoment = new Moment(6, 30, 10);
  // Evaluate the JavaScript function definition
  Value jsFunction = context.eval(src);
  // Execute the JavaScript function, passing a Java object argument
  Value jsSeconds = jsFunction.execute(javaMoment);
  // Convert foreign object result to desired Java type
  int seconds = jsSeconds.as(Number.class).intValue();
  assertEquals(3600 * 6 + 30 * 60 + 10, seconds);
}
// END: com.oracle.truffle.tck.impl.PolyglotEngineWithJavaScript#accessFieldsOfJavaObject
origin: com.oracle.truffle/truffle-tck

public void accessFieldsOfJavaObjectWithConverter() {
  Source src = Source.newBuilder("js", "" +
    "(function(t) {\n" +
    "  return 3600 * t.hours + 60 * t.minutes + t.seconds;\n" +
    "})\n",
    "MomentToSeconds.js").buildLiteral();
  final Moment javaMoment = new Moment(6, 30, 10);
  // Evaluate the JavaScript function definition
  final Value jsFunction = context.eval(src);
  // Convert the function to desired Java type
  MomentConverter converter = jsFunction.as(MomentConverter.class);
  // Execute the JavaScript function as a Java foreign function
  int seconds = converter.toSeconds(javaMoment);
  assertEquals(3600 * 6 + 30 * 60 + 10, seconds);
}
// END: com.oracle.truffle.tck.impl.PolyglotEngineWithJavaScript#accessFieldsOfJavaObjectWithConverter
origin: org.graalvm.truffle/truffle-tck

public void accessFieldsOfJavaObjectWithConverter() {
  Source src = Source.newBuilder("js", "" +
    "(function(t) {\n" +
    "  return 3600 * t.hours + 60 * t.minutes + t.seconds;\n" +
    "})\n",
    "MomentToSeconds.js").buildLiteral();
  final Moment javaMoment = new Moment(6, 30, 10);
  // Evaluate the JavaScript function definition
  final Value jsFunction = context.eval(src);
  // Convert the function to desired Java type
  MomentConverter converter = jsFunction.as(MomentConverter.class);
  // Execute the JavaScript function as a Java foreign function
  int seconds = converter.toSeconds(javaMoment);
  assertEquals(3600 * 6 + 30 * 60 + 10, seconds);
}
// END: com.oracle.truffle.tck.impl.PolyglotEngineWithJavaScript#accessFieldsOfJavaObjectWithConverter
com.oracle.truffle.tck.implPolyglotEngineWithJavaScript$Moment<init>

Popular methods of PolyglotEngineWithJavaScript$Moment

    Popular in Java

    • Parsing JSON documents to java classes using gson
    • compareTo (BigDecimal)
    • notifyDataSetChanged (ArrayAdapter)
    • getContentResolver (Context)
    • Socket (java.net)
      Provides a client-side TCP socket.
    • URLEncoder (java.net)
      This class is used to encode a string using the format required by application/x-www-form-urlencoded
    • Time (java.sql)
      Java representation of an SQL TIME value. Provides utilities to format and parse the time's represen
    • GregorianCalendar (java.util)
      GregorianCalendar is a concrete subclass of Calendarand provides the standard calendar used by most
    • JarFile (java.util.jar)
      JarFile is used to read jar entries and their associated data from jar files.
    • DateTimeFormat (org.joda.time.format)
      Factory that creates instances of DateTimeFormatter from patterns and styles. Datetime formatting i
    • Top 17 Plugins for Android Studio
    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