Fixed some major sonar issues in yang-validation-tool
[yangtools.git] / code-generator / binding-generator-util / src / main / java / org / opendaylight / yangtools / binding / generator / util / generated / type / builder / GeneratedPropertyImpl.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.AccessModifier;
13 import org.opendaylight.yangtools.sal.binding.model.api.AnnotationType;
14 import org.opendaylight.yangtools.sal.binding.model.api.GeneratedProperty;
15 import org.opendaylight.yangtools.sal.binding.model.api.Type;
16
17 final class GeneratedPropertyImpl extends AbstractTypeMember implements GeneratedProperty {
18     private String value;
19     private boolean isReadOnly;
20
21     public GeneratedPropertyImpl(Type definingType, String name, List<AnnotationType> annotations, String comment,
22                                  AccessModifier accessModifier, Type returnType, boolean isFinal, boolean isStatic, boolean isReadOnly, String value) {
23         super(definingType, name, annotations, comment, accessModifier, returnType, isFinal, isStatic);
24         this.value = value;
25         this.isReadOnly = isReadOnly;
26     }
27
28     @Override
29     public String getValue() {
30         return value;
31     }
32
33     @Override
34     public boolean isReadOnly() {
35         return isReadOnly;
36     }
37
38     @Override
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(getAnnotations());
45         builder.append(", comment=");
46         builder.append(getComment());
47         if (getDefiningType() != null) {
48             builder.append(", parent=");
49             builder.append(getDefiningType().getPackageName());
50             builder.append(".");
51             builder.append(getDefiningType().getName());
52         } else {
53             builder.append(", parent=null");
54         }
55         builder.append(", returnType=");
56         builder.append(getReturnType());
57         builder.append(", isFinal=");
58         builder.append(isFinal());
59         builder.append(", isReadOnly=");
60         builder.append(isReadOnly);
61         builder.append(", modifier=");
62         builder.append(getAccessModifier());
63         builder.append("]");
64         return builder.toString();
65     }
66 }