package ${javaPackage};

@javax.annotation.Generated("org.cryptomator.generator.CallbackProcessor")
class ${callbacksClassName} {

#foreach( $callback in ${callbacks} )
    public static org.cryptomator.generator.BoundCallback<${callback.declaringTypeName},${callback.resultTypeName}> ${callback.name}(
        #foreach( $paramType in ${callback.additionalParameterTypes} )
            ${paramType} param${foreach.count}#if( $foreach.hasNext ),#end
        #end
    ) {
        return new org.cryptomator.generator.BoundCallback<${callback.declaringTypeName},${callback.resultTypeName}>(
            ${callback.declaringTypeName}.class,
            ${callback.resultTypeName}.class
            #foreach( $paramType in ${callback.additionalParameterTypes} )
                ,param${foreach.count}
            #end
        ) {
        #if( !$callback.dispatchResultOkOnly )
			public boolean acceptsNonOkResults() {
				return true;
			}
        #end
            public void doCall(${callback.declaringTypeName} instance, Object[] parameters) {
                instance.${callback.name}(
                    (${callback.resultTypeName})parameters[0]
                    #foreach( $paramType in ${callback.additionalParameterTypes} )
                        ,(${paramType})parameters[${foreach.count}]
                    #end
                );
            }
        };
    }
#end

    private ${callbacksClassName}() {}

}
