org.modeshape.schematic.document.Document.with()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(3.8k)|赞(0)|评价(0)|浏览(121)

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

Document.with介绍

[英]Obtain a clone of this document, but with the supplied fields replaced.
[中]获取此文档的克隆,但替换了提供的字段。

代码示例

代码示例来源:origin: org.modeshape/modeshape-schematic

return original.with(changedFields);

代码示例来源:origin: ModeShape/modeshape

return original.with(changedFields);

代码示例来源:origin: ModeShape/modeshape

@Override
public Document with( ValueTransformer transformer ) {
  boolean transformed = false;
  BasicDocument clone = new BasicDocument();
  for (Field field : this.fields()) {
    String name = field.getName();
    Object oldValue = field.getValue();
    Object newValue = null;
    if (oldValue instanceof Document) {
      newValue = ((Document)oldValue).with(transformer);
    } else {
      newValue = transformer.transform(name, oldValue);
    }
    if (newValue != oldValue) transformed = true;
    clone.put(name, unwrap(newValue));
  }
  return transformed ? clone : this;
}

代码示例来源:origin: org.modeshape/modeshape-schematic

@Override
public Array with( ValueTransformer transformer ) {
  boolean transformed = false;
  BasicArray clone = new BasicArray();
  for (Field field : this.fields()) {
    String name = field.getName();
    Object oldValue = field.getValue();
    Object newValue = null;
    if (oldValue instanceof Document) {
      newValue = ((Document)oldValue).with(transformer);
    } else {
      newValue = transformer.transform(name, oldValue);
    }
    if (newValue != oldValue) transformed = true;
    clone.put(name, unwrap(newValue));
  }
  return transformed ? clone : this;
}

代码示例来源:origin: org.modeshape/modeshape-schematic

@Override
public Document with( ValueTransformer transformer ) {
  boolean transformed = false;
  BasicDocument clone = new BasicDocument();
  for (Field field : this.fields()) {
    String name = field.getName();
    Object oldValue = field.getValue();
    Object newValue = null;
    if (oldValue instanceof Document) {
      newValue = ((Document)oldValue).with(transformer);
    } else {
      newValue = transformer.transform(name, oldValue);
    }
    if (newValue != oldValue) transformed = true;
    clone.put(name, unwrap(newValue));
  }
  return transformed ? clone : this;
}

代码示例来源:origin: ModeShape/modeshape

@Override
public Array with( ValueTransformer transformer ) {
  boolean transformed = false;
  BasicArray clone = new BasicArray();
  for (Field field : this.fields()) {
    String name = field.getName();
    Object oldValue = field.getValue();
    Object newValue = null;
    if (oldValue instanceof Document) {
      newValue = ((Document)oldValue).with(transformer);
    } else {
      newValue = transformer.transform(name, oldValue);
    }
    if (newValue != oldValue) transformed = true;
    clone.put(name, unwrap(newValue));
  }
  return transformed ? clone : this;
}

代码示例来源:origin: ModeShape/modeshape

@Override
public Document getChildReference( String parentKey,
                  String childKey ) {
  if (isLocalSource(parentKey)) {
    return localStore().getChildReference(parentKey, childKey);
  }
  Connector connector = connectors.getConnectorForSourceKey(sourceKey(parentKey));
  if (connector != null) {
    parentKey = documentIdFromNodeKey(parentKey);
    childKey = documentIdFromNodeKey(childKey);
    Document doc = connector.getChildReference(parentKey, childKey);
    if (doc != null) {
      String key = doc.getString(DocumentTranslator.KEY);
      key = documentIdToNodeKeyString(connector.getSourceName(), key);
      doc = doc.with(DocumentTranslator.KEY, key);
    }
    return doc;
  }
  return null;
}

代码示例来源:origin: org.fcrepo/modeshape-jcr

@Override
public Document getChildReference( String parentKey,
                  String childKey ) {
  if (isLocalSource(parentKey)) {
    return localStore().getChildReference(parentKey, childKey);
  }
  Connector connector = connectors.getConnectorForSourceKey(sourceKey(parentKey));
  if (connector != null) {
    parentKey = documentIdFromNodeKey(parentKey);
    childKey = documentIdFromNodeKey(childKey);
    Document doc = connector.getChildReference(parentKey, childKey);
    if (doc != null) {
      String key = doc.getString(DocumentTranslator.KEY);
      key = documentIdToNodeKeyString(connector.getSourceName(), key);
      doc = doc.with(DocumentTranslator.KEY, key);
    }
    return doc;
  }
  return null;
}

相关文章