1 package org.andromda.translation.ocl.syntax;
2
3 import org.andromda.core.common.ExceptionUtils;
4 import org.apache.commons.lang.StringUtils;
5
6
7
8
9
10
11
12 public class VariableDeclarationImpl
13 implements VariableDeclaration
14 {
15 private String name;
16 private String type;
17 private String value;
18
19
20
21
22
23
24
25
26 public VariableDeclarationImpl(String name, String type, String value)
27 {
28 ExceptionUtils.checkNull("name", name);
29 this.name = StringUtils.trimToEmpty(name);
30 this.type = StringUtils.trimToEmpty(type);
31 this.value = StringUtils.trimToEmpty(value);
32 }
33
34
35
36
37 public String getName()
38 {
39 return this.name;
40 }
41
42
43
44
45
46
47 public String getType()
48 {
49 return this.type;
50 }
51
52
53
54
55 public String getValue()
56 {
57 return this.value;
58 }
59
60
61
62
63 public String toString()
64 {
65 StringBuilder toString = new StringBuilder(this.getName());
66 if (StringUtils.isNotBlank(this.getType()))
67 {
68 toString.append(':');
69 toString.append(this.getType());
70 }
71 return toString.toString();
72 }
73 }