[New Feature]: Introduce an API to obtain initializer method type from ObjectType #40302
Labels
needTriage
The issue has to be inspected and labeled manually
Priority/High
Team/jBallerina
All the issues related to BIR, JVM backend code generation and runtime
Type/NewFeature
userCategory/Compilation
Milestone
Description
At present, invoking
getMethods()
function on theObjectType
produces an array of methods that does not comprise theinit
method. However, there is a need to obtain access to theinit
method type of theObjectType
for constructing the service object.Consider the following class
Calling
getMethods()
on the above class returns an array containingapplyOnField
method but not theinit
method.Describe your problem(s)
We have a requirement in GraphQL module to construct service objects from a given object
typedesc
. To do that the knowledge of theinit
method parameter types is necessary to create the relevant object by constructing those values in the native side. Unfortunately, currently there isn't a straightforward approach to create an object from a typedesc.Describe your solution(s)
I can think of two ways:
getMethods()
function to include the type of theinit
method in the returned array.getInitializer()
that solely returns the methodType of theinit
method.Related area
-> Compilation
Related issue(s) (optional)
No response
Suggested label(s) (optional)
No response
Suggested assignee(s) (optional)
No response
The text was updated successfully, but these errors were encountered: