• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java PropertyDescriptor类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中jdk.nashorn.internal.runtime.PropertyDescriptor的典型用法代码示例。如果您正苦于以下问题:Java PropertyDescriptor类的具体用法?Java PropertyDescriptor怎么用?Java PropertyDescriptor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



PropertyDescriptor类属于jdk.nashorn.internal.runtime包,在下文中一共展示了PropertyDescriptor类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: fillFrom

import jdk.nashorn.internal.runtime.PropertyDescriptor; //导入依赖的package包/类
@Override
public PropertyDescriptor fillFrom(final ScriptObject sobj) {
    if (sobj.has(CONFIGURABLE)) {
        this.configurable = JSType.toBoolean(sobj.get(CONFIGURABLE));
    } else {
        delete(CONFIGURABLE, false);
    }

    if (sobj.has(ENUMERABLE)) {
        this.enumerable = JSType.toBoolean(sobj.get(ENUMERABLE));
    } else {
        delete(ENUMERABLE, false);
    }

    return this;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:17,代码来源:GenericPropertyDescriptor.java


示例2: hasAndEquals

import jdk.nashorn.internal.runtime.PropertyDescriptor; //导入依赖的package包/类
@Override
public boolean hasAndEquals(final PropertyDescriptor other) {
    if (has(CONFIGURABLE) && other.has(CONFIGURABLE)) {
        if (isConfigurable() != other.isConfigurable()) {
            return false;
        }
    }

    if (has(ENUMERABLE) && other.has(ENUMERABLE)) {
        if (isEnumerable() != other.isEnumerable()) {
            return false;
        }
    }

    return true;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:17,代码来源:GenericPropertyDescriptor.java


示例3: defineOwnProperty

import jdk.nashorn.internal.runtime.PropertyDescriptor; //导入依赖的package包/类
/**
 * ECMA 15.4.5.1 [[DefineOwnProperty]] ( P, Desc, Throw ) as specialized in
 * ECMA 10.6 for Arguments object.
 */
@Override
public boolean defineOwnProperty(final String key, final Object propertyDesc, final boolean reject) {
    final int index = ArrayIndex.getArrayIndex(key);
    if (index >= 0) {
        final boolean isMapped = isMapped(index);
        final Object oldValue = isMapped ? getArray().getObject(index) : null;

        if (!super.defineOwnProperty(key, propertyDesc, false)) {
            if (reject) {
                throw typeError("cant.redefine.property",  key, ScriptRuntime.safeToString(this));
            }
            return false;
        }

        if (isMapped) {
            // When mapped argument is redefined, if new descriptor is accessor property
            // or data-non-writable property, we have to "unmap" (unlink).
            final PropertyDescriptor desc = toPropertyDescriptor(Global.instance(), propertyDesc);
            if (desc.type() == PropertyDescriptor.ACCESSOR) {
                setDeleted(index, oldValue);
            } else if (desc.has(PropertyDescriptor.WRITABLE) && !desc.isWritable()) {
                // delete and set value from new descriptor if it has one, otherwise use old value
                setDeleted(index, desc.has(PropertyDescriptor.VALUE) ? desc.getValue() : oldValue);
            } else if (desc.has(PropertyDescriptor.VALUE)) {
                setArray(getArray().set(index, desc.getValue(), false));
            }
        }

        return true;
    }

    return super.defineOwnProperty(key, propertyDesc, reject);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:38,代码来源:NativeArguments.java


示例4: newAccessorDescriptor

import jdk.nashorn.internal.runtime.PropertyDescriptor; //导入依赖的package包/类
/**
 * Create a new ECMAScript AccessorPropertyDescriptor object.
 *
 * @param get getter function of the user accessor property
 * @param set setter function of the user accessor property
 * @param configurable is the property configurable?
 * @param enumerable is the property enumerable?
 * @return newly created AccessorPropertyDescriptor object
 */
public PropertyDescriptor newAccessorDescriptor(final Object get, final Object set, final boolean configurable, final boolean enumerable) {
    final AccessorPropertyDescriptor desc = new AccessorPropertyDescriptor(configurable, enumerable, get == null ? UNDEFINED : get, set == null ? UNDEFINED : set, this);

    if (get == null) {
        desc.delete(PropertyDescriptor.GET, false);
    }

    if (set == null) {
        desc.delete(PropertyDescriptor.SET, false);
    }

    return desc;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:23,代码来源:Global.java


示例5: fillFrom

import jdk.nashorn.internal.runtime.PropertyDescriptor; //导入依赖的package包/类
@Override
public PropertyDescriptor fillFrom(final ScriptObject sobj) {
    if (sobj.has(CONFIGURABLE)) {
        this.configurable = JSType.toBoolean(sobj.get(CONFIGURABLE));
    } else {
        delete(CONFIGURABLE, false);
    }

    if (sobj.has(ENUMERABLE)) {
        this.enumerable = JSType.toBoolean(sobj.get(ENUMERABLE));
    } else {
        delete(ENUMERABLE, false);
    }

    if (sobj.has(WRITABLE)) {
        this.writable = JSType.toBoolean(sobj.get(WRITABLE));
    } else {
        delete(WRITABLE, false);
    }

    if (sobj.has(VALUE)) {
        this.value = sobj.get(VALUE);
    } else {
        delete(VALUE, false);
    }

    return this;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:29,代码来源:DataPropertyDescriptor.java


示例6: hasAndEquals

import jdk.nashorn.internal.runtime.PropertyDescriptor; //导入依赖的package包/类
@Override
public boolean hasAndEquals(final PropertyDescriptor otherDesc) {
    if (! (otherDesc instanceof DataPropertyDescriptor)) {
        return false;
    }

    final DataPropertyDescriptor other = (DataPropertyDescriptor)otherDesc;
    return (!has(CONFIGURABLE) || sameValue(configurable, other.configurable)) &&
           (!has(ENUMERABLE) || sameValue(enumerable, other.enumerable)) &&
           (!has(WRITABLE) || sameValue(writable, other.writable)) &&
           (!has(VALUE) || sameValue(value, other.value));
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:13,代码来源:DataPropertyDescriptor.java


示例7: fillFrom

import jdk.nashorn.internal.runtime.PropertyDescriptor; //导入依赖的package包/类
@Override
public PropertyDescriptor fillFrom(final ScriptObject sobj) {
    if (sobj.has(CONFIGURABLE)) {
        this.configurable = JSType.toBoolean(sobj.get(CONFIGURABLE));
    } else {
        delete(CONFIGURABLE, false);
    }

    if (sobj.has(ENUMERABLE)) {
        this.enumerable = JSType.toBoolean(sobj.get(ENUMERABLE));
    } else {
        delete(ENUMERABLE, false);
    }

    if (sobj.has(GET)) {
        final Object getter = sobj.get(GET);
        if (getter == UNDEFINED || getter instanceof ScriptFunction) {
            this.get = getter;
        } else {
            throw typeError("not.a.function", ScriptRuntime.safeToString(getter));
        }
    } else {
        delete(GET, false);
    }

    if (sobj.has(SET)) {
        final Object setter = sobj.get(SET);
        if (setter == UNDEFINED || setter instanceof ScriptFunction) {
            this.set = setter;
        } else {
            throw typeError("not.a.function", ScriptRuntime.safeToString(setter));
        }
    } else {
        delete(SET, false);
    }

    return this;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:39,代码来源:AccessorPropertyDescriptor.java


示例8: hasAndEquals

import jdk.nashorn.internal.runtime.PropertyDescriptor; //导入依赖的package包/类
@Override
public boolean hasAndEquals(final PropertyDescriptor otherDesc) {
    if (! (otherDesc instanceof AccessorPropertyDescriptor)) {
        return false;
    }
    final AccessorPropertyDescriptor other = (AccessorPropertyDescriptor)otherDesc;
    return (!has(CONFIGURABLE) || sameValue(configurable, other.configurable)) &&
           (!has(ENUMERABLE) || sameValue(enumerable, other.enumerable)) &&
           (!has(GET) || sameValue(get, other.get)) &&
           (!has(SET) || sameValue(set, other.set));
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:12,代码来源:AccessorPropertyDescriptor.java


示例9: defineOwnProperty

import jdk.nashorn.internal.runtime.PropertyDescriptor; //导入依赖的package包/类
/**
 * ECMA 15.4.5.1 [[DefineOwnProperty]] ( P, Desc, Throw ) as specialized in
 * ECMA 10.6 for Arguments object.
 */
@Override
public boolean defineOwnProperty(final Object key, final Object propertyDesc, final boolean reject) {
    final int index = ArrayIndex.getArrayIndex(key);
    if (index >= 0) {
        final boolean isMapped = isMapped(index);
        final Object oldValue = isMapped ? getArray().getObject(index) : null;

        if (!super.defineOwnProperty(key, propertyDesc, false)) {
            if (reject) {
                throw typeError("cant.redefine.property",  key.toString(), ScriptRuntime.safeToString(this));
            }
            return false;
        }

        if (isMapped) {
            // When mapped argument is redefined, if new descriptor is accessor property
            // or data-non-writable property, we have to "unmap" (unlink).
            final PropertyDescriptor desc = toPropertyDescriptor(Global.instance(), propertyDesc);
            if (desc.type() == PropertyDescriptor.ACCESSOR) {
                setDeleted(index, oldValue);
            } else if (desc.has(PropertyDescriptor.WRITABLE) && !desc.isWritable()) {
                // delete and set value from new descriptor if it has one, otherwise use old value
                setDeleted(index, desc.has(PropertyDescriptor.VALUE) ? desc.getValue() : oldValue);
            } else if (desc.has(PropertyDescriptor.VALUE)) {
                setArray(getArray().set(index, desc.getValue(), false));
            }
        }

        return true;
    }

    return super.defineOwnProperty(key, propertyDesc, reject);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:38,代码来源:NativeArguments.java



注:本文中的jdk.nashorn.internal.runtime.PropertyDescriptor类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ServiceInfo类代码示例发布时间:2022-05-22
下一篇:
Java PrincipalException类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap