Zadbaj o dobrą organizację dzięki kolekcji
Zapisuj i kategoryzuj treści zgodnie ze swoimi preferencjami.
blockly > CodeGenerator > zakończ
Metoda CodeGenerator.finish()
Zaczep, aby kod uruchomił się na końcu generowania kodu. Podklasy mogą to zastąpić, np. aby dołączyć wygenerowany kod do instrukcji importu lub definicji zmiennych.
Podpis:
finish(code: string): string;
Parametry
Parametr |
Typ |
Opis |
kod |
ciąg znaków |
Wygenerowano kod. |
Zwroty:
ciąg znaków
Utworzony kod.
O ile nie stwierdzono inaczej, treść tej strony jest objęta licencją Creative Commons – uznanie autorstwa 4.0, a fragmenty kodu są dostępne na licencji Apache 2.0. Szczegółowe informacje na ten temat zawierają zasady dotyczące witryny Google Developers. Java jest zastrzeżonym znakiem towarowym firmy Oracle i jej podmiotów stowarzyszonych.
Ostatnia aktualizacja: 2024-08-21 UTC.
[[["Łatwo zrozumieć","easyToUnderstand","thumb-up"],["Rozwiązało to mój problem","solvedMyProblem","thumb-up"],["Inne","otherUp","thumb-up"]],[["Brak potrzebnych mi informacji","missingTheInformationINeed","thumb-down"],["Zbyt skomplikowane / zbyt wiele czynności do wykonania","tooComplicatedTooManySteps","thumb-down"],["Nieaktualne treści","outOfDate","thumb-down"],["Problem z tłumaczeniem","translationIssue","thumb-down"],["Problem z przykładami/kodem","samplesCodeIssue","thumb-down"],["Inne","otherDown","thumb-down"]],["Ostatnia aktualizacja: 2024-08-21 UTC."],[[["The `CodeGenerator.finish()` method is a hook for executing code after the main code generation process."],["It allows subclasses to modify the final generated code, such as adding import statements or variable definitions."],["The method accepts the generated code as input and returns the modified code."]]],["The `finish()` method in the `CodeGenerator` class allows for post-processing of generated code. It takes a string of generated code as input and returns a string of completed code. Subclasses can override this method to add operations such as prepending import statements or variable definitions to the generated code. The method's core function is to modify and finalize the code generated by the system.\n"]]