Bug 7759 - TEST - Getter of BA object fails to construct class instance
[mdsal.git] / binding / mdsal-binding-generator-util / src / main / java / org / opendaylight / mdsal / binding / model / 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.mdsal.binding.model.util.generated.type.builder;
9
10 import java.util.List;
11 import org.opendaylight.mdsal.binding.model.api.AccessModifier;
12 import org.opendaylight.mdsal.binding.model.api.AnnotationType;
13 import org.opendaylight.mdsal.binding.model.api.GeneratedProperty;
14 import org.opendaylight.mdsal.binding.model.api.Type;
15
16 final class GeneratedPropertyImpl extends AbstractTypeMember implements GeneratedProperty {
17     private final String value;
18     private final boolean isReadOnly;
19
20     public GeneratedPropertyImpl(final Type definingType, final String name, final List<AnnotationType> annotations, final String comment,
21                                  final AccessModifier accessModifier, final Type returnType, final boolean isFinal, final boolean isStatic, final boolean isReadOnly, final String value) {
22         super(definingType, name, annotations, comment, accessModifier, returnType, isFinal, isStatic);
23         this.value = value;
24         this.isReadOnly = isReadOnly;
25     }
26
27     @Override
28     public String getValue() {
29         return this.value;
30     }
31
32     @Override
33     public boolean isReadOnly() {
34         return this.isReadOnly;
35     }
36
37     @Override
38     public String toString() {
39         final StringBuilder builder = new StringBuilder();
40         builder.append("GeneratedPropertyImpl [name=");
41         builder.append(getName());
42         builder.append(", annotations=");
43         builder.append(getAnnotations());
44         builder.append(", comment=");
45         builder.append(getComment());
46         if (getDefiningType() != null) {
47             builder.append(", parent=");
48             builder.append(getDefiningType().getPackageName());
49             builder.append(".");
50             builder.append(getDefiningType().getName());
51         } else {
52             builder.append(", parent=null");
53         }
54         builder.append(", returnType=");
55         builder.append(getReturnType());
56         builder.append(", isFinal=");
57         builder.append(isFinal());
58         builder.append(", isReadOnly=");
59         builder.append(this.isReadOnly);
60         builder.append(", modifier=");
61         builder.append(getAccessModifier());
62         builder.append("]");
63         return builder.toString();
64     }
65 }