org.jvnet.hk2.config.Dom.stitchList()方法的使用及代码示例

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

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

Dom.stitchList介绍

[英]Given a master list and the new sub list, replace the items in the master list with the matching items from the new sub list. This process works even if the length of the new sublist is different.

For example, givn:

replace A by A': 
M=[A,B,C], S=[A'] => [A',B,C] 
M=[A,B,A,B,C], S=[A',A'] => [A',B,A',B,C] 
when list length is different: 
M=[A,A,B,C], S=[] => [B,C] 
M=[A,B,C], S=[A',A'] => [A',A',B,C] 
M=[B,C], S=[A',A'] => [B,C,A',A']

[中]给定主列表和新子列表,用新子列表中的匹配项替换主列表中的项。即使新子列表的长度不同,此过程也有效。
例如,givn:

replace A by A': 
M=[A,B,C], S=[A'] => [A',B,C] 
M=[A,B,A,B,C], S=[A',A'] => [A',B,A',B,C] 
when list length is different: 
M=[A,A,B,C], S=[] => [B,C] 
M=[A,B,C], S=[A',A'] => [A',A',B,C] 
M=[B,C], S=[A',A'] => [B,C,A',A']

代码示例

代码示例来源:origin: javaee/glassfish

/**
 * Updates leaf-element values.
 * <p>
 * Synchronized so that concurrenct modifications will work correctly.
 */
public synchronized void setLeafElements(final String name, String... values) {
  List<Child> newChildren = new ArrayList<Child>(children);
  LeafChild[] leaves = new LeafChild[values.length];
  for (int i = 0; i < values.length; i++)
    leaves[i] = new LeafChild(name,values[i]);
  stitchList(newChildren,name,Arrays.asList(leaves));
  children = newChildren;
  // see attribute(String,String) for the issue with this
  getInjector().injectElement(this,name,get());
}

代码示例来源:origin: javaee/glassfish

/**
 * Updates node-element values.
 * <p>
 * Synchronized so that concurrenct modifications will work correctly.
 */
public synchronized void setNodeElements(final String name, Dom... values) {
  List<Child> newChildren = new ArrayList<Child>(children);
  NodeChild[] leaves = new NodeChild[values.length];
  for (int i = 0; i < values.length; i++)
    leaves[i] = new NodeChild(name,values[i]);
  List<Child> removed = stitchList(newChildren,name,Arrays.asList(leaves));
  children = newChildren;
  for (Child c : removed) {
    ((NodeChild) c).dom.release();
  }
  // see attribute(String,String) for the issue with this
  getInjector().injectElement(this,name,get());
}

代码示例来源:origin: eclipse-ee4j/glassfish

/**
 * Updates leaf-element values.
 * <p>
 * Synchronized so that concurrenct modifications will work correctly.
 */
public synchronized void setLeafElements(final String name, String... values) {
  List<Child> newChildren = new ArrayList<Child>(children);
  LeafChild[] leaves = new LeafChild[values.length];
  for (int i = 0; i < values.length; i++)
    leaves[i] = new LeafChild(name,values[i]);
  stitchList(newChildren,name,Arrays.asList(leaves));
  children = newChildren;
  // see attribute(String,String) for the issue with this
  getInjector().injectElement(this,name,get());
}

代码示例来源:origin: org.glassfish.hk2/hk2-config

/**
 * Updates leaf-element values.
 * <p>
 * Synchronized so that concurrenct modifications will work correctly.
 */
public synchronized void setLeafElements(final String name, String... values) {
  List<Child> newChildren = new ArrayList<Child>(children);
  LeafChild[] leaves = new LeafChild[values.length];
  for (int i = 0; i < values.length; i++)
    leaves[i] = new LeafChild(name,values[i]);
  stitchList(newChildren,name,Arrays.asList(leaves));
  children = newChildren;
  // see attribute(String,String) for the issue with this
  getInjector().injectElement(this,name,get());
}

代码示例来源:origin: org.glassfish.hk2/config

/**
 * Updates leaf-element values.
 * <p>
 * Synchronized so that concurrenct modifications will work correctly.
 */
public synchronized void setLeafElements(final String name, String... values) {
  List<Child> newChildren = new ArrayList<Child>(children);
  LeafChild[] leaves = new LeafChild[values.length];
  for (int i = 0; i < values.length; i++)
    leaves[i] = new LeafChild(name,values[i]);
  stitchList(newChildren,name,Arrays.asList(leaves));
  children = newChildren;
  // see attribute(String,String) for the issue with this
  getInjector().injectElement(this,name,get());
}

代码示例来源:origin: com.sun.enterprise/config

/**
 * Updates leaf-element values.
 * <p>
 * Synchronized so that concurrenct modifications will work correctly.
 */
public synchronized void setLeafElements(final String name, String... values) {
  List<Child> newChildren = new ArrayList<Child>(children);
  LeafChild[] leaves = new LeafChild[values.length];
  for (int i = 0; i < values.length; i++)
    leaves[i] = new LeafChild(name,values[i]);
  stitchList(newChildren,name,Arrays.asList(leaves));
  children = newChildren;
  // see attribute(String,String) for the issue with this
  getInjector().injectElement(this,name,get());
}

代码示例来源:origin: com.sun.enterprise/config

/**
 * Updates node-element values.
 * <p>
 * Synchronized so that concurrenct modifications will work correctly.
 */
public synchronized void setNodeElements(final String name, Dom... values) {
  List<Child> newChildren = new ArrayList<Child>(children);
  NodeChild[] leaves = new NodeChild[values.length];
  for (int i = 0; i < values.length; i++)
    leaves[i] = new NodeChild(name,values[i]);
  stitchList(newChildren,name,Arrays.asList(leaves));
  children = newChildren;
  // see attribute(String,String) for the issue with this
  getInjector().injectElement(this,name,get());
}

代码示例来源:origin: org.glassfish.hk2/config

/**
 * Updates node-element values.
 * <p>
 * Synchronized so that concurrenct modifications will work correctly.
 */
public synchronized void setNodeElements(final String name, Dom... values) {
  List<Child> newChildren = new ArrayList<Child>(children);
  NodeChild[] leaves = new NodeChild[values.length];
  for (int i = 0; i < values.length; i++)
    leaves[i] = new NodeChild(name,values[i]);
  stitchList(newChildren,name,Arrays.asList(leaves));
  children = newChildren;
  // see attribute(String,String) for the issue with this
  getInjector().injectElement(this,name,get());
}

代码示例来源:origin: org.glassfish.hk2/hk2-config

/**
 * Updates node-element values.
 * <p>
 * Synchronized so that concurrenct modifications will work correctly.
 */
public synchronized void setNodeElements(final String name, Dom... values) {
  List<Child> newChildren = new ArrayList<Child>(children);
  NodeChild[] leaves = new NodeChild[values.length];
  for (int i = 0; i < values.length; i++)
    leaves[i] = new NodeChild(name,values[i]);
  List<Child> removed = stitchList(newChildren,name,Arrays.asList(leaves));
  children = newChildren;
  for (Child c : removed) {
    ((NodeChild) c).dom.release();
  }
  // see attribute(String,String) for the issue with this
  getInjector().injectElement(this,name,get());
}

代码示例来源:origin: eclipse-ee4j/glassfish

/**
 * Updates node-element values.
 * <p>
 * Synchronized so that concurrenct modifications will work correctly.
 */
public synchronized void setNodeElements(final String name, Dom... values) {
  List<Child> newChildren = new ArrayList<Child>(children);
  NodeChild[] leaves = new NodeChild[values.length];
  for (int i = 0; i < values.length; i++)
    leaves[i] = new NodeChild(name,values[i]);
  List<Child> removed = stitchList(newChildren,name,Arrays.asList(leaves));
  children = newChildren;
  for (Child c : removed) {
    ((NodeChild) c).dom.release();
  }
  // see attribute(String,String) for the issue with this
  getInjector().injectElement(this,name,get());
}

相关文章