View Javadoc

1   package org.ocltf.concretesyntax.impl;
2   
3   import org.apache.commons.lang.builder.ToStringBuilder;
4   import org.ocltf.concretesyntax.OperationCS;
5   import org.ocltf.concretesyntax.VariableDeclarationCS;
6   import org.ocltf.utils.ExceptionUtils;
7   
8   /***
9    * An implementation of the ocl OperationDeclaration facade.
10   * 
11   * @see org.ocltf.concretesyntax.OperationCS
12   * 
13   * @author Chad Brandon
14   */
15  public class OperationDeclarationCSImpl implements OperationCS {
16  
17  	private String name;
18  	private String returnType;
19  	private VariableDeclarationCS[] parameters = new VariableDeclarationCS[0];
20  
21  	/***
22  	 * Constructs a new OperationDeclarationCSImpl
23  	 * 
24  	 * @param name the name of the OperationCS
25  	 * @param returnType the returnType of the operation
26  	 * @param parameters the parameters of the operation.
27  	 */
28  	public OperationDeclarationCSImpl(
29  		String name, 
30  		String returnType, 
31  		VariableDeclarationCS[] parameters) {
32  		String methodName = "OperationDeclarationCSImpl";
33  		ExceptionUtils.checkNull(methodName, "name", name);
34  		ExceptionUtils.checkNull(methodName, "returnType", returnType);
35  		this.name = name;
36  		this.returnType = returnType;
37  		this.parameters = parameters;
38  	}
39  	
40  	/***
41  	 * @see org.ocltf.concretesyntax.OperationCS#getName()
42  	 */
43  	public String getName() {
44  		return this.name;
45  	}
46  	
47  	/***
48  	 * @see org.ocltf.concretesyntax.OperationCS#getReturnType()
49  	 */
50  	public String getReturnType() {
51  		return this.returnType;
52  	}
53  
54  	/***
55  	 * @see org.ocltf.concretesyntax.OperationCS#getParameters()
56  	 */
57  	public VariableDeclarationCS[] getParameters() {
58  		return parameters;
59  	}
60  
61      /***
62       * @see java.lang.Object#toString()
63       */
64  	public String toString() { 
65  		return ToStringBuilder.reflectionToString(this);
66  	}
67  
68  }