Skip to content

Method: getComment()

1: package de.fhdw.wtf.generator.java.generatorModel;
2:
3: import java.util.Collection;
4:
5: import de.fhdw.wtf.generator.java.visitor.GenOperationStateVisitor;
6: import de.fhdw.wtf.generator.java.visitor.GenOperationStateVisitorException;
7: import de.fhdw.wtf.generator.java.visitor.GenOperationStateVisitorReturn;
8: import de.fhdw.wtf.generator.java.visitor.GenOperationStateVisitorReturnException;
9:
10: /**
11: * This state indicates a full parsed operation. It contains attributes for all elements of the java operation.
12: *
13: */
14: public final class GenFullParsedOperationState implements GenOperationState {
15:         
16:         /**
17:          * The comment of the operation.
18:          */
19:         private GenComment comment;
20:         
21:         /**
22:          * The exceptions that can be thrown by calling this operation.
23:          */
24:         private final Collection<GenException> exceptions;
25:         
26:         /**
27:          * The type that should be returned.
28:          */
29:         private final GenTypeReference returntyp;
30:         
31:         /**
32:          * The list of modifiers for this operation.
33:          */
34:         private final Collection<GenOperationModifier> modifiers;
35:         
36:         /**
37:          * The visibility of the operation.
38:          */
39:         private GenVisibility visibility;
40:         
41:         /**
42:          * The method-body of this operation.
43:          */
44:         private String methodBody;
45:         
46:         /**
47:          * Constructor of {@link GenFullParsedOperationState}.
48:          *
49:          * @param comment
50:          * The comment of the operation.
51:          * @param exceptions
52:          * The exceptions that can be thrown by calling this operation.
53:          * @param returntyp
54:          * The type that should be returned.
55:          * @param modifiers
56:          * The list of modifiers for this operation.
57:          * @param visibility
58:          * The visibility of the operation.
59:          * @param methodbody
60:          * The method-body of this operation.
61:          */
62:         private GenFullParsedOperationState(final GenComment comment,
63:                         final Collection<GenException> exceptions,
64:                         final GenTypeReference returntyp,
65:                         final Collection<GenOperationModifier> modifiers,
66:                         final GenVisibility visibility,
67:                         final String methodbody) {
68:                 this.comment = comment;
69:                 this.exceptions = exceptions;
70:                 this.modifiers = modifiers;
71:                 this.returntyp = returntyp;
72:                 this.setVisibility(visibility);
73:                 this.methodBody = methodbody;
74:         }
75:         
76:         /**
77:          * Creates a new Object of {@link GenFullParsedOperationState}.
78:          *
79:          * @param comment
80:          * The comment of the operation.
81:          * @param exceptions
82:          * The exceptions that can be thrown by calling this operation.
83:          * @param returntyp
84:          * The type that should be returned.
85:          * @param modifiers
86:          * The list of modifiers for this operation.
87:          * @param visibility
88:          * The visibility of the operation.
89:          * @param methodbody
90:          * The method-body of this operation.
91:          * @return Object of {@link GenFullParsedOperationState}
92:          */
93:         public static GenFullParsedOperationState create(final GenComment comment,
94:                         final Collection<GenException> exceptions,
95:                         final GenTypeReference returntyp,
96:                         final Collection<GenOperationModifier> modifiers,
97:                         final GenVisibility visibility,
98:                         final String methodbody) {
99:                 return new GenFullParsedOperationState(comment, exceptions, returntyp, modifiers, visibility, methodbody);
100:         }
101:         
102:         /**
103:          * The comment of the operation.
104:          *
105:          * @return comment
106:          */
107:         public GenComment getComment() {
108:                 return this.comment;
109:         }
110:         
111:         /**
112:          * The exceptions that can be thrown by calling of the operation.
113:          *
114:          * @return exceptions
115:          */
116:         public Collection<GenException> getExceptions() {
117:                 return this.exceptions;
118:         }
119:         
120:         /**
121:          * The return type of the operation.
122:          *
123:          * @return returntyp
124:          */
125:         public GenTypeReference getReturntyp() {
126:                 return this.returntyp;
127:         }
128:         
129:         /**
130:          * The modifiers of the operation.
131:          *
132:          * @return modifiers
133:          */
134:         public Collection<GenOperationModifier> getModifiers() {
135:                 return this.modifiers;
136:         }
137:         
138:         /**
139:          * The visibility of the operation.
140:          *
141:          * @return visibility
142:          */
143:         public GenVisibility getVisibility() {
144:                 return this.visibility;
145:         }
146:         
147:         /**
148:          * The method-body of the operation.
149:          *
150:          * @return methodbody
151:          */
152:         public String getMethodBody() {
153:                 return this.methodBody;
154:         }
155:         
156:         /**
157:          * Change the comment of the operation.
158:          *
159:          * @param comment
160:          * The new comment
161:          */
162:         public void setComment(final GenComment comment) {
163:                 this.comment = comment;
164:         }
165:         
166:         /**
167:          * Change the visibility of the operation.
168:          *
169:          * @param visibility
170:          * The new visibility
171:          */
172:         public void setVisibility(final GenVisibility visibility) {
173:                 this.visibility = visibility;
174:         }
175:         
176:         /**
177:          * Change the method of the operation.
178:          *
179:          * @param methodBody
180:          * The new method-body
181:          */
182:         public void setMethodBody(final String methodBody) {
183:                 this.methodBody = methodBody;
184:         }
185:         
186:         @Override
187:         public void accept(final GenOperationStateVisitor visitor) {
188:                 visitor.handle(this);
189:         }
190:         
191:         @Override
192:         public <X> X accept(final GenOperationStateVisitorReturn<X> visitor) {
193:                 return visitor.handle(this);
194:         }
195:         
196:         @Override
197:         public <Y extends Exception> void accept(final GenOperationStateVisitorException<Y> visitor) throws Y {
198:                 visitor.handle(this);
199:         }
200:         
201:         @Override
202:         public <X, Y extends Exception> X accept(final GenOperationStateVisitorReturnException<X, Y> visitor) throws Y {
203:                 return visitor.handle(this);
204:         }
205: }