/** * Creates a deep copy of this HashNMap. * * @return a clone. * @throws CloneNotSupportedException this should never happen. * @noinspection unchecked */ public Object clone() throws CloneNotSupportedException { final HashNMap<K, V> map = (HashNMap) super.clone(); map.table = (HashMap) table.clone(); final Iterator iterator = map.table.entrySet().iterator(); while ( iterator.hasNext() ) { final Map.Entry entry = (Map.Entry) iterator.next(); final List list = (List) entry.getValue(); if ( list != null ) { entry.setValue( ObjectUtilities.clone( list ) ); } } return map; }
/** * Creates a deep copy of this HashNMap. * * @return a clone. * @throws CloneNotSupportedException this should never happen. * @noinspection unchecked */ public Object clone() throws CloneNotSupportedException { final HashNMap<K,V> map = (HashNMap) super.clone(); map.table = (HashMap) table.clone(); final Iterator iterator = map.table.entrySet().iterator(); while (iterator.hasNext()) { final Map.Entry entry = (Map.Entry) iterator.next(); final List list = (List) entry.getValue(); if (list != null) { entry.setValue(ObjectUtilities.clone(list)); } } return map; }
public Object getResource() throws ResourceException { try { final Object resource = super.getResource(); if ( cloneable ) { return ObjectUtilities.clone( resource ); } return resource; } catch ( CloneNotSupportedException e ) { throw new ResourceException( "Unable to retrieve the resource.", e ); } } }
e.attributes.setAttribute( namespace, name, ObjectUtilities.clone( value ) ); } else if ( data == null || data.isComputed() == false || data.isDesignTimeValue() ) { e.attributes.setAttribute( namespace, name, value );