<cffunction
name="GetJavaClassMethods"
access="public"
returntype="query"
output="false"
hint="This takes a ColdFusion object and returns a query of all the available Java methods including constructors.">
<cfargument name="CFObject" type="any" required="yes" />
<cfset var LOCAL = StructNew() />
<cfset LOCAL.MethodQuery = QueryNew(
"name, return_type, parameters, is_constructor"
) />
<cfset LOCAL.ClassConstructors = ARGUMENTS.CFObject.GetClass().GetConstructors() />
<cfset LOCAL.ClassMethods = ARGUMENTS.CFObject.GetClass().GetMethods() />
<cfset QueryAddRow(
LOCAL.MethodQuery,
(
ArrayLen( LOCAL.ClassConstructors ) +
ArrayLen( LOCAL.ClassMethods )
)) />
<cfloop
index="LOCAL.ConstructorIndex"
from="1"
to="#ArrayLen( LOCAL.ClassConstructors )#"
step="1">
<cfset LOCAL.MethodQuery[ "name" ][ LOCAL.ConstructorIndex ] = LOCAL.ClassConstructors[ LOCAL.ConstructorIndex ].GetName() />
<cfset LOCAL.MethodQuery[ "return_type" ][ LOCAL.ConstructorIndex ] = ARGUMENTS.CFObject.GetClass().GetName() />
<cfset LOCAL.MethodQuery[ "parameters" ][ LOCAL.ConstructorIndex ] = GetJavaClassMethodParameters( LOCAL.ClassConstructors[ LOCAL.ConstructorIndex ] ) />
<cfset LOCAL.MethodQuery[ "is_constructor" ][ LOCAL.ConstructorIndex ] = 1 />
</cfloop>
<cfset LOCAL.Offset = (LOCAL.ConstructorIndex - 1) />
<cfloop
index="LOCAL.MethodIndex"
from="1"
to="#ArrayLen( LOCAL.ClassMethods )#"
step="1">
<cfset LOCAL.MethodQuery[ "name" ][ LOCAL.Offset + LOCAL.MethodIndex ] = LOCAL.ClassMethods[ LOCAL.MethodIndex ].GetName() />
<cfset LOCAL.MethodQuery[ "return_type" ][ LOCAL.Offset + LOCAL.MethodIndex ] = LOCAL.ClassMethods[ LOCAL.MethodIndex ].GetReturnType().GetName() />
<cfset LOCAL.MethodQuery[ "parameters" ][ LOCAL.Offset + LOCAL.MethodIndex ] = GetJavaClassMethodParameters( LOCAL.ClassMethods[ LOCAL.MethodIndex ] ) />
<cfset LOCAL.MethodQuery[ "is_constructor" ][ LOCAL.Offset + LOCAL.MethodIndex ] = 0 />
</cfloop>
<cfquery name="LOCAL.SortedMethodQuery" dbtype="query">
SELECT
name,
return_type,
parameters,
is_constructor
FROM
[LOCAL].MethodQuery
ORDER BY
is_constructor DESC,
name ASC,
parameters ASC,
return_type ASC
</cfquery>
<cfreturn LOCAL.SortedMethodQuery />
</cffunction>