private void cloneIncludes(Composite composite) { List<Composite> includes = new ArrayList<Composite>(); for (Composite included : composite.getIncludes()) { try { includes.add((Composite)included.clone()); } catch (CloneNotSupportedException e) { throw new UnsupportedOperationException(e); } } composite.getIncludes().clear(); composite.getIncludes().addAll(includes); }
private void cloneIncludes(Composite composite) { List<Composite> includes = new ArrayList<Composite>(); for (Composite included : composite.getIncludes()) { try { includes.add((Composite)included.clone()); } catch (CloneNotSupportedException e) { throw new UnsupportedOperationException(e); } } composite.getIncludes().clear(); composite.getIncludes().addAll(includes); }
/** * Clone composite component implementations * * @param composite * @param problems */ private void cloneCompositeImplementations(Composite composite) { for (Component component : composite.getComponents()) { Implementation implementation = component.getImplementation(); if (implementation instanceof Composite) { Composite compositeImplementation = (Composite)implementation; try { // Please note the clone method is recursive Composite clone = (Composite)compositeImplementation.clone(); component.setImplementation(clone); } catch (CloneNotSupportedException e) { throw new UnsupportedOperationException(e); } } } }
/** * Clone composite component implementations * * @param composite * @param problems */ private void cloneCompositeImplementations(Composite composite) { for (Component component : composite.getComponents()) { Implementation implementation = component.getImplementation(); if (implementation instanceof Composite) { Composite compositeImplementation = (Composite)implementation; try { // Please note the clone method is recursive Composite clone = (Composite)compositeImplementation.clone(); component.setImplementation(clone); } catch (CloneNotSupportedException e) { throw new UnsupportedOperationException(e); } } } }
@Override public Object clone() throws CloneNotSupportedException { ComponentImpl clone = (ComponentImpl)super.clone(); clone.properties = new ArrayList<ComponentProperty>(); for (ComponentProperty property : getProperties()) { clone.properties.add((ComponentProperty)property.clone()); } clone.references = new ArrayList<ComponentReference>(); for (ComponentReference reference : getReferences()) { clone.references.add((ComponentReference)reference.clone()); } clone.services = new ArrayList<ComponentService>(); for (ComponentService service : getServices()) { clone.services.add((ComponentService)service.clone()); } // Clone the implementation.composite if(implementation instanceof Composite) { clone.implementation = (Composite) ((Composite) implementation).clone(); } // Clone the Lists for intents and policySets clone.requiredIntents = new ArrayList<Intent>(getRequiredIntents()); clone.policySets = new ArrayList<PolicySet>(getPolicySets()); return clone; }
@Override public Object clone() throws CloneNotSupportedException { ComponentImpl clone = (ComponentImpl)super.clone(); clone.properties = new ArrayList<ComponentProperty>(); for (ComponentProperty property : getProperties()) { clone.properties.add((ComponentProperty)property.clone()); } clone.references = new ArrayList<ComponentReference>(); for (ComponentReference reference : getReferences()) { clone.references.add((ComponentReference)reference.clone()); } clone.services = new ArrayList<ComponentService>(); for (ComponentService service : getServices()) { clone.services.add((ComponentService)service.clone()); } // Clone the implementation.composite if(implementation instanceof Composite) { clone.implementation = (Composite) ((Composite) implementation).clone(); } // Clone the Lists for intents and policySets clone.requiredIntents = new ArrayList<Intent>(getRequiredIntents()); clone.policySets = new ArrayList<PolicySet>(getPolicySets()); return clone; }
clone.includes.add((Composite)included.clone());
clone.includes.add((Composite)included.clone());
composite = (Composite)composite.clone(); } catch (CloneNotSupportedException ex){