Topology discovery is broken in Active/Active controllers
[controller.git] / opendaylight / sal / yang-prototype / code-generator / binding-generator-util / src / main / java / org / opendaylight / controller / binding / generator / util / generated / type / builder / GeneratedPropertyBuilderImpl.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.controller.binding.generator.util.generated.type.builder;
9
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;
14
15 import java.util.List;
16
17 final class GeneratedPropertyBuilderImpl extends AbstractTypeMemberBuilder implements GeneratedPropertyBuilder {
18
19     private boolean isReadOnly;
20
21     public GeneratedPropertyBuilderImpl(String name) {
22         super(name);
23     }
24
25     @Override
26     public void setReadOnly(boolean isReadOnly) {
27         this.isReadOnly = isReadOnly;
28     }
29
30     @Override
31     public GeneratedProperty toInstance(Type definingType) {
32         final List<AnnotationType> annotations = toAnnotationTypes();
33         return new GeneratedPropertyImpl(definingType, getName(), annotations, getComment(), getAccessModifier(),
34                 getReturnType(), isFinal(), isReadOnly);
35     }
36
37     @Override
38     public String toString() {
39         StringBuilder builder = new StringBuilder();
40         builder.append("GeneratedPropertyImpl [name=");
41         builder.append(getName());
42         builder.append(", annotations=");
43         builder.append(getAnnotationBuilders());
44         builder.append(", comment=");
45         builder.append(getComment());
46         builder.append(", returnType=");
47         builder.append(getReturnType());
48         builder.append(", isFinal=");
49         builder.append(isFinal());
50         builder.append(", isReadOnly=");
51         builder.append(isReadOnly);
52         builder.append(", modifier=");
53         builder.append(getAccessModifier());
54         builder.append("]");
55         return builder.toString();
56     }
57 }