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.JavaTypeName;
12 import org.opendaylight.mdsal.binding.model.api.TypeComment;
13 import org.opendaylight.mdsal.binding.model.api.type.builder.GeneratedTypeBuilder;
14 import org.opendaylight.yangtools.yang.common.QName;
15 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
17 public final class CodegenGeneratedTypeBuilder extends AbstractGeneratedTypeBuilder<GeneratedTypeBuilder> implements
18 GeneratedTypeBuilder {
20 private String description;
21 private String reference;
22 private String moduleName;
23 private SchemaPath schemaPath;
25 public CodegenGeneratedTypeBuilder(final JavaTypeName identifier) {
31 public void setDescription(final String description) {
32 this.description = description;
36 public void setModuleName(final String moduleName) {
37 this.moduleName = moduleName;
41 public void setSchemaPath(final SchemaPath schemaPath) {
42 this.schemaPath = schemaPath;
46 public void setReference(final String reference) {
47 this.reference = reference;
51 public String toString() {
52 final StringBuilder builder = new StringBuilder();
53 builder.append("GeneratedTransferObject [packageName=");
54 builder.append(getPackageName());
55 builder.append(", name=");
56 builder.append(getName());
58 final TypeComment comment = getComment();
59 if (comment != null) {
60 builder.append(", comment=");
61 builder.append(comment.getJavadoc());
63 builder.append(", annotations=");
64 builder.append(getAnnotations());
65 builder.append(", implements=");
66 builder.append(getImplementsTypes());
67 builder.append(", constants=");
68 builder.append(getConstants());
69 builder.append(", enumerations=");
70 builder.append(getEnumerations());
71 builder.append(", properties=");
72 builder.append(", methods=");
73 builder.append(getMethodDefinitions());
75 return builder.toString();
79 public GeneratedType build() {
80 return new GeneratedTypeImpl(this);
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 SchemaPath schemaPath;
95 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.getPathFromRoot();
120 public String getModuleName() {
121 return this.moduleName;