View Javadoc
1   package org.codehaus.modello.plugin.java.metadata;
2   
3   /*
4    * Copyright (c) 2004, Codehaus.org
5    *
6    * Permission is hereby granted, free of charge, to any person obtaining a copy of
7    * this software and associated documentation files (the "Software"), to deal in
8    * the Software without restriction, including without limitation the rights to
9    * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
10   * of the Software, and to permit persons to whom the Software is furnished to do
11   * so, subject to the following conditions:
12   *
13   * The above copyright notice and this permission notice shall be included in all
14   * copies or substantial portions of the Software.
15   *
16   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22   * SOFTWARE.
23   */
24  
25  import java.util.ArrayList;
26  import java.util.List;
27  
28  import org.codehaus.modello.metadata.AssociationMetadata;
29  
30  /**
31   * @author <a href="mailto:evenisse@codehaus.org">Emmanuel Venisse</a>
32   */
33  public class JavaAssociationMetadata implements AssociationMetadata {
34      public static final String ID = JavaAssociationMetadata.class.getName();
35  
36      public static final String LAZY_INIT = "lazy";
37      public static final String CONSTRUCTOR_INIT = "constructor";
38      public static final String FIELD_INIT = "field";
39  
40      public static final List<String> INIT_TYPES;
41  
42      static {
43          INIT_TYPES = new ArrayList<String>();
44          INIT_TYPES.add(LAZY_INIT);
45          INIT_TYPES.add(CONSTRUCTOR_INIT);
46          INIT_TYPES.add(FIELD_INIT);
47      }
48  
49      public static final String CLONE_SHALLOW = "shallow";
50      public static final String CLONE_DEEP = "deep";
51  
52      public static final List<String> CLONE_MODES;
53  
54      static {
55          CLONE_MODES = new ArrayList<String>();
56          CLONE_MODES.add(CLONE_SHALLOW);
57          CLONE_MODES.add(CLONE_DEEP);
58      }
59  
60      private boolean adder = true;
61  
62      private boolean bidi;
63  
64      private String interfaceName;
65  
66      private String initializationMode;
67  
68      private String cloneMode;
69  
70      public boolean isAdder() {
71          return adder;
72      }
73  
74      public void setAdder(boolean adder) {
75          this.adder = adder;
76      }
77  
78      public boolean isBidi() {
79          return bidi;
80      }
81  
82      public void setBidi(boolean bidi) {
83          this.bidi = bidi;
84      }
85  
86      public String getInterfaceName() {
87          return interfaceName;
88      }
89  
90      public void setInterfaceName(String interfaceName) {
91          this.interfaceName = interfaceName;
92      }
93  
94      public String getInitializationMode() {
95          return initializationMode;
96      }
97  
98      public void setInitializationMode(String initializationMode) {
99          if (initializationMode == null) {
100             this.initializationMode = LAZY_INIT;
101         } else {
102             this.initializationMode = initializationMode;
103         }
104     }
105 
106     public String getCloneMode() {
107         return cloneMode;
108     }
109 
110     public void setCloneMode(String cloneMode) {
111         this.cloneMode = cloneMode;
112     }
113 }