Public Methods | |
| SaMethodDescription (String key) | |
| Construct a method description for the given key. More... | |
| boolean | valid () |
| Indicates whether the description is valid. More... | |
| String | className () |
| The name of the class to which the function belongs. More... | |
| String | description () |
| The function description. More... | |
| int | isStatic () |
| Indicates whether the function is static. More... | |
| int | nArgs () |
| The number of arguments of the function. More... | |
| String | name () |
| The name of the function. More... | |
| String | returnType () |
| The return type of the function. More... | |
| String[] | argNames () |
| The names of the function arguments. More... | |
| String[] | argTypes () |
| The types of the function arguments. More... | |
| void | dump () |
| Dumps the description on OutputStreamArea. More... | |
|
|
Construct a method description for the given key.
00025 {
00026 boolean foundReturn = false; // may not be present in the registry
00027 int i = key.indexOf("::");
00028 if (i == -1)
00029 return;
00030 _className = key.substring(0, i);
00031 _methodKey = key.substring(i+2);
00032 String cKey = "/sasystem/classes/" + _className + "/methods/" + _methodKey;
00033 HxMediatorPeer _mediator = new HxMediatorPeer();
00034 String[] names = _mediator.getValueNames(cKey);
00035 String[] data = _mediator.getValueData(cKey);
00036 _nArgs = 0;
00037 for (i=0 ; i<names.length ; i++) {
00038 if (names[i].compareTo("description") == 0)
00039 _description = data[i];
00040 if (names[i].compareTo("isStatic") == 0)
00041 _isStatic = java.lang.Integer.parseInt(data[i]);
00042 if (names[i].compareTo("nArgs") == 0)
00043 _nArgs = java.lang.Integer.parseInt(data[i]);
00044 if (names[i].compareTo("name") == 0)
00045 _name = data[i];
00046 if (names[i].compareTo("returnType") == 0) {
00047 _returnType = data[i];
00048 foundReturn = true;
00049 }
00050 }
00051 if (! foundReturn) {
00052 // _returnType = new String("void");
00053 _returnType = _name; // assume it is a constructor
00054 }
00055 _argNames = new String[_nArgs];
00056 for (i=0 ; i<_nArgs ; i++)
00057 _argNames[i] = new String("argument" + java.lang.String.valueOf(i));
00058 _argTypes = new String[_nArgs];
00059 for (i=0 ; i<names.length ; i++) {
00060 int j;
00061 for (j=0 ; j<_nArgs ; j++) {
00062 if (names[i].compareTo("name" + j) == 0)
00063 _argNames[j] = data[i];
00064 }
00065 for (j=0 ; j<_nArgs ; j++) {
00066 if (names[i].compareTo("type" + j) == 0)
00067 _argTypes[j] = data[i];
00068 }
00069 }
00070 _valid = true;
00071 }
|
|
|
Indicates whether the description is valid.
00077 {
00078 return _valid;
00079 }
|
|
|
The name of the class to which the function belongs.
00085 {
00086 return _className;
00087 }
|
|
|
The function description.
00093 {
00094 return _description;
00095 }
|
|
|
Indicates whether the function is static.
00101 {
00102 return _isStatic;
00103 }
|
|
|
The number of arguments of the function.
00109 {
00110 return _nArgs;
00111 }
|
|
|
The name of the function.
00117 {
00118 return _name;
00119 }
|
|
|
The return type of the function.
00125 {
00126 return _returnType;
00127 }
|
|
|
The names of the function arguments.
00133 {
00134 return _argNames;
00135 }
|
|
|
The types of the function arguments.
00141 {
00142 return _argTypes;
00143 }
|
|
|
Dumps the description on OutputStreamArea.
00149 {
00150 OutputStreamArea.println("_description: " + _description);
00151 OutputStreamArea.println("_isStatic: " + _isStatic);
00152 OutputStreamArea.println("_nArgs: " + _nArgs);
00153 OutputStreamArea.println("_name: " + _name);
00154 OutputStreamArea.println("_returnType: " + _returnType);
00155 int i;
00156 for (i=0 ; i<_argNames.length ; i++)
00157 OutputStreamArea.println("_arg" + i + ": " + _argTypes[i] + " " + _argNames[i]);
00158 }
|
1.2.12 written by Dimitri van Heesch,
© 1997-2001