org.apache.cayenne.util.Util.cloneViaSerialization()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(2.1k)|赞(0)|评价(0)|浏览(222)

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

Util.cloneViaSerialization介绍

[英]Creates Serializable object copy using serialization/deserialization.
[中]使用序列化/反序列化创建可序列化的对象副本。

代码示例

代码示例来源:origin: org.apache.cayenne/cayenne-nodeps

void setPrefetchTree(PrefetchTreeNode prefetchTree) {
  if (prefetchTree != null) {
    // importnat: make a clone to allow modification independent from the
    // caller...
    try {
      prefetchTree = (PrefetchTreeNode) Util
          .cloneViaSerialization(prefetchTree);
    }
    catch (CayenneRuntimeException e) {
      throw e;
    }
    catch (Exception e) {
      throw new CayenneRuntimeException("Error cloning prefetch tree", e);
    }
  }
  this.prefetchTree = prefetchTree;
}

代码示例来源:origin: org.apache.cayenne/cayenne-nodeps

.cloneViaSerialization(message);
  break;
      .getEntityResolver());
case JAVA_SERIALIZATION:
  return Util.cloneViaSerialization(result);
default:
  return result;

代码示例来源:origin: org.apache.cayenne/cayenne-server

void onLocalEvent(CayenneEvent event) throws Exception {
    // ignore events posted by this Bridge...
    if (event.getSource() != getExternalEventSource()
        && event.getPostedBy() != EventBridge.this) {
      // make sure external event has the right subject, if not make a clone
      // with the right one...
      if (!subject.equals(event.getSubject())) {
        CayenneEvent clone = (CayenneEvent) Util.cloneViaSerialization(event);
        clone.setSubject(subject);
        clone.setPostedBy(event.getPostedBy());
        clone.setSource(event.getSource());
        event = clone;
      }
      sendExternalEvent(event);
    }
  }
}

代码示例来源:origin: org.apache.cayenne/cayenne-nodeps

void onLocalEvent(CayenneEvent event) throws Exception {
    // ignore events posted by this Bridge...
    if (event.getSource() != getExternalEventSource()
        && event.getPostedBy() != EventBridge.this) {
      // make sure external event has the right subject, if not make a clone
      // with the right one...
      if (!subject.equals(event.getSubject())) {
        CayenneEvent clone = (CayenneEvent) Util.cloneViaSerialization(event);
        clone.setSubject(subject);
        clone.setPostedBy(event.getPostedBy());
        clone.setSource(event.getSource());
        event = clone;
      }
      sendExternalEvent(event);
    }
  }
}

相关文章