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