24f81399f1dcbaaedeaa5de474f7a6615bddd42f
[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     private final boolean nullifyEmpty;
20
21     GeneratedPropertyImpl(final Type definingType, final String name, final List<AnnotationType> annotations,
22             final String comment, final AccessModifier accessModifier, final Type returnType, final boolean isFinal,
23             final boolean isStatic, final boolean isReadOnly, final boolean nullifyEmpty, final String value) {
24         super(definingType, name, annotations, comment, accessModifier, returnType, isFinal, isStatic);
25         this.value = value;
26         this.readOnly = isReadOnly;
27         this.nullifyEmpty = nullifyEmpty;
28     }
29
30     @Override
31     public String getValue() {
32         return this.value;
33     }
34
35     @Override
36     public boolean isReadOnly() {
37         return this.readOnly;
38     }
39
40     @Override
41     public boolean nullifyEmpty() {
42         return this.nullifyEmpty;
43     }
44
45     @Override
46     public String toString() {
47         final StringBuilder builder = new StringBuilder();
48         builder.append("GeneratedPropertyImpl [name=");
49         builder.append(getName());
50         builder.append(", annotations=");
51         builder.append(getAnnotations());
52         builder.append(", comment=");
53         builder.append(getComment());
54         if (getDefiningType() != null) {
55             builder.append(", parent=");
56             builder.append(getDefiningType().getPackageName());
57             builder.append(".");
58             builder.append(getDefiningType().getName());
59         } else {
60             builder.append(", parent=null");
61         }
62         builder.append(", returnType=");
63         builder.append(getReturnType());
64         builder.append(", isFinal=");
65         builder.append(isFinal());
66         builder.append(", isReadOnly=");
67         builder.append(this.readOnly);
68         builder.append(", modifier=");
69         builder.append(getAccessModifier());
70         builder.append("]");
71         return builder.toString();
72     }
73 }