1
2
3
4
5
6
7
8 package it.imolinfo.jbi4corba.webservice.generator;
9
10
11
12
13
14
15
16 import java.util.HashMap;
17 import java.util.Map;
18 import java.util.Set;
19
20 public class AnyType implements SearchedType {
21
22 public static final String CORBA_ANY_TYPE = "org.omg.CORBA.Any";
23 public static final String CORBA_ANY_IMPL_TYPE = "com.sun.corba.se.impl.corba.AnyImpl";
24 public static final String SEPARATOR_STR = "#";
25 public static final String EXCEPTION_STR = "exception";
26 public static final String PARAMETER_STR = "parameter";
27 public static final String RETURN_STR = "return";
28
29
30 private boolean isAnyType = false;
31
32
33 private boolean isException = false;
34
35
36 private String typeName = null;
37
38
39 private Class clsHavingAny = null;
40
41
42 private String fieldName = null;
43
44
45 private int idxParamOrExc = -1;
46
47
48 private String methodName = null;
49
50
51
52
53 public AnyType(Class clsParent, String fldName, boolean isExc,
54 int paramOrExceptionIdx, String metName) {
55 clsHavingAny = clsParent;
56 fieldName = fldName;
57 if (clsHavingAny == null)
58 isAnyType = true;
59
60 isException = isExc;
61 idxParamOrExc = paramOrExceptionIdx;
62 methodName = metName;
63
64 constructTypeName();
65 }
66
67 private void constructTypeName() {
68 if (isAnyType) {
69 typeName = methodName + SEPARATOR_STR;
70 if (isException) {
71 typeName += EXCEPTION_STR + idxParamOrExc;
72 } else {
73 if (idxParamOrExc > -1)
74 typeName += PARAMETER_STR + idxParamOrExc;
75 else
76 typeName += RETURN_STR;
77
78 }
79
80 } else {
81 typeName = clsHavingAny.getName() + SEPARATOR_STR + fieldName;
82 }
83
84 }
85
86 public AnyType() {
87
88 }
89
90 public String getTypeName() {
91
92 return typeName;
93 }
94
95 public void setTypeName(String typeName) {
96 this.typeName = typeName;
97
98 }
99
100 public static boolean isAnyType(String type)
101 {
102 if (CORBA_ANY_TYPE.equals(type) || CORBA_ANY_IMPL_TYPE.equals(type))
103 return true;
104 return false;
105 }
106
107 }