<% /******************************************************************************* * Copyright (c) 2009 Actuate Corporation. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Actuate Corporation - initial API and implementation *******************************************************************************/ %> <%if (isInterface && !genClass.isMapEntry()) {%> /** * @generated */ <%=genClass.getInterfaceName()%> copyInstance( ); <%}%> <%if (isImplementation && !genClass.isMapEntry()) {%> /** * @generated */ protected void set( <%=genClass.getInterfaceName()%> src ) { <%if (genClass.getClassExtendsGenClass()!=null) {%> <% String superName = genClass.getClassExtendsGenClass().getImportedInterfaceName();%> <%if (!"Fill".equals(superName) && !"ActionValue".equals(superName)) {%> super.set( src ); <%}%> <%}%> <%if (!genClass.getChildrenFeatures().isEmpty()) {%> // children <%}%> <%for ( GenFeature feature : genClass.getChildrenFeatures() ) {%> <%if (feature.isMapType()) {%> <%GenFeature keyFeature = feature.getMapEntryTypeGenClass().getMapEntryKeyFeature();%> <%GenFeature valueFeature = feature.getMapEntryTypeGenClass().getMapEntryValueFeature();%> if ( src.<%=feature.getGetAccessor()%>( ) != null ) { <%=feature.getImportedInternalType(genClass)%> map = <%=feature.getGetAccessor()%>( ); for ( Map.Entry<%=feature.getMapEntryTypeGenClass().getInterfaceTypeArguments()%> entry : src.<%=feature.getGetAccessor()%>( ) .entrySet( ) ) { <%if (valueFeature.isChildren()) {%> <%= valueFeature.getImportedType(feature.getMapEntryTypeGenClass())%> entryValue = entry.getValue( ) != null ? entry.getValue( ) .copyInstance( ) : null; map.put( entry.getKey( ), entryValue ); <%} else {%> map.put( entry.getKey( ), entry.getValue( ) ); <%}%> } } <%} else if (feature.isListType()) {%> if ( src.<%=feature.getGetAccessor()%>( ) != null ) { <%=feature.getImportedInternalType(genClass)%> list = <%=feature.getGetAccessor()%>( ); for ( <%=feature.getListItemType(genClass)%> element : src.<%=feature.getGetAccessor()%>( ) ) { list.add( element.copyInstance( ) ); } } <%} else {%> if ( src.<%=feature.getGetAccessor()%>( ) != null ) { set<%=feature.getAccessorName()%>( src.<%=feature.getGetAccessor()%>( ).copyInstance( ) ); } <%}%> <%}%> <%if (!genClass.getPropertyFeatures().isEmpty()) {%> // attributes <%}%> <%for ( GenFeature feature : genClass.getPropertyFeatures() ) {%> <%if (!feature.isChildren() ) {%> <%if (feature.isListType()) {%> if ( src.<%=feature.getGetAccessor()%>( ) != null ) { <%=feature.getImportedInternalType(genClass)%> listSrc = src.<%=feature.getGetAccessor()%>( ); <%=feature.getImportedInternalType(genClass)%> list = new BasicEList<<%=feature.getListItemType(genClass)%>>( listSrc.size( ) ); for ( <%=feature.getListItemType(genClass)%> element : listSrc ) { list.add( element ); } <%=feature.getName()%> = list; } <%} else {%> <%=feature.getName()%> = src.<%=feature.getGetAccessor()%>( ); <%if (feature.isUnsettable()) {%> <%=feature.getName()%>ESet = src.isSet<%=feature.getIsName()%>( ); <%}%> <%}%> <%}%> <%}%> } /** * @generated */ public <%=genClass.getInterfaceName()%> copyInstance( ) { <%=genClass.getClassName()%> dest = new <%=genClass.getClassName()%>( ); dest.set( this ); return dest; } <%}%>