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.GeneratedType;
11 import org.opendaylight.mdsal.binding.model.api.TypeComment;
12 import org.opendaylight.mdsal.binding.model.api.type.builder.GeneratedTypeBuilder;
13 import org.opendaylight.yangtools.yang.common.QName;
15 public final class CodegenGeneratedTypeBuilder extends AbstractGeneratedTypeBuilder<GeneratedTypeBuilder> implements
16 GeneratedTypeBuilder {
18 private String description;
19 private String reference;
20 private String moduleName;
21 private Iterable<QName> schemaPath;
23 public CodegenGeneratedTypeBuilder(final String packageName, final String name) {
24 super(packageName, name);
29 public GeneratedType toInstance() {
30 return new GeneratedTypeImpl(this);
34 public void setDescription(final String description) {
35 this.description = description;
39 public void setModuleName(final String moduleName) {
40 this.moduleName = moduleName;
44 public void setSchemaPath(final Iterable<QName> schemaPath) {
45 this.schemaPath = schemaPath;
49 public void setReference(final String reference) {
50 this.reference = reference;
54 public String toString() {
55 final StringBuilder builder = new StringBuilder();
56 builder.append("GeneratedTransferObject [packageName=");
57 builder.append(getPackageName());
58 builder.append(", name=");
59 builder.append(getName());
61 final TypeComment comment = getComment();
62 if (comment != null) {
63 builder.append(", comment=");
64 builder.append(comment.getJavadoc());
66 builder.append(", annotations=");
67 builder.append(getAnnotations());
68 builder.append(", implements=");
69 builder.append(getImplementsTypes());
70 builder.append(", enclosedTypes=");
71 builder.append(getEnclosedTypes());
72 builder.append(", constants=");
73 builder.append(getConstants());
74 builder.append(", enumerations=");
75 builder.append(getEnumerations());
76 builder.append(", properties=");
77 builder.append(", methods=");
78 builder.append(getMethodDefinitions());
80 return builder.toString();
84 protected CodegenGeneratedTypeBuilder thisInstance() {
88 private static final class GeneratedTypeImpl extends AbstractGeneratedType {
90 private final String description;
91 private final String reference;
92 private final String moduleName;
93 private final Iterable<QName> schemaPath;
95 public GeneratedTypeImpl(final CodegenGeneratedTypeBuilder builder) {
98 this.description = builder.description;
99 this.reference = builder.reference;
100 this.moduleName = builder.moduleName;
101 this.schemaPath = builder.schemaPath;
105 public String getDescription() {
106 return this.description;
110 public String getReference() {
111 return this.reference;
115 public Iterable<QName> getSchemaPath() {
116 return this.schemaPath;
120 public String getModuleName() {
121 return this.moduleName;