Java Javascript Mozilla Library getStaticProperty(Scriptable mixin, String name)

Here you can find the source of getStaticProperty(Scriptable mixin, String name)

Description

Replies the static property with name name or Scriptable#NOT_FOUND , if no such property exists.

License

Open Source License

Parameter

Parameter Description
mixin the parsed JavaScript mixin
name the property name

Return

the property or

Declaration

static public Object getStaticProperty(Scriptable mixin, String name) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import org.mozilla.javascript.Scriptable;

public class Main {
    /**/* w w w . j  a v  a 2s  .c  om*/
     * <p>Replies the static property with name <code>name</code> or
     * {@link Scriptable#NOT_FOUND}, if no such property exists.</p>
     *
     * @param mixin  the parsed JavaScript mixin
     * @param name  the property name
     * @return the property or {@link Scriptable#NOT_FOUND}
     */
    static public Object getStaticProperty(Scriptable mixin, String name) {
        Object property = mixin.get(name, mixin);
        if (property != Scriptable.NOT_FOUND
                && property instanceof Scriptable) {
            if (isStaticProperty((Scriptable) property)) {
                return (Scriptable) property;
            }
        }
        return Scriptable.NOT_FOUND;
    }

    /**
     * <p>Replies true if the mixin property <code>propert</code> is a "static" property.</p>
     *
     * @param property  the property as defined in the mixin definition
     * @return true, if this is a static property
     */
    static public boolean isStaticProperty(Scriptable property) {
        Object isStatic = ((Scriptable) property).get("static",
                (Scriptable) property);
        return isStatic != Scriptable.NOT_FOUND
                && isStatic instanceof Boolean && ((Boolean) isStatic);
    }
}

Related

  1. getObjectArgument(Object[] args, int pos, Object defaultValue)
  2. getProperty(Scriptable obj, final String prop)
  3. getPropertyName(AstNode propKeyNode)
  4. getPrototypeClazz(List nodes)
  5. getScriptableArgument(Object[] args, int pos, boolean allowNull)
  6. getStringArgument(Object[] args, int pos, boolean allowNull)
  7. getStringValue(AstNode element)
  8. getXhtmlLinks(Object xhtml)
  9. grabContextFactoryGlobalSetter()