Package org.mozilla.javascript

Examples of org.mozilla.javascript.RhinoCustomNativeJavaObject


    protected void registerIndexAndTypes(InternalIndexClient indexClient, InternalTypeClient... typeClients) {
        //We are in a different thread, therefore we cannot rely on the current shell context but we need to create a new one
        Context context = Context.enter();
        try {
            //register index
            NativeJavaObject indexNativeJavaObject = new RhinoCustomNativeJavaObject(shellNativeClient.getParentScope(), indexClient, InternalIndexClient.class);
            indexNativeJavaObject.setPrototype(context.newObject(shellNativeClient.getParentScope()));

            if (typeClients != null) {
                //register types
                for (InternalTypeClient typeClient : typeClients) {
                    NativeJavaObject typeNativeJavaObject = new RhinoCustomNativeJavaObject(shellNativeClient.getParentScope(), typeClient, InternalTypeClient.class);
                    ScriptableObject.putProperty(indexNativeJavaObject, typeClient.typeName(), typeNativeJavaObject);
                }
            }

            logger.trace("Adding index {} to shell native client", indexClient.indexName());
View Full Code Here


    }

    @Override
    public <T> void registerJavaObject(String name, T javaObject) {
        //pretty ugly but works, good enough for now ;)
        RhinoCustomNativeJavaObject rhinoCustomNativeJavaObject;
        if (javaObject instanceof RhinoCustomNativeJavaObject) {
            rhinoCustomNativeJavaObject = (RhinoCustomNativeJavaObject)javaObject;
        } else {
            rhinoCustomNativeJavaObject = new RhinoCustomNativeJavaObject(get(), javaObject, javaObject.getClass());
        }
        ScriptableObject.putProperty(get(), name, rhinoCustomNativeJavaObject);
    }
View Full Code Here

TOP

Related Classes of org.mozilla.javascript.RhinoCustomNativeJavaObject

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.