gpt4 book ai didi

org.opensaml.core.xml.util.XMLObjectChildrenList.setParent()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-19 23:00:40 27 4
gpt4 key购买 nike

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

XMLObjectChildrenList.setParent介绍

[英]Assigned the parent, given at list construction, to the given element if the element does not have a parent or its parent matches the one given at list construction time.

An IllegalArgumentException is thrown if the given XMLObject already has a parent other than the parent given at list construction time.
[中]如果给定元素没有父元素,或其父元素与列表构造时给定的父元素匹配,则将列表构造时给定的父元素指定给该元素。
如果给定的XMLObject在列表构造时已经有父对象而不是给定的父对象,则会引发IllegalArgumentException。

代码示例

代码示例来源:origin: org.opensaml/opensaml-core

/**
 * Adds the given XMLObject to this list. A null element is ignored, as is
 * an element already in the list.
 * 
 * <p>An IllegalArgumentException is thrown if the given XMLObject already has a parent
 * other than the parent given at list construction time.
 * 
 * @param index index at which to add the given XMLObject
 * @param element element to be stored at the given index
 */
public void add(int index, @Nullable final ElementType element) {
  if (element == null || elements.contains(element)) {
    return;
  }
  setParent(element);
  parent.getIDIndex().registerIDMappings(element.getIDIndex());
  modCount++;
  elements.add(index, element);
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.opensaml

/**
 * Adds the given XMLObject to this list. A null element is ignored, as is
 * an element already in the list.
 * 
 * <p>An IllegalArgumentException is thrown if the given XMLObject already has a parent
 * other than the parent given at list construction time.
 * 
 * @param index index at which to add the given XMLObject
 * @param element element to be stored at the given index
 */
public void add(int index, @Nullable final ElementType element) {
  if (element == null || elements.contains(element)) {
    return;
  }
  setParent(element);
  parent.getIDIndex().registerIDMappings(element.getIDIndex());
  modCount++;
  elements.add(index, element);
}

代码示例来源:origin: org.opensaml/opensaml-core

/**
 * Replaces the XMLObject at the specified index with the given element. A null
 * input is ignored and returned.
 * 
 * <p>An IllegalArgumentException is thrown if the given XMLObject already has a parent
 * other than the parent given at list construction time.
 * 
 * @param index index of the XMLObject to be replaced
 * @param element element to be stored at the given index
 * 
 * @return the replaced XMLObject
 */
@Nullable public ElementType set(int index, @Nullable final ElementType element) {
  if (element == null) {
    return null;
  }
  setParent(element);
  ElementType removedElement = elements.set(index, element);
  if (removedElement != null) {
    removedElement.setParent(null);
    parent.getIDIndex().deregisterIDMappings(removedElement.getIDIndex());
  }
  
  // Note: to avoid ordering problems, this needs to be called after
  // the deregistration, in case the added element has a same ID string 
  // value as the removed one, else you will lose it.
  parent.getIDIndex().registerIDMappings(element.getIDIndex());
  modCount++;
  return removedElement;
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.opensaml

/**
 * Replaces the XMLObject at the specified index with the given element. A null
 * input is ignored and returned.
 * 
 * <p>An IllegalArgumentException is thrown if the given XMLObject already has a parent
 * other than the parent given at list construction time.
 * 
 * @param index index of the XMLObject to be replaced
 * @param element element to be stored at the given index
 * 
 * @return the replaced XMLObject
 */
@Nullable public ElementType set(int index, @Nullable final ElementType element) {
  if (element == null) {
    return null;
  }
  setParent(element);
  ElementType removedElement = elements.set(index, element);
  if (removedElement != null) {
    removedElement.setParent(null);
    parent.getIDIndex().deregisterIDMappings(removedElement.getIDIndex());
  }
  
  // Note: to avoid ordering problems, this needs to be called after
  // the deregistration, in case the added element has a same ID string 
  // value as the removed one, else you will lose it.
  parent.getIDIndex().registerIDMappings(element.getIDIndex());
  modCount++;
  return removedElement;
}

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com