Exemplo n.º 1
0
        // Writes the state exit handler
        internal void WriteTemplateExitHandler(StringWriter output, EventHandlerBodyDelegate writeBody)
        {
            string exitHandlerName = Context.Names.GetExitHandlerName();
            string throwsClause    = GetThrowsClause();

            Context.WriteLine(output, "@Override");
            Context.WriteLine(output, $"public void {exitHandlerName}() {throwsClause} {{");
            writeBody(output);
            Context.WriteLine(output, "}");
        }
Exemplo n.º 2
0
        // Writes the state event handler
        internal void WriteTemplateEventHandler(StringWriter output, PEvent pEvent, EventHandlerBodyDelegate writeBody)
        {
            string throwsClause = GetThrowsClause();
            string handlerName  = Context.Names.GetStateEventHandlerName(pEvent);

            WriteEventHandlerSignature(output, pEvent);
            Context.WriteLine(output, $" {{");
            writeBody(output);
            Context.WriteLine(output, "}");
        }
Exemplo n.º 3
0
        // Writes the state entry handler
        internal void WriteTemplateEntryHandler(StringWriter output, EventHandlerBodyDelegate writeBody)
        {
            string entryHandlerName = Context.Names.GetEntryHandlerName();
            string payloadType      = Context.Names.GetDefaultPayloadTypeName();
            string maybePayloadName = Context.Names.GetMaybePayloadArgumentName();
            string throwsClause     = GetThrowsClause();

            Context.WriteLine(output, "@Override");
            Context.WriteLine(output, $"public void {entryHandlerName}(Optional<{payloadType}> {maybePayloadName}) {throwsClause} {{");
            writeBody(output);
            Context.WriteLine(output, "}");
        }