View Javadoc

1   /*
2   
3       dsh-codegen  Source code generation suite.
4       Copyright (c) 2004-2013 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   */
88  public enum Style
89  {
90  
91      /**
92       * Immutable source code generation style.
93       */
94      Immutable,
95  
96      /**
97       * Immutable with copy mutators source code generation style.
98       */
99      ImmutableWithCopyMutators,
100 
101     /**
102      * Mutable source code generation style.
103      */
104     Mutable,
105 
106     /**
107      * Mutable bean source code generation style, with property change support.
108      */
109     MutableBean,
110 
111     /**
112      * Richly mutable source code generation style.
113      */
114     RichlyMutable,
115 
116     /**
117      * Richly mutable source code generation style with a few additional
118      * methods per attribute and association.
119      *
120      * <p><b>TODO</b>: come up with a more appropriate name for this value</p>
121      */
122     ExtendedRichlyMutable,
123 
124     /**
125      * Unsafe source code generation style.
126      */
127     Unsafe,
128 
129     /**
130      * Exception source code generation style.
131      */
132     Exception,
133 
134     /**
135      * RuntimeException source code generation style.
136      */
137     RuntimeException
138 };