private Type getProperty()

in src/main/java/org/apache/sling/scripting/javascript/helper/SlingGlobal.java [327:339]


    private <Type> Type getProperty(Context cx, Scriptable scope, String name, Class<Type> type) {
        Object prop = ScriptRuntime.name(cx, scope, name);

        if (prop instanceof Wrapper) {
            prop = ((Wrapper) prop).unwrap();
        }

        if (type.isInstance(prop)) {
            return (Type) prop; // unchecked case
        }

        return null;
    }