forked from tushartushar/DesigniteJava
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSM_Parameter.java
More file actions
66 lines (51 loc) · 1.59 KB
/
SM_Parameter.java
File metadata and controls
66 lines (51 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package Designite.SourceModel;
import java.io.PrintWriter;
import org.eclipse.jdt.core.dom.SingleVariableDeclaration;
import org.eclipse.jdt.core.dom.Type;
public class SM_Parameter extends SM_EntitiesWithType {
private SM_Method parentMethod;
private SingleVariableDeclaration variableDecl;
public SM_Parameter(SingleVariableDeclaration variable, SM_Method methodObj) {
name = variable.getName().toString();
this.parentMethod = methodObj;
variableDecl = variable;
}
void setParent(SM_Method parentMethod) {
this.parentMethod = parentMethod;
}
public SM_Method getParent() {
return parentMethod;
}
@Override
public SM_Type getParentType() {
return this.parentMethod.getParentType();
}
@Override
public void printDebugLog(PrintWriter writer) {
print(writer, "\t\t\tParameter: " + name);
print(writer, "\t\t\tParent Method: " + getParent().getName());
if (!isPrimitiveType() && getType() != null)
print(writer, "\t\t\tParameter type: " + getType().getName());
else {
print(writer, "\t\t\tPrimitive parameter type: " + getPrimitiveType());
}
print(writer, "\t\t\t----");
}
@Override
public void resolve() {
Resolver resolver = new Resolver();
typeInfo = resolver.resolveVariableType(variableDecl.getType(), parentMethod.getParentType().getParentPkg().getParentProject(), getParentType());
}
public Type getTypeBinding() {
return variableDecl.getType();
}
@Override
public String toString() {
return "Parameter=" + name
+ ", type=" + getTypeBinding()
+ ", is=" + getTypeBinding().getNodeType();
}
@Override
public void parse() {
}
}