/** * 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; }
/** * 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); } }
/** * 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); } }
/** * 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); } }
/** * 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); } }
/** * 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); } }
/** * 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); } }