-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update writer call * Add helper class which holds the instances of each writer
- Loading branch information
1 parent
63a1d46
commit 70a72b6
Showing
13 changed files
with
58 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
src/main/kotlin/net/theevilreaper/dartpoet/code/WriterHelper.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package net.theevilreaper.dartpoet.code | ||
|
||
import net.theevilreaper.dartpoet.code.writer.* | ||
import org.jetbrains.annotations.ApiStatus.Internal | ||
import org.jetbrains.annotations.ApiStatus.NonExtendable | ||
|
||
/** | ||
* A helper class that holds references to writer implementations. | ||
* Maintaining a single instance of each writer improves runtime performance | ||
* by avoiding the overhead of creating new instances for each write operation. | ||
* | ||
* Since writer classes do not store any state, creating new instances is unnecessary. | ||
* | ||
* **Note**: Update this class only when adding or removing writer implementations. | ||
* | ||
* @since 1.0.0 | ||
* author theEvilReaper | ||
*/ | ||
@Internal | ||
@NonExtendable | ||
internal object WriterHelper { | ||
|
||
internal val annotationWriter by lazy { AnnotationWriter() } | ||
internal val classWriter by lazy { ClassWriter() } | ||
internal val constantPropertyWriter by lazy { ConstantPropertyWriter() } | ||
internal val constructorWriter by lazy { ConstructorWriter() } | ||
internal val fileWriter by lazy { DartFileWriter() } | ||
internal val enumPropertyWriter by lazy { EnumPropertyWriter() } | ||
internal val extensionWriter by lazy { ExtensionWriter() } | ||
internal val factoryWriter by lazy { FactoryWriter() } | ||
internal val functionWriter by lazy { FunctionWriter() } | ||
internal val parameterWriter by lazy { ParameterWriter() } | ||
internal val propertyWriter by lazy { PropertyWriter() } | ||
internal val typeDefWriter by lazy { TypeDefWriter() } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters