2 * Copyright (c) 2020 Pantheon Technologies, s.r.o. and others. All rights reserved.
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
8 package org.opendaylight.mdsal.binding.java.api.generator
10 import org.opendaylight.mdsal.binding.model.api.GeneratedProperty
11 import org.opendaylight.mdsal.binding.model.api.GeneratedTransferObject
14 * Template for generating JAVA class.
16 final class ListKeyTemplate extends ClassTemplate {
18 * Creates instance of this class with concrete <code>genType</code>.
20 * @param genType generated transfer object which will be transformed to JAVA class source code
22 new(GeneratedTransferObject genType) {
26 override allValuesConstructor() '''
27 public «type.name»(«allProperties.asNonNullArgumentsDeclaration») {
28 «FOR p : allProperties»
29 «val fieldName = p.fieldName»
30 this.«fieldName» = «CODEHELPERS.importedName».requireKeyProp(«fieldName», "«p.name»")«p.cloneCall»;
33 «generateRestrictions(type, p.fieldName, p.returnType)»
38 override getterMethod(GeneratedProperty field) '''
39 public «field.returnType.importedNonNull» «field.getterMethodName»() {
40 return «field.fieldName»«field.cloneCall»;