org.mozilla.javascript.FunctionObject Java Examples
The following examples show how to use
org.mozilla.javascript.FunctionObject.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ScriptingSupport.java From lams with GNU General Public License v2.0 | 6 votes |
private static FunctionObject getFunctionObject( Class aClass, String methodName, Scriptable scriptable ) { Hashtable functionMap = (Hashtable) _classFunctionMaps.get( aClass ); if (functionMap == null) { _classFunctionMaps.put( aClass, functionMap = new Hashtable() ); } Object result = functionMap.get( methodName ); if (result == NO_SUCH_PROPERTY) return null; if (result != null) return (FunctionObject) result; Method[] methods = aClass.getMethods(); for (int i = 0; i < methods.length; i++) { Method method = methods[i]; if (method.getName().equalsIgnoreCase( methodName )) { FunctionObject function = new FunctionObject( methodName, method, scriptable ); functionMap.put( methodName, function ); return function; } } functionMap.put( methodName, NO_SUCH_PROPERTY ); return null; }
Example #2
Source File: RhinoWorkerUtils.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
public static Object toJavaValue(Object object) { if (object == null || object.equals(Context.getUndefinedValue())) { return null; } else if (object.getClass().getPackage().getName().startsWith("java.")) { return object; } else if (object instanceof FunctionObject) { throw new IllegalArgumentException(String.format("Cannot convert function object to value (object: %s)", object)); } else if (object instanceof Scriptable) { return toMap((Scriptable) object); } else { throw new IllegalArgumentException(String.format("Can't convert JS object %s (type: %s) to native Java object", object, object.getClass().getName())); } }
Example #3
Source File: RhinoWorkerUtils.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
public static Object toJavaValue(Object object) { if (object == null || object.equals(Context.getUndefinedValue())) { return null; } else if (object.getClass().getPackage().getName().startsWith("java.")) { return object; } else if (object instanceof FunctionObject) { throw new IllegalArgumentException(String.format("Cannot convert function object to value (object: %s)", object)); } else if (object instanceof Scriptable) { return toMap((Scriptable) object); } else { throw new IllegalArgumentException(String.format("Can't convert JS object %s (type: %s) to native Java object", object, object.getClass().getName())); } }
Example #4
Source File: RhinoWorkerUtils.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
public static Object toJavaValue(Object object) { if (object == null || object.equals(Context.getUndefinedValue())) { return null; } else if (object.getClass().getPackage().getName().startsWith("java.")) { return object; } else if (object instanceof FunctionObject) { throw new IllegalArgumentException(String.format("Cannot convert function object to value (object: %s)", object)); } else if (object instanceof Scriptable) { return toMap((Scriptable) object); } else { throw new IllegalArgumentException(String.format("Can't convert JS object %s (type: %s) to native Java object", object, object.getClass().getName())); } }
Example #5
Source File: RhinoWorkerUtils.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
public static Object toJavaValue(Object object) { if (object == null || object.equals(Context.getUndefinedValue())) { return null; } else if (object.getClass().getPackage().getName().startsWith("java.")) { return object; } else if (object instanceof FunctionObject) { throw new IllegalArgumentException(String.format("Cannot convert function object to value (object: %s)", object)); } else if (object instanceof Scriptable) { return toMap((Scriptable) object); } else { throw new IllegalArgumentException(String.format("Can't convert JS object %s (type: %s) to native Java object", object, object.getClass().getName())); } }
Example #6
Source File: StyleProperties.java From PHONK with GNU General Public License v3.0 | 4 votes |
public static void finishInit(Scriptable scope, FunctionObject constructor, Scriptable prototype) { System.out.println("finishInit is called."); globalPrototype = prototype; }