@@ -80,9 +80,9 @@ export class JavaAnalysis {
80
80
const tmpFilePath = path . join ( os . tmpdir ( ) , `${ Date . now ( ) } -${ crypto . randomUUID ( ) } ` ) ;
81
81
const command = [
82
82
...this . getCodeAnalyzerExec ( ) ,
83
- "-i " ,
83
+ "--input " ,
84
84
projectPath ,
85
- "-o " ,
85
+ "--output " ,
86
86
tmpFilePath ,
87
87
`--analysis-level=${ this . analysisLevel } ` ,
88
88
"--verbose" ,
@@ -174,22 +174,14 @@ export class JavaAnalysis {
174
174
}
175
175
176
176
/**
177
- * Get all methods in the application.
178
- * @returns {Promise<Record<string, Record<string, types.JCallableType>>> } A promise that resolves to a record of
179
- * method names and their corresponding {@link JCallableType} objects
177
+ * Get a specific class by its qualified name.
178
+ * @param {string } qualifiedName - The qualified name of the class to retrieve
179
+ * @returns {Promise<types.JTypeType> } A promise that resolves to the {@link JTypeType} object representing the class
180
+ * @throws {Error } If the class is not found in the application
180
181
*
181
- * @notes This method retrieves all methods from the symbol table and returns them as a record. The returned
182
- * record contains class names as keys and their corresponding {@link JCallableType} objects as values.
183
- * Each {@link JCallableType} object contains information about the method's parameters, return type, and
184
- * other relevant details.
182
+ * @notes This method retrieves a specific class from the application by its qualified name. If the class is found,
183
+ * it returns the corresponding {@link JType} object. If the class is not found, it throws an error.
185
184
*/
186
- public async getAllMethods ( ) : Promise < Record < string , Record < string , types . JCallableType > > > {
187
- return Object . entries ( await this . getAllClasses ( ) ) . reduce ( ( allMethods , [ key , value ] ) => {
188
- allMethods [ key ] = value . callable_declarations ;
189
- return allMethods ;
190
- } , { } as Record < string , Record < string , types . JCallableType > > ) ;
191
- }
192
-
193
185
public async getClassByQualifiedName ( qualifiedName : string ) : Promise < types . JTypeType > {
194
186
const allClasses = await this . getAllClasses ( ) ;
195
187
if ( allClasses [ qualifiedName ] ) {
@@ -198,4 +190,36 @@ export class JavaAnalysis {
198
190
else
199
191
throw new Error ( `Class ${ qualifiedName } not found in the application.` ) ;
200
192
}
193
+
194
+ /**
195
+ * Get all methods in the application.
196
+ * @returns {Promise<Record<string, Record<string, types.JCallableType>>> } A promise that resolves to a record of
197
+ * method names and their corresponding {@link JCallableType} objects
198
+ *
199
+ * @notes This method retrieves all methods from the symbol table and returns them as a record. The returned
200
+ * record contains class names as keys and their corresponding {@link JCallableType} objects as values.
201
+ * Each {@link JCallableType} object contains information about the method's parameters, return type, and
202
+ * other relevant details.
203
+ */
204
+ public async getAllMethods ( ) : Promise < Record < string , Record < string , types . JCallableType > > > {
205
+ return Object . entries ( await this . getAllClasses ( ) ) . reduce ( ( allMethods , [ key , value ] ) => {
206
+ allMethods [ key ] = value . callable_declarations ;
207
+ return allMethods ;
208
+ } , { } as Record < string , Record < string , types . JCallableType > > ) ;
209
+ }
210
+
211
+ /**
212
+ * Get all methods in a specific class in the application.
213
+ * @returns {Promise<Record<string, Record<string, types.JCallableType>>> } A promise that resolves to a record of
214
+ * method names and their corresponding {@link JCallableType} objects
215
+ *
216
+ * @notes This method retrieves all methods from the symbol table and returns them as a record. The returned
217
+ * record contains class names as keys and their corresponding {@link JCallableType} objects as values.
218
+ * Each {@link JCallableType} object contains information about the method's parameters, return type, and
219
+ * other relevant details.
220
+ */
221
+ public async getAllMethodsByClass ( qualifiedName : string ) : Promise < Array < types . JCallableType > > {
222
+ const classForWhichMethodsAreRequested = await this . getClassByQualifiedName ( qualifiedName ) ;
223
+ return classForWhichMethodsAreRequested ? Object . values ( classForWhichMethodsAreRequested . callable_declarations ?? { } ) : [ ] ;
224
+ }
201
225
}
0 commit comments