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.yangtools.binding.generator.util.generated.type.builder;
10 import org.opendaylight.yangtools.sal.binding.model.api.AnnotationType;
11 import org.opendaylight.yangtools.sal.binding.model.api.GeneratedProperty;
12 import org.opendaylight.yangtools.sal.binding.model.api.Type;
13 import org.opendaylight.yangtools.sal.binding.model.api.type.builder.GeneratedPropertyBuilder;
15 import java.util.List;
17 final class GeneratedPropertyBuilderImpl extends AbstractTypeMemberBuilder<GeneratedPropertyBuilder> implements GeneratedPropertyBuilder {
19 private boolean isReadOnly;
21 public GeneratedPropertyBuilderImpl(String name) {
23 this.isReadOnly = true;
27 public GeneratedPropertyBuilderImpl setReadOnly(boolean isReadOnly) {
28 this.isReadOnly = isReadOnly;
33 protected GeneratedPropertyBuilderImpl thisInstance() {
38 public GeneratedProperty toInstance(Type definingType) {
39 final List<AnnotationType> annotations = toAnnotationTypes();
40 return new GeneratedPropertyImpl(definingType, getName(), annotations, getComment(), getAccessModifier(),
41 getReturnType(), isFinal(), isReadOnly);
45 public String toString() {
46 StringBuilder builder = new StringBuilder();
47 builder.append("GeneratedPropertyImpl [name=");
48 builder.append(getName());
49 builder.append(", annotations=");
50 builder.append(getAnnotationBuilders());
51 builder.append(", comment=");
52 builder.append(getComment());
53 builder.append(", returnType=");
54 builder.append(getReturnType());
55 builder.append(", isFinal=");
56 builder.append(isFinal());
57 builder.append(", isReadOnly=");
58 builder.append(isReadOnly);
59 builder.append(", modifier=");
60 builder.append(getAccessModifier());
62 return builder.toString();