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 org.codehaus.modello.metadata.AssociationMetadata;
26  
27  import java.util.ArrayList;
28  import java.util.List;
29  
30  /**
31   * @author <a href="mailto:evenisse@codehaus.org">Emmanuel Venisse</a>
32   */
33  public class JavaAssociationMetadata
34      implements AssociationMetadata
35  {
36      public static final String ID = JavaAssociationMetadata.class.getName();
37  
38      public static final String LAZY_INIT = "lazy";
39      public static final String CONSTRUCTOR_INIT = "constructor";
40      public static final String FIELD_INIT = "field";
41  
42      public static final List<String> INIT_TYPES;
43  
44      static
45      {
46          INIT_TYPES = new ArrayList<String>();
47          INIT_TYPES.add( LAZY_INIT );
48          INIT_TYPES.add( CONSTRUCTOR_INIT );
49          INIT_TYPES.add( FIELD_INIT );
50      }
51  
52      public static final String CLONE_SHALLOW = "shallow";
53      public static final String CLONE_DEEP = "deep";
54  
55      public static final List<String> CLONE_MODES;
56  
57      static
58      {
59          CLONE_MODES = new ArrayList<String>();
60          CLONE_MODES.add( CLONE_SHALLOW );
61          CLONE_MODES.add( CLONE_DEEP );
62      }
63  
64      private boolean adder = true;
65  
66      private boolean bidi;
67  
68      private String interfaceName;
69  
70      private String initializationMode;
71  
72      private String cloneMode;
73  
74      public boolean isAdder()
75      {
76          return adder;
77      }
78  
79      public void setAdder( boolean adder )
80      {
81          this.adder = adder;
82      }
83  
84      public boolean isBidi()
85      {
86          return bidi;
87      }
88  
89      public void setBidi( boolean bidi )
90      {
91          this.bidi = bidi;
92      }
93  
94      public String getInterfaceName()
95      {
96          return interfaceName;
97      }
98  
99      public void setInterfaceName( String interfaceName )
100     {
101         this.interfaceName = interfaceName;
102     }
103 
104     public String getInitializationMode()
105     {
106         return initializationMode;
107     }
108 
109     public void setInitializationMode( String initializationMode )
110     {
111         if ( initializationMode == null )
112         {
113             this.initializationMode = LAZY_INIT;
114         }
115         else
116         {
117             this.initializationMode = initializationMode;
118         }
119     }
120 
121     public String getCloneMode()
122     {
123         return cloneMode;
124     }
125 
126     public void setCloneMode( String cloneMode )
127     {
128         this.cloneMode = cloneMode;
129     }
130 
131 }