6ad54d0bab098ff467493bb3ec74d55fe842fb8d
[mdsal.git] / binding2 / mdsal-binding2-java-api-generator / src / main / twirl / org / opendaylight / mdsal / binding / javav2 / java / api / generator / builderConstructorHelperTemplate.scala.txt
1 @*
2  * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  *@
8
9 @import org.opendaylight.mdsal.binding.javav2.java.api.generator.util.TextTemplateUtil.fieldName
10 @import org.opendaylight.mdsal.binding.javav2.java.api.generator.util.TextTemplateUtil.getterMethodName
11 @import org.opendaylight.mdsal.binding.javav2.model.api.GeneratedProperty
12
13 @(allProps: List[GeneratedProperty], keyProps: List[GeneratedProperty], importedNames: Map[String, String],
14 keyPropsList: String)
15 @if(keyProps != null) {
16 if (base.getKey() == null) {
17     this._key = new @{importedNames.get("keyTypeConstructor")}(
18     @{keyPropsList}
19     );
20     @for(field <- keyProps) {
21         this.@{fieldName(field)} = base.
22         @{getterMethodName(field)}();
23     }
24 } @{"else"} {
25     this._key = base.getKey();
26     @for(field <- keyProps) {
27         this.@{fieldName(field)} = _key.@{getterMethodName(field)}();
28     }
29 }
30 }
31 @for(field <- allProps) {
32     this.@{fieldName(field)} = base.@{getterMethodName(field)}();
33 }