private void addExtension(BaseRuntimeElementCompositeDefinition<?> theSourceDef, IBase theSource, IBase theTarget, RuntimeChildDeclaredExtensionDefinition nextExt, String url) { RuntimeChildDeclaredExtensionDefinition sourceDeclaredExt = theSourceDef.getDeclaredExtension(url, ""); if (sourceDeclaredExt == null) { if (theSource instanceof IBaseHasExtensions) { for (IBaseExtension<?, ?> next : ((IBaseHasExtensions) theSource).getExtension()) { if (next.getUrl().equals(url)) { nextExt.getMutator().addValue(theTarget, next.getValue()); } } } if (theSource instanceof IBaseHasModifierExtensions) { for (IBaseExtension<?, ?> next : ((IBaseHasModifierExtensions) theSource).getModifierExtension()) { if (next.getUrl().equals(url)) { nextExt.getMutator().addValue(theTarget, next.getValue()); } } } } else { List<? extends IBase> values = sourceDeclaredExt.getAccessor().getValues(theSource); for (IBase nextElement : values) { nextExt.getMutator().addValue(theTarget, nextElement); } } } }
private void addExtension(BaseRuntimeElementCompositeDefinition<?> theSourceDef, IBase theSource, IBase theTarget, RuntimeChildDeclaredExtensionDefinition nextExt, String url) { RuntimeChildDeclaredExtensionDefinition sourceDeclaredExt = theSourceDef.getDeclaredExtension(url, ""); if (sourceDeclaredExt == null) { if (theSource instanceof IBaseHasExtensions) { for (IBaseExtension<?, ?> next : ((IBaseHasExtensions) theSource).getExtension()) { if (next.getUrl().equals(url)) { nextExt.getMutator().addValue(theTarget, next.getValue()); } } } if (theSource instanceof IBaseHasModifierExtensions) { for (IBaseExtension<?, ?> next : ((IBaseHasModifierExtensions) theSource).getModifierExtension()) { if (next.getUrl().equals(url)) { nextExt.getMutator().addValue(theTarget, next.getValue()); } } } } else { List<? extends IBase> values = sourceDeclaredExt.getAccessor().getValues(theSource); for (IBase nextElement : values) { nextExt.getMutator().addValue(theTarget, nextElement); } } } }