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 java.util.List;
11 import org.opendaylight.mdsal.binding.model.api.AnnotationType;
12 import org.opendaylight.mdsal.binding.model.api.GeneratedProperty;
13 import org.opendaylight.mdsal.binding.model.api.Type;
14 import org.opendaylight.mdsal.binding.model.api.type.builder.GeneratedPropertyBuilder;
16 public final class GeneratedPropertyBuilderImpl extends AbstractTypeMemberBuilder<GeneratedPropertyBuilder>
17 implements GeneratedPropertyBuilder {
19 private boolean readOnly;
20 private boolean nullifyEmpty;
22 public GeneratedPropertyBuilderImpl(final String name) {
25 this.nullifyEmpty = false;
29 public GeneratedPropertyBuilderImpl setValue(final String value) {
35 public GeneratedPropertyBuilderImpl setReadOnly(final boolean isReadOnly) {
36 this.readOnly = isReadOnly;
41 public GeneratedPropertyBuilderImpl setNullifyEmpty(final boolean flag) {
42 this.nullifyEmpty = flag;
47 protected GeneratedPropertyBuilderImpl thisInstance() {
52 public GeneratedProperty toInstance(final Type definingType) {
53 final List<AnnotationType> annotations = toAnnotationTypes();
54 return new GeneratedPropertyImpl(definingType, getName(), annotations, getComment(), getAccessModifier(),
55 getReturnType(), isFinal(), isStatic(), this.readOnly, this.nullifyEmpty, this.value);
59 public String toString() {
60 final StringBuilder builder = new StringBuilder();
61 builder.append("GeneratedPropertyImpl [name=");
62 builder.append(getName());
63 builder.append(", annotations=");
64 builder.append(getAnnotationBuilders());
65 builder.append(", comment=");
66 builder.append(getComment());
67 builder.append(", returnType=");
68 builder.append(getReturnType());
69 builder.append(", isFinal=");
70 builder.append(isFinal());
71 builder.append(", isReadOnly=");
72 builder.append(this.readOnly);
73 builder.append(", modifier=");
74 builder.append(getAccessModifier());
76 return builder.toString();