程序包 org.xmeta.util

类 RefactorUtil

java.lang.Object
org.xmeta.util.RefactorUtil

public class RefactorUtil extends Object
  • 方法详细资料

    • getInstance

      public static RefactorUtil getInstance()
      在X-Meta的Groovy脚本中,如果使用线程直接访问RefactorUtil的静态方法,会出现类装载器 不一致而导致类型转换错误,故使用此方法在启动线程前获得类。
      返回:
      实例
    • refactor

      public void refactor(String sourcePath, String targetPath, RefactorListener listener)

      重构,重构目录或模型,必须是目录重构为目录,模型重构为模型,不支持子模型的重构。

      重构会检查所有模型以便确保更新所有引用,因此会比较耗时。

      如果重构出错需手工处理,现在还不支持回滚操作。

      重构的流程是: 1. 计算要移动和更新的模型总数,模型总数也是操作数量的总数。 2. 进行拷贝操作,把原模型拷贝到目标模型。 3. 更新所有的模型对原目标的引用到目标模型,操作可能是更新或未更新。 4. 删除原模型。
      参数:
      sourcePath - 原路径,目录或模型
      targetPath - 目标路径,目录或模型
      listener - 监听器
    • replaceAll

      public static void replaceAll(String replaceFor, String replaceWidth, RefactorListener listener)
      用目标字符串替换所有模型的所有属性的字符串中包含源字符串。
      参数:
      replaceFor - 要替换的
      replaceWidth - 替换为的字符串
      listener - 监听器
    • changeOldPathToNewRule

      public static void changeOldPathToNewRule(RefactorListener listener)
      把旧的路径命名规则改为新的路径命名规则。
      参数:
      listener - 监听器
    • getAllThingIndexs

      public static void getAllThingIndexs(List<Index> thingIndexs, Index index)