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   * A role for an attribute or association.
28   *
29   * @author  Michael Heuer
30   * @version $Revision: 1059 $ $Date: 2012-01-03 14:03:02 -0600 (Tue, 03 Jan 2012) $
31   */
32  public final class Role
33  {
34      /** The lowercase name for this role. */
35      private final String lower;
36  
37      /** The mixed-case name for this role. */
38      private final String mixed;
39  
40      /** The uppercase name for this role. */
41      private final String upper;
42  
43      /** The description for this role. */
44      private final String description;
45  
46  
47      /**
48       * Create a new role with the specified name.
49       *
50       * @param name role name
51       */
52      public Role(final String name)
53      {
54          this.lower = CodegenUtils.makeLowercase(name);
55          this.upper = CodegenUtils.makeUppercase(name);
56          this.mixed = CodegenUtils.makeMixedCase(name);
57          this.description = CodegenUtils.makeDescription(name);
58      }
59  
60      /**
61       * Create a new role from the specified parameters.
62       *
63       * @param lower lowercase name for this role
64       * @param mixed mixed-case name for this role
65       * @param upper uppercase name for this role
66       * @param description description for this role
67       */
68      public Role(final String lower,
69                  final String mixed,
70                  final String upper,
71                  final String description)
72      {
73          this.lower = lower;
74          this.mixed = mixed;
75          this.upper = upper;
76          this.description = description;
77      }
78  
79  
80      /**
81       * Return the lowercase name for this role.
82       *
83       * @return the lowercase name for this role
84       */
85      public String getLower()
86      {
87          return lower;
88      }
89  
90      /**
91       * Return the mixed-case name for this role.
92       *
93       * @return the mixed-case name for this role
94       */
95      public String getMixed()
96      {
97          return mixed;
98      }
99  
100     /**
101      * Return the uppercase name for this role.
102      *
103      * @return the uppercase name for this role
104      */
105     public String getUpper()
106     {
107         return upper;
108     }
109 
110     /**
111      * Return the description for this role.
112      *
113      * @return the description for this role
114      */
115     public String getDescription()
116     {
117         return description;
118     }
119 }