-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improve code readability (after review comments)
- Loading branch information
Showing
13 changed files
with
77 additions
and
77 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
67 changes: 28 additions & 39 deletions
67
src/main/kotlin/com/virtuslab/pulumikotlin/codegen/step2intermediate/MoreTypes.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 |
---|---|---|
@@ -1,71 +1,60 @@ | ||
package com.virtuslab.pulumikotlin.codegen.step2intermediate | ||
|
||
import com.pulumi.core.Output | ||
import com.pulumi.kotlin.ConvertibleToJava | ||
import com.squareup.kotlinpoet.ClassName | ||
import com.pulumi.kotlin.CustomArgs | ||
import com.pulumi.kotlin.CustomArgsBuilder | ||
import com.pulumi.kotlin.PulumiTagMarker | ||
import com.squareup.kotlinpoet.MemberName | ||
import com.squareup.kotlinpoet.MemberName.Companion.member | ||
import com.squareup.kotlinpoet.ParameterizedTypeName | ||
import com.squareup.kotlinpoet.ParameterizedTypeName.Companion.parameterizedBy | ||
import com.squareup.kotlinpoet.TypeName | ||
import com.squareup.kotlinpoet.asClassName | ||
import com.squareup.kotlinpoet.asTypeName | ||
|
||
object MoreTypes { | ||
|
||
object Kotlin { | ||
object Pulumi { | ||
fun toJavaMethod(): MemberName { | ||
return MemberName("com.pulumi.kotlin", "toJava") | ||
} | ||
fun toJavaMethod() = | ||
MemberName("com.pulumi.kotlin", "toJava") | ||
|
||
fun pulumiDslMarkerAnnotation(): ClassName { | ||
return ClassName("com.pulumi.kotlin", "PulumiTagMarker") | ||
} | ||
fun pulumiDslMarkerAnnotation() = | ||
PulumiTagMarker::class.asClassName() | ||
|
||
fun toKotlinMethod(): MemberName { | ||
return MemberName("com.pulumi.kotlin", "toKotlin") | ||
} | ||
fun toKotlinMethod() = | ||
MemberName("com.pulumi.kotlin", "toKotlin") | ||
|
||
fun applySuspendExtensionMethod(): MemberName { | ||
return MemberName("com.pulumi.kotlin", "applySuspend") | ||
} | ||
fun applySuspendExtensionMethod() = | ||
MemberName("com.pulumi.kotlin", "applySuspend") | ||
|
||
fun applyValueExtensionMethod(): MemberName { | ||
return MemberName("com.pulumi.kotlin", "applyValue") | ||
} | ||
fun applyValueExtensionMethod() = | ||
MemberName("com.pulumi.kotlin", "applyValue") | ||
|
||
fun convertibleToJavaClass(type: TypeName): ParameterizedTypeName = | ||
ConvertibleToJava::class.asClassName().parameterizedBy(type) | ||
fun convertibleToJavaClass() = | ||
ConvertibleToJava::class.asClassName() | ||
|
||
fun customArgsClass(): ClassName { | ||
return ClassName("com.pulumi.kotlin", "CustomArgs") | ||
} | ||
fun customArgsClass() = | ||
CustomArgs::class.asClassName() | ||
|
||
fun customArgsBuilderClass(): ClassName { | ||
return ClassName("com.pulumi.kotlin", "CustomArgsBuilder") | ||
} | ||
fun customArgsBuilderClass() = | ||
CustomArgsBuilder::class.asClassName() | ||
} | ||
|
||
fun coroutinesFutureAwaitExtensionMethod(): MemberName { | ||
return MemberName("kotlinx.coroutines.future", "await") | ||
} | ||
fun coroutinesFutureAwaitExtensionMethod() = | ||
MemberName("kotlinx.coroutines.future", "await") | ||
|
||
fun pairClass(leftType: TypeName, rightType: TypeName): ParameterizedTypeName { | ||
return ClassName("kotlin", "Pair").parameterizedBy(leftType, rightType) | ||
} | ||
fun pairClass(leftType: TypeName, rightType: TypeName) = | ||
Pair::class.asTypeName().parameterizedBy(leftType, rightType) | ||
} | ||
|
||
object Java { | ||
object Pulumi { | ||
fun outputOfMethod(): MemberName = | ||
fun outputOfMethod() = | ||
outputClass().member("of") | ||
|
||
fun outputClass(): ClassName { | ||
return ClassName("com.pulumi.core", "Output") | ||
} | ||
|
||
fun outputClass(type: TypeName): ParameterizedTypeName { | ||
return ClassName("com.pulumi.core", "Output").parameterizedBy(type) | ||
} | ||
fun outputClass() = | ||
Output::class.asClassName() | ||
} | ||
} | ||
} |
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
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