Java Javascript Mozilla Library getProperty(Scriptable obj, final String prop)

Here you can find the source of getProperty(Scriptable obj, final String prop)

Description

get Property

License

LGPL

Declaration

public static Object getProperty(Scriptable obj, final String prop) throws NoSuchFieldException 

Method Source Code

//package com.java2s;
//License from project: LGPL 

import org.mozilla.javascript.Scriptable;

public class Main {
    public static Object getProperty(Scriptable obj, final String prop) throws NoSuchFieldException {
        while (obj != null) {
            final Object val = obj.get(prop, obj);
            if (val != Scriptable.NOT_FOUND) {
                return val;
            }/* w ww  . j  av a  2s.  c  om*/
            obj = obj.getPrototype();
        }
        throw new NoSuchFieldException(prop);
    }
}

Related

  1. getGlobalContextForValidation()
  2. getJavaObject(Scriptable scope, String name)
  3. getJsArray(Scriptable scope, Vector v)
  4. getMapArgument(Object[] args, int pos)
  5. getObjectArgument(Object[] args, int pos, Object defaultValue)
  6. getPropertyName(AstNode propKeyNode)
  7. getPrototypeClazz(List nodes)
  8. getScriptableArgument(Object[] args, int pos, boolean allowNull)
  9. getStaticProperty(Scriptable mixin, String name)