org.eclipse.persistence.exceptions.QueryException.cannotAddElement()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(5.7k)|赞(0)|评价(0)|浏览(78)

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

QueryException.cannotAddElement介绍

暂无

代码示例

代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

/**
 * INTERNAL:
 * Add key, value pair into container which implements the Map interface.
 */
public boolean addInto(Object key, Object value, Object container, AbstractSession session) {
  try {
    ((Map)container).put(key, value);
  } catch (ClassCastException ex1) {
    throw QueryException.cannotAddElement(key, container, ex1);
  }
  return true;
}

代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

/**
 * INTERNAL:
 * Add element into a container which implements the Collection interface.
 *
 * @param element java.lang.Object
 * @param container java.lang.Object
 * @return boolean indicating whether the container changed
 */
public boolean addInto(Object key, Object element, Object container) {
  try {
    return ((Collection)container).add(element);
  } catch (ClassCastException ex1) {
    throw QueryException.cannotAddElement(element, container, ex1);
  } catch (IllegalArgumentException ex2) {
    throw QueryException.cannotAddElement(element, container, ex2);
  } catch (UnsupportedOperationException ex3) {
    throw QueryException.cannotAddElement(element, container, ex3);
  }
}

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * INTERNAL:
 * Add element into a container which implements the Collection interface.
 * @return boolean indicating whether the container changed.
 */
public boolean addInto(Object key, Object element, Object container, AbstractSession session) {
  Object elementToAdd = element;
  // PERF: Using direct access.
  if (this.elementDescriptor != null) {
    elementToAdd = this.elementDescriptor.getObjectBuilder().wrapObject(element, session);
  }
  try {
    return ((Collection)container).add(elementToAdd);
  } catch (ClassCastException ex1) {
    throw QueryException.cannotAddElement(element, container, ex1);
  } catch (IllegalArgumentException ex2) {
    throw QueryException.cannotAddElement(element, container, ex2);
  } catch (UnsupportedOperationException ex3) {
    throw QueryException.cannotAddElement(element, container, ex3);
  }
}

代码示例来源:origin: com.haulmont.thirdparty/eclipselink

/**
 * INTERNAL:
 * Add element into a container which implements the Collection interface.
 * @return boolean indicating whether the container changed.
 */
public boolean addInto(Object key, Object element, Object container, AbstractSession session) {
  Object elementToAdd = element;
  // PERF: Using direct access.
  if (this.elementDescriptor != null) {
    elementToAdd = this.elementDescriptor.getObjectBuilder().wrapObject(element, session);
  }
  try {
    return ((Collection)container).add(elementToAdd);
  } catch (ClassCastException ex1) {
    throw QueryException.cannotAddElement(element, container, ex1);
  } catch (IllegalArgumentException ex2) {
    throw QueryException.cannotAddElement(element, container, ex2);
  } catch (UnsupportedOperationException ex3) {
    throw QueryException.cannotAddElement(element, container, ex3);
  }
}

代码示例来源:origin: com.haulmont.thirdparty/eclipselink

/**
 * INTERNAL:
 * Add element into a container which implements the List interface.
 * Add at a particular index.
 */
protected void addIntoAtIndex(Integer index, Object object, Object container, AbstractSession session) {
  if (hasElementDescriptor()) {
    object = getElementDescriptor().getObjectBuilder().wrapObject(object, session);
  }
  
  try {
    if (index == null || (index.intValue() > sizeFor(container))) {
      // The index can be larger than the size on a merge,
      // so should be added to the end, it may also be null if the 
      // index was unknown, such as an event using the add API.
      ((List)container).add(object);
    } else {
      ((List)container).add(index.intValue(), object);
    }
  } catch (ClassCastException ex1) {
    throw QueryException.cannotAddElement(object, container, ex1);
  } catch (IllegalArgumentException ex2) {
    throw QueryException.cannotAddElement(object, container, ex2);
  } catch (UnsupportedOperationException ex3) {
    throw QueryException.cannotAddElement(object, container, ex3);
  }
}

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * INTERNAL:
 * Add element into a container which implements the List interface.
 * Add at a particular index.
 */
protected void addIntoAtIndex(Integer index, Object object, Object container, AbstractSession session) {
  if (hasElementDescriptor()) {
    object = getElementDescriptor().getObjectBuilder().wrapObject(object, session);
  }
  try {
    if (index == null || (index.intValue() > sizeFor(container))) {
      // The index can be larger than the size on a merge,
      // so should be added to the end, it may also be null if the
      // index was unknown, such as an event using the add API.
      ((List)container).add(object);
    } else {
      ((List)container).add(index.intValue(), object);
    }
  } catch (ClassCastException ex1) {
    throw QueryException.cannotAddElement(object, container, ex1);
  } catch (IllegalArgumentException ex2) {
    throw QueryException.cannotAddElement(object, container, ex2);
  } catch (UnsupportedOperationException ex3) {
    throw QueryException.cannotAddElement(object, container, ex3);
  }
}

代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

/**
 * INTERNAL:
 * Add element into a container which implements the List interface.
 * Add at a particular index.
 */
protected void addIntoAtIndex(Integer index, Object object, Object container, AbstractSession session) {
  if (hasElementDescriptor()) {
    object = getElementDescriptor().getObjectBuilder().wrapObject(object, session);
  }
  
  try {
    if (index == null || (index.intValue() > sizeFor(container))) {
      // The index can be larger than the size on a merge,
      // so should be added to the end, it may also be null if the 
      // index was unknown, such as an event using the add API.
      ((List)container).add(object);
    } else {
      ((List)container).add(index.intValue(), object);
    }
  } catch (ClassCastException ex1) {
    throw QueryException.cannotAddElement(object, container, ex1);
  } catch (IllegalArgumentException ex2) {
    throw QueryException.cannotAddElement(object, container, ex2);
  } catch (UnsupportedOperationException ex3) {
    throw QueryException.cannotAddElement(object, container, ex3);
  }
}

相关文章

微信公众号

最新文章

更多

QueryException类方法