Extended binding-model-api to support of Enclosed Generated Types and TOs.
[controller.git] / opendaylight / sal / yang-prototype / code-generator / binding-model-api / src / main / java / org / opendaylight / controller / sal / binding / model / api / type / builder / GeneratedTOBuilder.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.sal.binding.model.api.type.builder;
9
10 import org.opendaylight.controller.sal.binding.model.api.GeneratedTransferObject;
11
12 /**
13  * Generated Transfer Object Builder is interface that contains methods to
14  * build and instantiate Generated Transfer Object definition.
15  *
16  * @see GeneratedTransferObject
17  */
18 public interface GeneratedTOBuilder extends GeneratedTypeBuilder {
19
20     /**
21      * Add Generated Transfer Object from which will be extended current
22      * Generated Transfer Object.
23      * <br>
24      * By definition Java does not allow multiple
25      * inheritance, hence if there is already definition of Generated
26      * Transfer Object the extending object will be overwritten by lastly
27      * added Generated Transfer Object.
28      * <br>
29      * If Generated Transfer Object is <code>null</code> the method SHOULD
30      * throw {@link IllegalArgumentException}
31      *
32      * @param genTransObj Generated Transfer Object
33      */
34     public void setExtendsType(final GeneratedTransferObject genTransObj);
35
36     /**
37      * Add new Generated Property definition for Generated Transfer Object
38      * Builder and returns Generated Property Builder for specifying Property.
39      * <br>
40      * Name of Property cannot be <code>null</code>,
41      * if it is <code>null</code> the method SHOULD throw {@link IllegalArgumentException}
42      *
43      * @param name Name of Property
44      * @return <code>new</code> instance of Generated Property Builder.
45      */
46     public GeneratedPropertyBuilder addProperty(final String name);
47
48     /**
49      * Add Property that will be part of <code>equals</code> definition.
50      * <br>
51      * If Generated Property Builder is <code>null</code> the method SHOULD
52      * throw {@link IllegalArgumentException}
53      *
54      * @param property Generated Property Builder
55      * @return <code>true</code> if addition of Generated Property into list
56      * of <code>equals</code> properties is successful.
57      */
58     public boolean addEqualsIdentity(final GeneratedPropertyBuilder property);
59
60     /**
61      * Add Property that will be part of <code>hashCode</code> definition.
62      * <br>
63      * If Generated Property Builder is <code>null</code> the method SHOULD
64      * throw {@link IllegalArgumentException}
65      *
66      * @param property Generated Property Builder
67      * @return <code>true</code> if addition of Generated Property into list
68      * of <code>hashCode</code> properties is successful.
69      */
70     public boolean addHashIdentity(final GeneratedPropertyBuilder property);
71
72     /**
73      * Add Property that will be part of <code>toString</code> definition.
74      * <br>
75      * If Generated Property Builder is <code>null</code> the method SHOULD
76      * throw {@link IllegalArgumentException}
77      *
78      * @param property Generated Property Builder
79      * @return <code>true</code> if addition of Generated Property into list
80      * of <code>toString</code> properties is successful.
81      */
82     public boolean addToStringProperty(final GeneratedPropertyBuilder property);
83
84     @Override
85     public GeneratedTransferObject toInstance();
86 }