2 * Copyright (c) 2013 Cisco Systems, Inc. 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.model.util.generated.type.builder;
10 import org.opendaylight.mdsal.binding.model.api.GeneratedProperty;
11 import org.opendaylight.mdsal.binding.model.api.GeneratedTransferObject;
12 import org.opendaylight.mdsal.binding.model.api.Restrictions;
13 import org.opendaylight.mdsal.binding.model.api.type.builder.GeneratedPropertyBuilder;
14 import org.opendaylight.yangtools.yang.common.QName;
15 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
17 public final class CodegenGeneratedTOBuilder extends AbstractGeneratedTOBuilder {
19 private Restrictions restrictions;
20 private GeneratedPropertyBuilder SUID;
21 private String reference;
22 private String description;
23 private String moduleName;
24 private SchemaPath schemaPath;
26 public CodegenGeneratedTOBuilder(final String packageName, final String name) {
27 super(packageName, name);
31 public void setRestrictions(final Restrictions restrictions) {
32 this.restrictions = restrictions;
36 public void setSUID(final GeneratedPropertyBuilder suid) {
41 public GeneratedTransferObject build() {
46 public void setDescription(final String description) {
47 this.description = description;
51 public void setModuleName(final String moduleName) {
52 this.moduleName = moduleName;
56 public void setSchemaPath(final SchemaPath schemaPath) {
57 this.schemaPath = schemaPath;
61 public void setReference(final String reference) {
62 this.reference = reference;
66 AbstractEnumerationBuilder newEnumerationBuilder(final String packageName, final String name) {
67 return new CodegenEnumerationBuilder(packageName, name);
70 private static final class GTO extends AbstractGeneratedTransferObject {
71 private final Restrictions restrictions;
72 private final GeneratedProperty SUID;
73 private final String reference;
74 private final String description;
75 private final String moduleName;
76 private final SchemaPath schemaPath;
78 public GTO(final CodegenGeneratedTOBuilder builder) {
80 this.restrictions = builder.restrictions;
81 this.reference = builder.reference;
82 this.description = builder.description;
83 this.moduleName = builder.moduleName;
84 this.schemaPath = builder.schemaPath;
86 if (builder.SUID == null) {
89 this.SUID = builder.SUID.toInstance(GTO.this);
94 public Restrictions getRestrictions() {
95 return this.restrictions;
99 public GeneratedProperty getSUID() {
104 public String getDescription() {
105 return this.description;
109 public String getReference() {
110 return this.reference;
114 public Iterable<QName> getSchemaPath() {
115 return this.schemaPath.getPathFromRoot();
119 public String getModuleName() {
120 return this.moduleName;