011e7ad6121a1c29a0e6aa9dd78c2bcf8750f195
[mdsal.git] / binding / mdsal-binding-generator-api / src / main / java / org / opendaylight / mdsal / binding / model / api / GeneratedProperty.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.api;
9
10 /**
11  * Generated Property extends {@link TypeMember} interface with additional information about fields (and other members)
12  * declared in Java Transfer Objects (or any java classes) and their access counterparts (getters and setters).
13  *
14  * @see TypeMember
15  */
16 // FIXME: 7.0.0: this interface (and others) need to be refactored:
17 //               - getValue() is pretty much unused and its semantics are undefined
18 //               - isReadOnly() is not related to getValue() and is not used together
19 //               - nullifyEmpty() is applicable only to collection types and implies non-read-only and without value
20 //               - this is misused by Builder spec :(
21 public interface GeneratedProperty extends TypeMember {
22
23     String getValue();
24
25     /**
26      * Returns <code>true</code> if the property is declared as read-only. If this {@code true} the property should be
27      * generated with only a getter.
28      *
29      * @return {@code true<} if the property is declared as read-only.
30      */
31     boolean isReadOnly();
32
33     /**
34      * Returns indication whether the value should be squashed from empty collection to a null. This property is valid
35      * only if {@link #getReturnType()} results in a well-known collection type: List or Map.
36      *
37      * @return True if empty collections should be turned to nulls
38      */
39     boolean nullifyEmpty();
40 }