c83aefb7a6f5c9f2ef5871170fa3260b91ae68b2
[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 readOnly;
19
20     GeneratedPropertyImpl(final Type definingType, final String name, final List<AnnotationType> annotations,
21             final String comment, final AccessModifier accessModifier, final Type returnType, final boolean isFinal,
22             final boolean isStatic, final boolean isReadOnly, final String value) {
23         super(definingType, name, annotations, comment, accessModifier, returnType, isFinal, isStatic);
24         this.value = value;
25         this.readOnly = isReadOnly;
26     }
27
28     @Override
29     public String getValue() {
30         return this.value;
31     }
32
33     @Override
34     public boolean isReadOnly() {
35         return this.readOnly;
36     }
37
38     @Override
39     public String toString() {
40         final 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(this.readOnly);
61         builder.append(", modifier=");
62         builder.append(getAccessModifier());
63         builder.append("]");
64         return builder.toString();
65     }
66 }