Skip to content

Instantly share code, notes, and snippets.

@ntngel1
Created May 14, 2019 20:43
Show Gist options
  • Save ntngel1/f7f261f721b22577a0aaef5e49a88b4e to your computer and use it in GitHub Desktop.
Save ntngel1/f7f261f721b22577a0aaef5e49a88b4e to your computer and use it in GitHub Desktop.
val clas = KotlinClass(
name = "Kek",
modifiers = arrayListOf("open", "internal", "private"),
annotations = arrayListOf(
KotlinAnnotation(name = "WithoutArgs"),
KotlinAnnotation(name = "WithArgs", arguments = arrayListOf(
KotlinArgument(value = "someValue"), KotlinArgument(parameterName = "someName", value = "someValue")
))
),
classInheritance = KotlinClassInheritance(className = "SomeClass", arguments = arrayListOf(
KotlinArgument(parameterName = "Kek", value = "0.0F"),
KotlinArgument(value = "someValue"),
KotlinArgument(parameterName = "someName", value = "someValue")
)),
implementedInterfaces = arrayListOf(
KotlinInterfaceImplementation(interfaceName = "SomeInterface1"),
KotlinInterfaceImplementation(interfaceName = "SomeInterface2")
),
properties = arrayListOf(
KotlinProperty(
isMutable = false,
name = "firstProperty",
type = KotlinType(name = "String"),
modifiers = arrayListOf("override", "public"),
defaultValue = "\"SomeStringValue\"",
annotations = arrayListOf(
KotlinAnnotation(name = "WithoutArgs"),
KotlinAnnotation(name = "WithArgs", arguments = arrayListOf(
KotlinArgument(value = "someValue"), KotlinArgument(parameterName = "someName", value = "someValue")
))
)
)
),
methods = arrayListOf(
KotlinFunction(
name = "someFunction",
body = "//something"
)
),
staticMethods = arrayListOf(
KotlinFunction(
name = "someFunction",
returnType = KotlinType(name = "Float")
body = "return 0.0F",
)
)
)
val classDeclaration = ClassDeclaration(clas).generate()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment