Source code: com/port80/eclipse/jdt/graph/TypeWrapper.java
1 package com.port80.eclipse.jdt.graph;
2
3 import org.eclipse.jdt.core.dom.ITypeBinding;
4
5 /**
6 * Wrapper of an ITypeBinding to make sure they compares with the full type name.
7 *
8 * @author chrisl
9 */
10 public class TypeWrapper implements IBindingWrapper{
11
12 ////////////////////////////////////////////////////////////////////////
13
14 private ITypeBinding fBinding;
15 /** Fully qualified resolved type name. */
16 private String fFullName;
17
18 ////////////////////////////////////////////////////////////////////////
19
20 public TypeWrapper(ITypeBinding type) {
21 fBinding = type;
22 fFullName = GraphUtil.getFullTypeName(type);
23 }
24
25 // IBindingWrapper interface ///////////////////////////////////////////
26
27 public String getName() {
28 return fFullName;
29 }
30 public boolean isType() {
31 return true;
32 }
33 public boolean isMethod() {
34 return false;
35 }
36
37 ////////////////////////////////////////////////////////////////////////
38
39 public String getFullName() {
40 return fFullName;
41 }
42 public String getSimpleName() {
43 ITypeBinding type=fBinding;
44 return GraphUtil.getSimpleTypeName(type);
45 }
46 public ITypeBinding getBinding() {
47 return fBinding;
48 }
49 public int getModifiers() {
50 return fBinding.getModifiers();
51 }
52 public boolean isInterface() {
53 return fBinding.isInterface();
54 }
55 public int hashCode() {
56 return fFullName.hashCode();
57 }
58 public boolean equals(Object a) {
59 if (!(a instanceof ITypeBinding))
60 return false;
61 return fFullName.equals(GraphUtil.getFullTypeName((ITypeBinding) a));
62 }
63
64 ////////////////////////////////////////////////////////////////////////
65
66 }