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