2 * Copyright (c) 2017 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
9 package org.opendaylight.mdsal.binding.javav2.generator.util.generated.type.builder;
11 import com.google.common.annotations.Beta;
12 import java.util.List;
13 import org.opendaylight.mdsal.binding.javav2.model.api.AnnotationType;
14 import org.opendaylight.mdsal.binding.javav2.model.api.GeneratedProperty;
15 import org.opendaylight.mdsal.binding.javav2.model.api.Type;
16 import org.opendaylight.mdsal.binding.javav2.model.api.type.builder.GeneratedPropertyBuilder;
19 public final class GeneratedPropertyBuilderImpl extends AbstractTypeMemberBuilder<GeneratedPropertyBuilder> implements
20 GeneratedPropertyBuilder {
23 private boolean isReadOnly;
25 public GeneratedPropertyBuilderImpl(String name) {
27 this.isReadOnly = true;
31 public GeneratedPropertyBuilder setValue(String value) {
37 public GeneratedPropertyBuilder setReadOnly(boolean isReadOnly) {
38 this.isReadOnly = isReadOnly;
43 protected GeneratedPropertyBuilderImpl thisInstance() {
48 public GeneratedProperty toInstance(Type definingType) {
49 final List<AnnotationType> annotations = toAnnotationTypes();
50 return new GeneratedPropertyImpl(definingType, getName(), annotations, getComment(), getAccessModifier(),
51 getReturnType(), isFinal(), isStatic(), isReadOnly, value);
55 public String toString() {
56 StringBuilder builder = new StringBuilder();
57 builder.append("GeneratedPropertyImpl [name=");
58 builder.append(getName());
59 builder.append(", annotations=");
60 builder.append(getAnnotationBuilders());
61 builder.append(", comment=");
62 builder.append(getComment());
63 builder.append(", returnType=");
64 builder.append(getReturnType());
65 builder.append(", isFinal=");
66 builder.append(isFinal());
67 builder.append(", isReadOnly=");
68 builder.append(isReadOnly);
69 builder.append(", modifier=");
70 builder.append(getAccessModifier());
72 return builder.toString();