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