org.mozilla.javascript.ScriptableObject.delete()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 JavaScript  
字(4.9k)|赞(0)|评价(0)|浏览(135)

本文整理了Java中org.mozilla.javascript.ScriptableObject.delete()方法的一些代码示例,展示了ScriptableObject.delete()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ScriptableObject.delete()方法的具体详情如下:
包路径:org.mozilla.javascript.ScriptableObject
类名称:ScriptableObject
方法名:delete

ScriptableObject.delete介绍

[英]Removes the indexed property from the object. If the property is not found, or it has the PERMANENT attribute, no action is taken.
[中]从对象中删除索引属性。如果找不到该属性,或者该属性具有永久属性,则不会采取任何操作。

代码示例

代码示例来源:origin: org.apache.cocoon/cocoon-flowscript-impl

public void delete(int index) {
  if (scope == null) {
    super.delete(index);
  } else {
    scope.delete(this, index);
  }
}

代码示例来源:origin: org.apache.cocoon/cocoon-flowscript-impl

public void delete(String name) {
  if (scope == null) {
    super.delete(name);
  } else {
    scope.delete(this, name);
  }
}

代码示例来源:origin: geogebra/geogebra

/**
 * Attach the specified object to this object, and delegate all indexed property lookups to it. In other words,
 * if the object has 3 elements, then an attempt to look up or modify "[0]", "[1]", or "[2]" will be delegated
 * to this object. Additional indexed properties outside the range specified, and additional non-indexed
 * properties, may still be added. The object specified must implement the ExternalArrayData interface.
 *
 * @param array the List to use for delegated property access. Set this to null to revert back to regular
 *              property access.
 * @since 1.7.6
 */
public void setExternalArrayData(ExternalArrayData array)
{
  externalData = array;
  if (array == null) {
    delete("length");
  } else {
    // Define "length" to return whatever length the List gives us.
    defineProperty("length", null,
            GET_ARRAY_LENGTH, null, READONLY | DONTENUM);
  }
}

代码示例来源:origin: org.apache.cocoon/cocoon-forms-impl

public void delete(int index) {
  if (delegate instanceof Repeater) {
    Repeater repeater = (Repeater)delegate;
    if (index >= 0 && index < repeater.getSize()) {
      repeater.removeRow(index);
      return;
    }
  } else if (delegate instanceof MultiValueField) {
    MultiValueField field = (MultiValueField)delegate;
    Object[] values = (Object[])field.getValue();
    if (values != null && values.length > index) {
      Object[] newValues = new Object[values.length-1];
      int i;
      for (i = 0; i < index; i++) {
        newValues[i] = values[i];
      }
      i++;
      for (;i < values.length;i++) {
        newValues[i-1] = values[i];
      }
      field.setValues(newValues);
    }
    return;
  }
  super.delete(index);
}

代码示例来源:origin: geogebra/geogebra

@Override
public void delete(String name)
{
  int info = findInstanceIdInfo(name);
  if (info != 0) {
    // Let the super class to throw exceptions for sealed objects
    if (!isSealed()) {
      int attr = (info >>> 16);
      if ((attr & PERMANENT) == 0) {
        int id = (info & 0xFFFF);
        setInstanceIdValue(id, NOT_FOUND);
      }
      return;
    }
  }
  if (prototypeValues != null) {
    int id = prototypeValues.findId(name);
    if (id != 0) {
      if (!isSealed()) {
        prototypeValues.delete(id);
      }
      return;
    }
  }
  super.delete(name);
}

代码示例来源:origin: rhino/js

@Override
public void delete(String name)
{
  int info = findInstanceIdInfo(name);
  if (info != 0) {
    // Let the super class to throw exceptions for sealed objects
    if (!isSealed()) {
      int attr = (info >>> 16);
      if ((attr & PERMANENT) == 0) {
        int id = (info & 0xFFFF);
        setInstanceIdValue(id, NOT_FOUND);
      }
      return;
    }
  }
  if (prototypeValues != null) {
    int id = prototypeValues.findId(name);
    if (id != 0) {
      if (!isSealed()) {
        prototypeValues.delete(id);
      }
      return;
    }
  }
  super.delete(name);
}

代码示例来源:origin: ro.isdc.wro4j/rhino

@Override
public void delete(String name)
{
  int info = findInstanceIdInfo(name);
  if (info != 0) {
    // Let the super class to throw exceptions for sealed objects
    if (!isSealed()) {
      int attr = (info >>> 16);
      if ((attr & PERMANENT) == 0) {
        int id = (info & 0xFFFF);
        setInstanceIdValue(id, NOT_FOUND);
      }
      return;
    }
  }
  if (prototypeValues != null) {
    int id = prototypeValues.findId(name);
    if (id != 0) {
      if (!isSealed()) {
        prototypeValues.delete(id);
      }
      return;
    }
  }
  super.delete(name);
}

代码示例来源:origin: com.sun.phobos/phobos-rhino

public void delete(String name)
{
  int info = findInstanceIdInfo(name);
  if (info != 0) {
    // Let the super class to throw exceptions for sealed objects
    if (!isSealed()) {
      int attr = (info >>> 16);
      if ((attr & PERMANENT) == 0) {
        int id = (info & 0xFFFF);
        setInstanceIdValue(id, NOT_FOUND);
      }
      return;
    }
  }
  if (prototypeValues != null) {
    int id = prototypeValues.findId(name);
    if (id != 0) {
      if (!isSealed()) {
        prototypeValues.delete(id);
      }
      return;
    }
  }
  super.delete(name);
}

代码示例来源:origin: com.github.tntim96/rhino

@Override
public void delete(String name)
{
  int info = findInstanceIdInfo(name);
  if (info != 0) {
    // Let the super class to throw exceptions for sealed objects
    if (!isSealed()) {
      int attr = (info >>> 16);
      if ((attr & PERMANENT) == 0) {
        int id = (info & 0xFFFF);
        setInstanceIdValue(id, NOT_FOUND);
      }
      return;
    }
  }
  if (prototypeValues != null) {
    int id = prototypeValues.findId(name);
    if (id != 0) {
      if (!isSealed()) {
        prototypeValues.delete(id);
      }
      return;
    }
  }
  super.delete(name);
}

代码示例来源:origin: io.apigee/rhino

@Override
public void delete(String name)
{
  int info = findInstanceIdInfo(name);
  if (info != 0) {
    // Let the super class to throw exceptions for sealed objects
    if (!isSealed()) {
      int attr = (info >>> 16);
      if ((attr & PERMANENT) == 0) {
        int id = (info & 0xFFFF);
        setInstanceIdValue(id, NOT_FOUND);
      }
      return;
    }
  }
  if (prototypeValues != null) {
    int id = prototypeValues.findId(name);
    if (id != 0) {
      if (!isSealed()) {
        prototypeValues.delete(id);
      }
      return;
    }
  }
  super.delete(name);
}

相关文章

微信公众号

ScriptableObject类方法