- All Superinterfaces:
AnyType,QilletniType
A Qilletni type representing a function (that has yet to be invoked yet).
-
Method Summary
Modifier and TypeMethodDescription<T> TgetBody()Gets the internal representation of the function's body that may be executed.intGets the number of parameters the function is defined with.intThe number of parameters the function accepts when it is being invoked.getName()The name of the function.If this is an extension function, this returns the type that it is on.String[]Gets the defined parameters of a function, including the first param ifgetOnType()is not null.booleanIf the function was defined outside of an entity.booleanisNative()Checks if the function is defined natively.booleanisStatic()Checks if the function is static that does not need to be invoked on an instance of something.Methods inherited from interface dev.qilletni.api.lang.types.QilletniType
getTypeClass, minusOperator, minusOperatorInPlace, plusOperator, plusOperatorInPlace, qilletniEquals, stringValue, typeName
-
Method Details
-
getName
-
getParams
String[] getParams()Gets the defined parameters of a function, including the first param ifgetOnType()is not null.- Returns:
- The parameters of the function definition
-
getDefinedParamCount
int getDefinedParamCount()Gets the number of parameters the function is defined with. If this is native, this includes the self param.- Returns:
- The number of parameters defined with
-
getInvokingParamCount
int getInvokingParamCount()The number of parameters the function accepts when it is being invoked. This is the size ofgetParams().- Returns:
- The number of parameters that are accepted upon invocation
-
isNative
boolean isNative()Checks if the function is defined natively.- Returns:
- If this is a native function
-
isStatic
boolean isStatic()Checks if the function is static that does not need to be invoked on an instance of something.- Returns:
- If this is a static function
-
getOnType
QilletniTypeClass<?> getOnType()If this is an extension function, this returns the type that it is on.- Returns:
- The type this function is on, or null if none
-
isExternallyDefined
boolean isExternallyDefined()If the function was defined outside of an entity. Used withgetOnType(), this can tell if the function has the first instance parameter or not.- Returns:
- If the function is defined outside of an entity
-
getBody
<T> T getBody()Gets the internal representation of the function's body that may be executed. This should only be used internally.- Type Parameters:
T- The type of the body- Returns:
- The internal representation of the function
-