View Javadoc

1   /*
2   
3       dsh-codegen  Source code generation suite.
4       Copyright (c) 2004-2012 held jointly by the individual authors.
5   
6       This library is free software; you can redistribute it and/or modify it
7       under the terms of the GNU Lesser General Public License as published
8       by the Free Software Foundation; either version 3 of the License, or (at
9       your option) any later version.
10  
11      This library is distributed in the hope that it will be useful, but WITHOUT
12      ANY WARRANTY; with out even the implied warranty of MERCHANTABILITY or
13      FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
14      License for more details.
15  
16      You should have received a copy of the GNU Lesser General Public License
17      along with this library;  if not, write to the Free Software Foundation,
18      Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA.
19  
20      > http://www.fsf.org/licensing/licenses/lgpl.html
21      > http://www.opensource.org/licenses/lgpl-license.php
22  
23  */
24  package org.dishevelled.codegen;
25  
26  /**
27   * Source code generation style.
28   *
29   * <p>Feature summary:
30   * <style type="text/css">.header th { text-decoration: underline; }</style>
31   * <table width="90%">
32   *   <tr class="header">
33   *     <th>Consideration</th><th>Immutable</th><th>ImmutableWithCopyMutators</th><th>Mutable</th>
34   *     <th>RichlyMutable</th><th>ExtendedRichlyMutable</th><th>Unsafe</th>
35   *   </tr>
36   *   <tr><td>final field</td>
37   *       <td>X</td><td>X</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>
38   *   <tr><td>final collection field</td>
39   *       <td>X</td><td>X</td><td>X</td><td>X</td><td>X</td><td>&nbsp;</td></tr>
40   *   <tr><td>final class</td>
41   *       <td>X</td><td>X</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>
42   *   <tr><td>defensive copy</td>
43   *       <td>X</td><td>X</td><td>X</td><td>X</td><td>X</td><td>&nbsp;</td></tr>
44   *   <tr><td>unmodifiable at creation</td>
45   *       <td>X</td><td>X</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>
46   *   <tr><td>unmodifiable at access</td>
47   *       <td>&nbsp;</td><td>&nbsp;</td><td>X</td><td>X</td><td>X</td><td>&nbsp;</td></tr>
48   *   <tr><td>get method</td>
49   *       <td>X</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td></tr>
50   *   <tr><td>set method</td>
51   *       <td>&nbsp;</td><td>&nbsp;</td><td>X</td><td>X</td><td>X</td><td>X</td></tr>
52   *   <tr><td>set collection method</td>
53   *       <td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>X</td></tr>
54   *   <tr><td>with copy mutator</td>
55   *       <td>&nbsp;</td><td>X</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>
56   *   <tr><td>has method</td>
57   *       <td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>X</td><td>&nbsp;</td></tr>
58   *   <tr><td>add method</td>
59   *       <td>&nbsp;</td><td>&nbsp;</td><td>X</td><td>X</td><td>X</td><td>&nbsp;</td></tr>
60   *   <tr><td>add... method</td>
61   *       <td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>X</td><td>&nbsp;</td></tr>
62   *   <tr><td>addAll method</td>
63   *       <td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>X</td><td>X</td><td>&nbsp;</td></tr>
64   *   <tr><td>remove method</td>
65   *       <td>&nbsp;</td><td>&nbsp;</td><td>X</td><td>X</td><td>X</td><td>&nbsp;</td></tr>
66   *   <tr><td>remove... method</td>
67   *       <td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>X</td><td>&nbsp;</td></tr>
68   *   <tr><td>removeAll method</td>
69   *       <td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>X</td><td>X</td><td>&nbsp;</td></tr>
70   *   <tr><td>retainAll method</td>
71   *       <td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>X</td><td>X</td><td>&nbsp;</td></tr>
72   *   <tr><td>clear method</td>
73   *       <td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>X</td><td>X</td><td>&nbsp;</td></tr>
74   *   <tr><td>final methods</td>
75   *       <td>&nbsp;</td><td>&nbsp;</td><td>X</td><td>X</td><td>X</td><td>&nbsp;</td></tr>
76   *   <tr><td>default constructor</td>
77   *       <td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>
78   *   <tr><td>required argument only constructor</td>
79   *       <td>&nbsp;</td><td>&nbsp;</td><td>X</td><td>X</td><td>X</td><td>X</td></tr>
80   *   <tr><td>full argument constructor</td>
81   *       <td>X</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td></tr>
82   *   <tr><td>override toString and hashCode</td>
83   *       <td>&nbsp;</td><td>&nbsp;</td><td>X</td><td>X</td><td>X</td><td>X</td></tr>
84   * </table></p>
85   *
86   * @author  Michael Heuer
87   * @version $Revision: 1059 $ $Date: 2012-01-03 14:03:02 -0600 (Tue, 03 Jan 2012) $
88   */
89  public enum Style
90  {
91  
92      /**
93       * Immutable source code generation style.
94       */
95      Immutable,
96  
97      /**
98       * Immutable with copy mutators source code generation style.
99       */
100     ImmutableWithCopyMutators,
101 
102     /**
103      * Mutable source code generation style.
104      */
105     Mutable,
106 
107     /**
108      * Mutable bean source code generation style, with property change support.
109      */
110     MutableBean,
111 
112     /**
113      * Richly mutable source code generation style.
114      */
115     RichlyMutable,
116 
117     /**
118      * Richly mutable source code generation style with a few additional
119      * methods per attribute and association.
120      *
121      * <p><b>TODO</b>: come up with a more appropriate name for this value</p>
122      */
123     ExtendedRichlyMutable,
124 
125     /**
126      * Unsafe source code generation style.
127      */
128     Unsafe,
129 
130     /**
131      * Exception source code generation style.
132      */
133     Exception,
134 
135     /**
136      * RuntimeException source code generation style.
137      */
138     RuntimeException
139 };