Extended binding-model-api to support of Enclosed Generated Types and TOs.
[controller.git] / opendaylight / sal / yang-prototype / code-generator / binding-generator-util / src / main / java / org / opendaylight / controller / 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.controller.binding.generator.util.generated.type.builder;
9
10 import org.opendaylight.controller.sal.binding.model.api.AccessModifier;
11 import org.opendaylight.controller.sal.binding.model.api.AnnotationType;
12 import org.opendaylight.controller.sal.binding.model.api.GeneratedProperty;
13 import org.opendaylight.controller.sal.binding.model.api.Type;
14
15 import java.util.List;
16
17 final class GeneratedPropertyImpl extends AbstractTypeMember implements GeneratedProperty {
18
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 isReadOnly) {
23         super(definingType, name, annotations, comment, accessModifier, returnType, isFinal);
24         this.isReadOnly = isReadOnly;
25     }
26
27     @Override
28     public boolean isReadOnly() {
29         return isReadOnly;
30     }
31
32     @Override
33     public String toString() {
34         StringBuilder builder = new StringBuilder();
35         builder.append("GeneratedPropertyImpl [name=");
36         builder.append(getName());
37         builder.append(", annotations=");
38         builder.append(getAnnotations());
39         builder.append(", comment=");
40         builder.append(getComment());
41         if (getDefiningType() != null) {
42             builder.append(", parent=");
43             builder.append(getDefiningType().getPackageName());
44             builder.append(".");
45             builder.append(getDefiningType().getName());
46         } else {
47             builder.append(", parent=null");
48         }
49         builder.append(", returnType=");
50         builder.append(getReturnType());
51         builder.append(", isFinal=");
52         builder.append(isFinal());
53         builder.append(", isReadOnly=");
54         builder.append(isReadOnly);
55         builder.append(", modifier=");
56         builder.append(getAccessModifier());
57         builder.append("]");
58         return builder.toString();
59     }
60 }