Java Code Examples for org.mozilla.javascript.Scriptable#getPrototype()
The following examples show how to use
org.mozilla.javascript.Scriptable#getPrototype() .
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: ScriptableParameter.java From birt with Eclipse Public License 1.0 | 5 votes |
public Object get( String name, Scriptable scope ) { ParameterAttribute parameter = getParameterAttribute( name ); if ( FIELD_VALUE.equals( name ) ) { return parameter.getValue( ); } else if ( FIELD_DISPLAY_TEXT.equals( name ) ) { return parameter.getDisplayText( ); } Object value = parameter.getValue( ); Scriptable jsValue = Context.toObject( value, scope ); Scriptable prototype = jsValue.getPrototype( ); if( prototype != null ) { Object property = jsValue.getPrototype( ).get( name, jsValue ); if ( property instanceof Callable ) { Callable callable = (Callable) property; return new JsValueCallable( callable, jsValue ); } return jsValue.get( name, jsValue ); } else { return jsValue.get( name, jsValue ); } }
Example 2
Source File: RhinoAsserts.java From caja with Apache License 2.0 | 4 votes |
private static boolean isBaseObject(Scriptable s) { // A direct instance of Object is the only Object whose prototype's // prototype is null. Scriptable proto = s.getPrototype(); return proto != null && proto.getPrototype() == null; }