Bug 6859: Cleanup package names for mdsal-binding-generator-util module
[mdsal.git] / binding / mdsal-binding-generator-util / src / main / java / org / opendaylight / yangtools / 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.yangtools.binding.generator.util.generated.type.builder;
9
10 import java.util.List;
11
12 import org.opendaylight.yangtools.sal.binding.model.api.AnnotationType;
13 import org.opendaylight.yangtools.sal.binding.model.api.GeneratedProperty;
14 import org.opendaylight.yangtools.sal.binding.model.api.Type;
15 import org.opendaylight.yangtools.sal.binding.model.api.type.builder.GeneratedPropertyBuilder;
16
17 /**
18  * @deprecated Use {@link org.opendaylight.mdsal.binding.generator.util.generated.type.builder.GeneratedPropertyBuilderImpl} instead.
19  */
20 @Deprecated
21 public final class GeneratedPropertyBuilderImpl extends AbstractTypeMemberBuilder<GeneratedPropertyBuilder> implements GeneratedPropertyBuilder {
22     private String value;
23     private boolean isReadOnly;
24
25     public GeneratedPropertyBuilderImpl(String name) {
26         super(name);
27         this.isReadOnly = true;
28     }
29
30     @Override
31     public GeneratedPropertyBuilderImpl setValue(String value) {
32         this.value = value;
33         return this;
34     }
35
36     @Override
37     public GeneratedPropertyBuilderImpl setReadOnly(boolean isReadOnly) {
38         this.isReadOnly = isReadOnly;
39         return this;
40     }
41
42     @Override
43     protected GeneratedPropertyBuilderImpl thisInstance() {
44         return this;
45     }
46
47     @Override
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);
52     }
53
54     @Override
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());
71         builder.append("]");
72         return builder.toString();
73     }
74 }