serp.bytecode.BCClass.beforeRename()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(2.7k)|赞(0)|评价(0)|浏览(71)

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

BCClass.beforeRename介绍

[英]Attempts to change the class name with the owning project. The project can reject the change if a class with the given new name already exists; therefore this method should be called before the change is recorded in the class.
[中]尝试更改所属项目的类名。如果已经存在具有给定新名称的类,则项目可以拒绝更改;因此,应该在类中记录更改之前调用此方法。

代码示例

代码示例来源:origin: net.sourceforge.serp/serp

/**
 * Set the {@link ConstantPool} index of the {@link ClassEntry} for this
 * class. Unlike most other low-level methods, the index
 * will be checked against the pool immediately;
 * classes must have a valid name at all times.
 */
public void setIndex(int index) {
  String oldName = getName();
  String newName = ((ClassEntry) getPool().getEntry(index)).
    getNameEntry().getValue();
  beforeRename(oldName, newName);
  _state.setIndex(index);
}

代码示例来源:origin: org.apache.openjpa/openjpa-all

/**
 * Set the {@link ConstantPool} index of the {@link ClassEntry} for this
 * class. Unlike most other low-level methods, the index
 * will be checked against the pool immediately;
 * classes must have a valid name at all times.
 */
public void setIndex(int index) {
  String oldName = getName();
  String newName = ((ClassEntry) getPool().getEntry(index)).
    getNameEntry().getValue();
  beforeRename(oldName, newName);
  _state.setIndex(index);
}

代码示例来源:origin: net.sourceforge.serp/serp

/**
 * Set the name of this class, including package name.
 */
public void setName(String name) {
  name = _project.getNameCache().getExternalForm(name, false);
  String oldName = getName();
  // get a reference to the class entry for this class
  int index = getIndex();
  if (index == 0)
    index = getPool().findClassEntry(name, true);
  ClassEntry entry = (ClassEntry) getPool().getEntry(index);
  // make sure the rename is ok with the project
  beforeRename(oldName, name);
  // reset the name index of the class entry to the new name
  int nameIndex = getPool().findUTF8Entry(_project.getNameCache().
    getInternalForm(name, false), true);
  entry.setNameIndex(nameIndex);
  // we might have just added a new entry; set the index
  _state.setIndex(index);
}

代码示例来源:origin: org.apache.openjpa/openjpa-all

/**
 * Set the name of this class, including package name.
 */
public void setName(String name) {
  name = _project.getNameCache().getExternalForm(name, false);
  String oldName = getName();
  // get a reference to the class entry for this class
  int index = getIndex();
  if (index == 0)
    index = getPool().findClassEntry(name, true);
  ClassEntry entry = (ClassEntry) getPool().getEntry(index);
  // make sure the rename is ok with the project
  beforeRename(oldName, name);
  // reset the name index of the class entry to the new name
  int nameIndex = getPool().findUTF8Entry(_project.getNameCache().
    getInternalForm(name, false), true);
  entry.setNameIndex(nameIndex);
  // we might have just added a new entry; set the index
  _state.setIndex(index);
}

相关文章

微信公众号

最新文章

更多