+++ /dev/null
-@*
- * Copyright (c) 2016 Cisco Systems, Inc. and others. 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
- *@
-
-@import org.opendaylight.mdsal.binding.javav2.java.api.generator.util.TextTemplateUtil.asArguments
-@import org.opendaylight.mdsal.binding.javav2.java.api.generator.util.TextTemplateUtil.fieldName
-@import org.opendaylight.mdsal.binding.javav2.model.api.GeneratedTransferObject
-@import org.opendaylight.mdsal.binding.javav2.model.api.GeneratedProperty
-@import org.opendaylight.mdsal.binding.javav2.util.BindingMapping
-
-@(genTo: GeneratedTransferObject, allProperties: List[GeneratedProperty], properties: List[GeneratedProperty],
-parentProperties: List[GeneratedProperty], importedNames: Map[String, String], argumentsDeclaration: String,
-unionConstructor: String, genRestrictions: String)
-@if(!unionConstructor.isEmpty) {
-@{unionConstructor}
-} else {
- @if(genTo.isTypedef && !allProperties.isEmpty && allProperties.size == 1 && allProperties.get(0).getName.equals("value")) {
- @@@{importedNames.get("constructorProperties")}("value")
- }
- public @{genTo.getName}(@{argumentsDeclaration}) {
- @if(!parentProperties.isEmpty) {
- super(@{asArguments(parentProperties)});
- }
-
- @{genRestrictions}
-
- @if(genTo.isTypedef && !allProperties.isEmpty && allProperties.size == 1 && allProperties.get(0).getName.equals("value")) {
- @{importedNames.get("preconditions")}.checkNotNull(_value, "Supplied value may not be null");
- @for(currentConstant <- genTo.getConstantDefinitions) {
- @if(BindingMapping.PATTERN_CONSTANT_NAME.equals(currentConstant.getName)) {
- @{importedNames.get("CodeHelpers")}.checkPattern(_value, @{BindingMapping.MEMBER_PATTERN_LIST}, @{BindingMapping.MEMBER_REGEX_LIST});
- }
- }
- }
- @for(prop <- properties) {
- @if(importedNames.get(prop.getReturnType.toString).contains("[]")) {
- @if(genTo.isTypedef && !allProperties.isEmpty && allProperties.size == 1 && allProperties.get(0).getName.equals("value")) {
- this.@{fieldName(prop)} = @{fieldName(prop)}.clone();
- } else {
- this.@{fieldName(prop)} = @{fieldName(prop)} == null ? null : @{fieldName(prop)}.clone();
- }
- } else {
- this.@{fieldName(prop)} = @{fieldName(prop)};
- }
- }
- }
-}
-@if(!allProperties.isEmpty) {
- /**
- * Creates a copy from Source Object.
- *
- * @@param source Source object
- */
- public @{genTo.getName}(@{genTo.getName} source) {
- @if(!parentProperties.isEmpty) {
- super(source);
- }
- @for(property <- properties) {
- this.@{fieldName(property)} = source.@{fieldName(property)};
- }
- }
-}
-@if(properties.isEmpty && !parentProperties.isEmpty) {
- /**
- * Creates a new instance from @{importedNames.get("superType")}
- *
- * @@param source Source object
- */
- public @{genTo.getName}(@{importedNames.get("superType")} source) {
- super(source);
- }
-}
\ No newline at end of file