org.qi4j.lang.javascript

## Class JavaScriptMixin

- java.lang.Object
- - org.qi4j.lang.javascript.JavaScriptMixin

- All Implemented Interfaces:
    InvocationHandler, ScriptReloadable

      @AppliesTo(value=JavaScriptMixin.AppliesTo.class)
      public class JavaScriptMixin
      extends Object
      implements InvocationHandler, ScriptReloadable

  Generic mixin that implements interfaces by delegating to JavaScript functions using Rhino. Each method in an interface is declared as a JS function in a file located in classpath with the name "<interface>.<method>.js", where the interface name includes the package, and has "." replaced with "/".

  Example:

       org/qi4j/samples/hello/domain/HelloWorldSpeaker.say.js

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `JavaScriptMixin.AppliesTo`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `JavaScriptMixin()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Object` | `invoke(Object proxy, Method method, Object[] args)`
    `void` | `reloadScripts()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### JavaScriptMixin

          public JavaScriptMixin()

  - ### Method Detail

    - #### invoke

          public Object invoke(Object proxy,
                      Method method,
                      Object[] args)
                        throws Throwable

      Specified by:
        `invoke` in interface `InvocationHandler`
      Throws:
        `Throwable`

    - #### reloadScripts

          public void reloadScripts()

      Specified by:
        `reloadScripts` in interface `ScriptReloadable`