KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > SOFA > Connector > EEG > EEM > Actions > IDLIfaceNormal


1 /*
2  * IDLIfaceNormal.java
3  *
4  * Created on 13. duben 2002, 21:08
5  */

6
7 package SOFA.Connector.EEG.EEM.Actions;
8
9 import SOFA.Connector.EEG.CodeWriter.CDL2IDLMapping;
10 import SOFA.Connector.EEG.CodeWriter.IDLWriterDirectorException;
11 import SOFA.SOFAnode.Made.TIR.ExceptionDef;
12 import SOFA.SOFAnode.Made.TIR.OperationDef;
13 import SOFA.SOFAnode.Made.TIR.ParamDescr;
14
15 /**
16  *
17  * @author ghort
18  * @version
19  */

20 public class IDLIfaceNormal {
21     public static String JavaDoc getOperationDef(OperationDef mt) throws IDLWriterDirectorException {
22         try {
23             StringBuffer JavaDoc ret=new StringBuffer JavaDoc(CDL2IDLMapping.getTypeName(mt.result())+" "+mt.get_identification().name()+"(");
24             
25             int j;
26             ParamDescr[] params=mt.params();
27             for (j=0;j<params.length;j++) {
28                 if (j>0) {
29                     ret.append(", ");
30                 }
31                 ret.append(CDL2IDLMapping.getTypeDecl(params[j].type(),params[j].mode().value())+" "+params[j].name());
32             }
33             
34             ExceptionDef[] exceptions=mt.exceptions();
35             for (j=0;j<exceptions.length;j++) {
36                 if (j==0) {
37                     ret.append(" raises ");
38                 } else {
39                     ret.append(", ");
40                 }
41                 ret.append(exceptions[j].get_identification().absolute_name());
42             }
43             return ret.toString();
44         } catch (Exception JavaDoc e) {
45             throw new IDLWriterDirectorException("Cannot create method declaration.",e);
46         }
47     }
48 }
49
Popular Tags