All Downloads are FREE. Search and download functionalities are using the official Maven repository.

templates.ServiceDefinitionFactory.hbs Maven / Gradle / Ivy

The newest version!
{{#if originalClassPkg}}package {{originalClassPkg}}{{/if}}

class {{generatedClassSimpleName}}: dev.restate.sdk.common.syscalls.ServiceDefinitionFactory<{{originalClassFqcn}}, dev.restate.sdk.kotlin.HandlerRunner.Options> {

    override fun create(bindableService: {{originalClassFqcn}}): dev.restate.sdk.common.syscalls.ServiceDefinition {
        return dev.restate.sdk.common.syscalls.ServiceDefinition.of(
            {{generatedClassSimpleNamePrefix}}Definitions.SERVICE_NAME,
            {{#if isObject}}dev.restate.sdk.common.ServiceType.VIRTUAL_OBJECT{{else if isWorkflow}}dev.restate.sdk.common.ServiceType.WORKFLOW{{else}}dev.restate.sdk.common.ServiceType.SERVICE{{/if}},
            listOf(
            {{#handlers}}
                dev.restate.sdk.common.syscalls.HandlerDefinition.of(
                dev.restate.sdk.common.syscalls.HandlerSpecification.of(
                "{{name}}",
                {{#if isExclusive}}dev.restate.sdk.common.HandlerType.EXCLUSIVE{{else if isWorkflow}}dev.restate.sdk.common.HandlerType.WORKFLOW{{else}}dev.restate.sdk.common.HandlerType.SHARED{{/if}},
                {{inputSerdeRef}},
                {{outputSerdeRef}}
                ){{#if inputAcceptContentType}}.withAcceptContentType("{{inputAcceptContentType}}"){{/if}},
                dev.restate.sdk.kotlin.HandlerRunner.of(bindableService::{{name}})
                ){{#unless @last}},{{/unless}}
            {{/handlers}}
            )
        )
    }

    override fun supports(serviceObject: Any?): Boolean {
        return serviceObject is {{originalClassFqcn}};
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy