diff --git a/legend-engine-xts-java/legend-engine-xt-javaGeneration-featureBased-pure/src/main/resources/core_external_language_java_feature_based_generation/generation.pure b/legend-engine-xts-java/legend-engine-xt-javaGeneration-featureBased-pure/src/main/resources/core_external_language_java_feature_based_generation/generation.pure index 18a463fb1e6..f1267cb6101 100644 --- a/legend-engine-xts-java/legend-engine-xt-javaGeneration-featureBased-pure/src/main/resources/core_external_language_java_feature_based_generation/generation.pure +++ b/legend-engine-xts-java/legend-engine-xt-javaGeneration-featureBased-pure/src/main/resources/core_external_language_java_feature_based_generation/generation.pure @@ -193,6 +193,16 @@ function meta::external::language::java::generation::featureBased::definition:: ); } +function meta::external::language::java::generation::featureBased::definition::gettersOnly():Feature[1] +{ + ^Feature( + key='gettersOnly', + name = 'gettersOnly', + applyFunction = applyOnlyGetters_AnnotatedElement_1__Class_1__JavaCodeGenerationContext_1__Class_1_, + dependsOn = ['privateFields'] + ); +} + function meta::external::language::java::generation::featureBased::definition::equalsHashMethods():Feature[1] { ^Feature( @@ -213,6 +223,37 @@ function meta::external::language::java::generation::featureBased::definition:: ); } +function meta::external::language::java::generation::featureBased::definition::allPropertyConstructor():Feature[1] +{ + ^Feature( + key='allPropertyConstructor', + name = 'allPropertyConstructor', + applyFunction = applyAllPropertyConstructor_AnnotatedElement_1__Class_1__JavaCodeGenerationContext_1__Class_1_ + ); +} + +function meta::external::language::java::generation::featureBased::definition::constructorInjectedEqualsHashMethods():Feature[1] +{ + ^Feature( + key='equalshashcode', + name = 'equalshashcode', + applyFunction = applyEqualsHashCode_AnnotatedElement_1__Class_1__JavaCodeGenerationContext_1__Class_1_, + dependsOn = ['privateFields','gettersOnly'] + ); +} + +function meta::external::language::java::generation::featureBased::definition::constructorInjectedToStringMethod():Feature[1] +{ + ^Feature( + key='toString', + name = 'toString', + applyFunction = applyToStringMethod_AnnotatedElement_1__Class_1__JavaCodeGenerationContext_1__Class_1_, + dependsOn = ['privateFields','gettersOnly'] + ); +} + + + function meta::external::language::java::generation::featureBased::pojo::pojoGenerationFeatures():Feature[*] { [ @@ -225,6 +266,18 @@ function meta::external::language::java::generation::featureBased::pojo::pojoGe } +function meta::external::language::java::generation::featureBased::pojo::constructorInjectedPojoGenerationFeatures():Feature[*] +{ + [ + meta::external::language::java::generation::featureBased::definition::privateFields(), + meta::external::language::java::generation::featureBased::definition::allPropertyConstructor(), + meta::external::language::java::generation::featureBased::definition::gettersOnly(), + meta::external::language::java::generation::featureBased::definition::constructorInjectedEqualsHashMethods(), + meta::external::language::java::generation::featureBased::definition::constructorInjectedToStringMethod() + ]; +} + + function <> meta::external::language::java::generation::featureBased::generateEnumeration(enum:meta::pure::metamodel::type::Enumeration[1],context:JavaCodeGenerationContext[1]):meta::external::language::java::metamodel::Class[1] { @@ -577,6 +630,76 @@ function meta::external::language::java::generation::featureBased::pojo::applyDe ,|$javaElement); } +function meta::external::language::java::generation::featureBased::pojo::applyAllPropertyConstructor(element:meta::pure::metamodel::extension::AnnotatedElement[1],javaClass:meta::external::language::java::metamodel::Class[1],context:JavaCodeGenerationContext[1]):meta::external::language::java::metamodel::Class[1] +{ + if($element->instanceOf(meta::pure::metamodel::type::Class) + ,| + let pureClass = $element->cast(@meta::pure::metamodel::type::Class); + let properties = $pureClass->findPropertiesEligibleForJavaGeneration(); + + let selfParamsForConstructor = $properties->map(property| + let fieldType = $context.conventions->pureTypeToJavaType($property); + let fieldName = $context.conventions->sanitizeFieldName($property); + j_parameter($fieldType, $fieldName); + ); + + let bodyForConstructor = $properties->map(property| + let fieldType = $context.conventions->pureTypeToJavaType($property); + let fieldName = $context.conventions->sanitizeFieldName($property); + let field = $javaClass.fields->filter(f | $f.name == $fieldName)->toOne(); + + let jfield = j_this($javaClass)->j_field($field); + let param = j_parameter($fieldType, $field.name); + $jfield->j_assign($param); + ); + + let superParamsForConstructor = $pureClass->getAllSuperTypePropertiesAsParams($context); + + let superConstructorCallBody = if($superParamsForConstructor->size() > 0 + ,| + let superPureType = $pureClass->getSuperPureType(); + j_superInvoke($context.conventions->className($superPureType), $superParamsForConstructor); + ,|[]); + +// super params go to the end + let paramsForConstructor = $selfParamsForConstructor->concatenate( $superParamsForConstructor); + $javaClass->annotate(^meta::external::language::java::metamodel::annotations::json::JsonIgnoreProperties(ignoreUnknown=true)) + ->addConstructor(javaConstructor(['public'], $paramsForConstructor, + if($superParamsForConstructor->size() > 0 + ,|$superConstructorCallBody ->concatenate($bodyForConstructor) + ,|$bodyForConstructor))); + ,|$javaClass); +} + +function meta::external::language::java::generation::featureBased::pojo::getSuperPureType(pureClass:meta::pure::metamodel::type::Class[1]): + meta::pure::metamodel::type::Class[1] +{ + let superPureType = $pureClass->getGeneralizations()->toOne(format('Class %s extends multiple classes, and not supported on java generation', + [$pureClass.name->toOne()])); + let superPureClass = $superPureType->cast(@meta::pure::metamodel::type::Class); + $superPureClass; +} + +function <> meta::external::language::java::generation::featureBased::pojo::getAllSuperTypePropertiesAsParams(pureClass:meta::pure::metamodel::type::Class[1],context:JavaCodeGenerationContext[1]): meta::external::language::java::metamodel::Code[*] +{ + let generalizations = $pureClass->getGeneralizations(); + let hasSuperClass = ! $generalizations->isEmpty(); + if( $hasSuperClass + ,| + let superPureClass = $pureClass->getSuperPureType(); + let properties = $superPureClass->findPropertiesEligibleForJavaGeneration(); + + let propertiesForConstructor = $properties->map(property| + let fieldType = $context.conventions->pureTypeToJavaType($property); + let fieldName = $context.conventions->sanitizeFieldName($property); + j_parameter($fieldType, $fieldName); + ); + let superTypeParamsForConstructor = $superPureClass->getAllSuperTypePropertiesAsParams($context); + $propertiesForConstructor -> concatenate ( $superTypeParamsForConstructor); + ,|[]); + +} + function meta::external::language::java::generation::featureBased::versions::getPropertyTypes(class: meta::pure::metamodel::type::Class[1]):meta::pure::metamodel::type::Type[*] { meta::external::language::java::generation::featureBased::versions::getPropertyTypes($class, []); @@ -869,3 +992,49 @@ function <> {doc.doc = 'Get ASCII decimal representation'} 0 )))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) // lol, sue me } +function meta::external::language::java::generation::featureBased::applyOnlyGetters(element:meta::pure::metamodel::extension::AnnotatedElement[1],javaClass:meta::external::language::java::metamodel::Class[1],context:JavaCodeGenerationContext[1]):meta::external::language::java::metamodel::Class[1] +{ + if ($element->instanceOf(meta::pure::metamodel::type::Class) + ,| let pureClass = $element->cast(@meta::pure::metamodel::type::Class); + $pureClass->findPropertiesEligibleForJavaGeneration()->fold({property, temporaryClass | + + let getter = $temporaryClass->generateOnlyGetters($property,$context.conventions); + $temporaryClass->addMethods($getter); + + }, $javaClass); + + ,| $javaClass + ); +} + +function {doc.doc = 'Creates getter and setter methods for a given field . Sanitizes its name'} +meta::external::language::java::generation::featureBased::generateOnlyGetters(javaClass: meta::external::language::java::metamodel::Class[1],property: AbstractProperty[1], conventions: Conventions[1]) : meta::external::language::java::metamodel::Method[1] +{ + let fieldType = $conventions->pureTypeToJavaType($property); + + let fieldName = $conventions->sanitizeFieldName($property); + + let field = $javaClass.fields->filter(f | $f.name == $fieldName)->toOne(); + + let jfield = j_this($javaClass)->j_field($field); + +// global code gen at this point does not support correct boolean getter naming +// and the strategy does not take in the type as input. So if we use this way it breaks the equals and to string generation +// hence commented +// TODO this should eventually go into the core code gen +/* + let getterName = if( $fieldType->isPrimitive() + && $fieldType->cast(@meta::external::language::java::metamodel::PrimitiveType).simpleName == 'boolean' + ,| + if($field.name->startsWith('is') + ,| $field.name + ,| 'is' + $field.name->toUpperFirstCharacter()->toOne() + ) + ,| $conventions->getterName($field.name) + ); +*/ + let getterName = $conventions->getterName($field.name); + let getter = javaMethod(['public'], $fieldType, $getterName, [],j_return($jfield)); + + [$getter]; +} diff --git a/legend-engine-xts-java/legend-engine-xt-javaGeneration-featureBased-pure/src/main/resources/core_external_language_java_feature_based_generation/generationTest.pure b/legend-engine-xts-java/legend-engine-xt-javaGeneration-featureBased-pure/src/main/resources/core_external_language_java_feature_based_generation/generationTest.pure index f7075a442f3..7855f9c78ff 100644 --- a/legend-engine-xts-java/legend-engine-xt-javaGeneration-featureBased-pure/src/main/resources/core_external_language_java_feature_based_generation/generationTest.pure +++ b/legend-engine-xts-java/legend-engine-xt-javaGeneration-featureBased-pure/src/main/resources/core_external_language_java_feature_based_generation/generationTest.pure @@ -8,6 +8,29 @@ import meta::external::language::java::metamodel::project::*; import meta::external::language::java::generation::featureBased::pojo::*; import meta::external::language::java::generation::featureBased::definition::*; +Enum meta::external::language::java::generation::featureBased::tests::constructorInjection::ASimpleChoice { + A, B +} + +Class meta::external::language::java::generation::featureBased::tests::constructorInjection::Person +{ + firstName : String[1]; + lastName : String[1]; + addresses : String[*]; + firm : meta::external::language::java::generation::featureBased::tests::constructorInjection::Firm[0..1]; + drives: Boolean[1]; + choice: meta::external::language::java::generation::featureBased::tests::constructorInjection::ASimpleChoice[1]; + preferredName: String[0..1]; +} + +Class meta::external::language::java::generation::featureBased::tests::constructorInjection::Firm +{ + legalName : String[1]; + employees : meta::external::language::java::generation::featureBased::tests::constructorInjection::Person[*]; + addresses : String[*]; + count : Integer[1]; +} + Enum meta::external::language::java::generation::featureBased::tests::model::ASimpleChoice { A, B } @@ -92,7 +115,7 @@ function meta::external::language::java::generation::featureBased::tests::utils: { let expected = $expectedCode->split(); let actual = $actualCode->split(); - assertEquals($expected->size(),$actual->size(),'lines number dont match'); + assertEquals($expected->size(),$actual->size(),'lines number dont match %d, %d', [$expected->size(),$actual->size()]); let size = $actual->size(); range($actual->size())->map( i | assertEquals($expected->at($i),$actual->at($i),'found line differences at line %s:\nexpected: [%s] \nactual :[%s]:',[$i,$expected->at($i),$actual->at($i)])); @@ -183,4 +206,15 @@ function <> meta::external::language::java::generation::featureBased: let source = $sources->at(0); compareJavaCode($source.fileName,expectedSourceForAddressExtension(),$source.content); true; -} \ No newline at end of file +} + +function <> meta::external::language::java::generation::featureBased::tests::testJavaGenerationConstructorInjection():Boolean[1] +{ + let package = 'meta::external::language::java::generation::featureBased::tests::constructorInjection'; + let testGenerationContext = testJavaCodeGenerationContext($package,[],constructorInjectedPojoGenerationFeatures(),noDebug()); + let sources = $testGenerationContext->generateJava(); + assertEquals(3, $sources->size()); + let expectedSources = expectedSources(); + $sources->map( source | $expectedSources->compareJavaCode($source.fileName,$source.content)); + true; +} diff --git a/legend-engine-xts-java/legend-engine-xt-javaGeneration-featureBased-pure/src/main/resources/core_external_language_java_feature_based_generation/resources/expectedSources.pure b/legend-engine-xts-java/legend-engine-xt-javaGeneration-featureBased-pure/src/main/resources/core_external_language_java_feature_based_generation/resources/expectedSources.pure index b0882954375..6a0e81e02e5 100644 --- a/legend-engine-xts-java/legend-engine-xt-javaGeneration-featureBased-pure/src/main/resources/core_external_language_java_feature_based_generation/resources/expectedSources.pure +++ b/legend-engine-xts-java/legend-engine-xt-javaGeneration-featureBased-pure/src/main/resources/core_external_language_java_feature_based_generation/resources/expectedSources.pure @@ -8,7 +8,10 @@ function <> meta::external::language::java::generation::featureB pair('src/main/java/meta/external/language/java/generation/featureBased/tests/model/Address.java',expectedSourceForAddress()), pair('src/main/java/meta/external/language/java/generation/featureBased/tests/model/AddressExtension.java',expectedSourceForAddressExtension()), pair('src/main/java/meta/external/language/java/generation/featureBased/tests/model/Firm.java',expectedSourceForFirm()), - pair('src/main/java/meta/external/language/java/generation/featureBased/tests/model/ASimpleChoice.java',expectedSourceForSimpleChoice()) + pair('src/main/java/meta/external/language/java/generation/featureBased/tests/model/ASimpleChoice.java',expectedSourceForSimpleChoice()), + pair('src/main/java/meta/external/language/java/generation/featureBased/tests/constructorInjection/ASimpleChoice.java',expectedSourceForSimpleChoiceWithConstructorInjection()), + pair('src/main/java/meta/external/language/java/generation/featureBased/tests/constructorInjection/Person.java',expectedSourceForPersonWithConstructorInjection()), + pair('src/main/java/meta/external/language/java/generation/featureBased/tests/constructorInjection/Firm.java',expectedSourceForFirmWithConstructorInjection()) ]); } @@ -1024,4 +1027,281 @@ function <> meta::external::language::java::generation::featureB function <> meta::external::language::java::generation::featureBased::tests::optionals::expectedSourceForOptionalsSampleWithPrimitives():String[1] { ''; -} \ No newline at end of file +} + +function <> meta::external::language::java::generation::featureBased::tests::expectedSourceForPersonWithConstructorInjection():String[1] +{ + 'package meta.external.language.java.generation.featureBased.tests.constructorInjection;\n'+ + '\n'+ + 'import com.fasterxml.jackson.annotation.JsonIgnoreProperties;\n' + + 'import java.util.List;\n'+ + 'import javax.annotation.Generated;\n'+ + '\n'+ + '@Generated("meta::external::language::java::generation::featureBased::tests::constructorInjection::Person")\n'+ + '@JsonIgnoreProperties(ignoreUnknown=true)\n' + + 'public class Person\n'+ + '{\n'+ + ' private String firstName;\n'+ + ' private String lastName;\n'+ + ' private List addresses;\n'+ + ' private Firm firm;\n'+ + ' private boolean drives;\n'+ + ' private ASimpleChoice choice;\n'+ + ' private String preferredName;\n'+ + '\n'+ + ' public Person(String firstName,\n' + + ' String lastName,\n' + + ' List addresses,\n' + + ' Firm firm,\n' + + ' boolean drives,\n' + + ' ASimpleChoice choice,\n' + + ' String preferredName)\n'+ + ' {\n'+ + ' this.firstName = firstName;\n' + + ' this.lastName = lastName;\n' + + ' this.addresses = addresses;\n' + + ' this.firm = firm;\n' + + ' this.drives = drives;\n' + + ' this.choice = choice;\n' + + ' this.preferredName = preferredName;\n' + + ' }\n'+ + '\n'+ + ' public String getFirstName()\n'+ + ' {\n'+ + ' return this.firstName;\n'+ + ' }\n'+ + '\n'+ + ' public String getLastName()\n'+ + ' {\n'+ + ' return this.lastName;\n'+ + ' }\n'+ + '\n'+ + ' public List getAddresses()\n'+ + ' {\n'+ + ' return this.addresses;\n'+ + ' }\n'+ + '\n'+ + ' public Firm getFirm()\n'+ + ' {\n'+ + ' return this.firm;\n'+ + ' }\n'+ + '\n'+ + ' public boolean getDrives()\n'+ + ' {\n'+ + ' return this.drives;\n'+ + ' }\n'+ + '\n'+ + ' public ASimpleChoice getChoice()\n'+ + ' {\n'+ + ' return this.choice;\n'+ + ' }\n'+ + '\n'+ + ' public String getPreferredName()\n'+ + ' {\n'+ + ' return this.preferredName;\n'+ + ' }\n'+ + '\n'+ + ' @Override\n'+ + ' public boolean equals(Object o)\n'+ + ' {\n'+ + ' if (this == o)\n'+ + ' {\n'+ + ' return true;\n'+ + ' }\n'+ + ' if (o == null || this.getClass() != o.getClass())\n'+ + ' {\n'+ + ' return false;\n'+ + ' }\n'+ + ' Person that = (Person) o;\n'+ + ' if (this.getFirstName() != null\n'+ + ' ? !this.getFirstName().equals(that.getFirstName())\n'+ + ' : that.getFirstName() != null)\n'+ + ' {\n'+ + ' return false;\n'+ + ' }\n'+ + ' if (this.getLastName() != null\n'+ + ' ? !this.getLastName().equals(that.getLastName())\n'+ + ' : that.getLastName() != null)\n'+ + ' {\n'+ + ' return false;\n'+ + ' }\n'+ + ' if (this.getAddresses() != null\n'+ + ' ? !this.getAddresses().equals(that.getAddresses())\n'+ + ' : that.getAddresses() != null)\n'+ + ' {\n'+ + ' return false;\n'+ + ' }\n'+ + ' if (this.getFirm() != null\n'+ + ' ? !this.getFirm().equals(that.getFirm())\n'+ + ' : that.getFirm() != null)\n'+ + ' {\n'+ + ' return false;\n'+ + ' }\n'+ + ' if (this.getDrives() != that.getDrives())\n'+ + ' {\n'+ + ' return false;\n'+ + ' }\n'+ + ' if (this.getChoice() != null\n'+ + ' ? !this.getChoice().equals(that.getChoice())\n'+ + ' : that.getChoice() != null)\n'+ + ' {\n'+ + ' return false;\n'+ + ' }\n'+ + ' if (this.getPreferredName() != null\n'+ + ' ? !this.getPreferredName().equals(that.getPreferredName())\n'+ + ' : that.getPreferredName() != null)\n'+ + ' {\n'+ + ' return false;\n'+ + ' }\n'+ + ' return true;\n'+ + ' }\n'+ + '\n'+ + ' @Override\n'+ + ' public int hashCode()\n'+ + ' {\n'+ + ' int result = this.getFirstName() != null ? this.getFirstName().hashCode() : 0;\n'+ + ' result = 31 * result + (this.getLastName() != null ? this.getLastName().hashCode() : 0);\n'+ + ' result = 31 * result + (this.getAddresses() != null ? this.getAddresses().hashCode() : 0);\n'+ + ' result = 31 * result + (this.getFirm() != null ? this.getFirm().hashCode() : 0);\n'+ + ' result = 31 * result + (this.getDrives() ? 1 : 0);\n'+ + ' result = 31 * result + (this.getChoice() != null ? this.getChoice().hashCode() : 0);\n'+ + ' result = 31 * result + (this.getPreferredName() != null\n'+ + ' ? this.getPreferredName().hashCode()\n'+ + ' : 0);\n'+ + ' return result;\n'+ + ' }\n'+ + '\n'+ + ' @Override\n'+ + ' public String toString()\n'+ + ' {\n'+ + ' return "Person" + "{" + "firstName=" + this.getFirstName() + ", " + "lastName=" + this\n'+ + ' .getLastName() + ", " + "addresses=" + this\n'+ + ' .getAddresses() + ", " + "firm=" + this\n'+ + ' .getFirm() + ", " + "drives=" + this\n'+ + ' .getDrives() + ", " + "choice=" + this\n'+ + ' .getChoice() + ", " + "preferredName=" + this\n'+ + ' .getPreferredName() + "}";\n'+ + ' }\n'+ + '}'; + +} + + +function <> meta::external::language::java::generation::featureBased::tests::expectedSourceForFirmWithConstructorInjection():String[1] +{ + 'package meta.external.language.java.generation.featureBased.tests.constructorInjection;\n'+ + '\n'+ + 'import com.fasterxml.jackson.annotation.JsonIgnoreProperties;\n' + + 'import java.util.List;\n'+ + 'import javax.annotation.Generated;\n'+ + '\n'+ + '@Generated("meta::external::language::java::generation::featureBased::tests::constructorInjection::Firm")\n'+ + '@JsonIgnoreProperties(ignoreUnknown=true)\n' + + 'public class Firm\n'+ + '{\n'+ + ' private String legalName;\n'+ + ' private List employees;\n'+ + ' private List addresses;\n'+ + ' private int count;\n'+ + '\n'+ + ' public Firm(String legalName, List employees, List addresses, int count)\n'+ + ' {\n'+ + ' this.legalName = legalName;\n' + + ' this.employees = employees;\n' + + ' this.addresses = addresses;\n' + + ' this.count = count;\n' + + ' }\n'+ + '\n'+ + ' public String getLegalName()\n'+ + ' {\n'+ + ' return this.legalName;\n'+ + ' }\n'+ + '\n'+ + ' public List getEmployees()\n'+ + ' {\n'+ + ' return this.employees;\n'+ + ' }\n'+ + '\n'+ + ' public List getAddresses()\n'+ + ' {\n'+ + ' return this.addresses;\n'+ + ' }\n'+ + '\n'+ + ' public int getCount()\n'+ + ' {\n'+ + ' return this.count;\n'+ + ' }\n'+ + '\n'+ + ' @Override\n'+ + ' public boolean equals(Object o)\n'+ + ' {\n'+ + ' if (this == o)\n'+ + ' {\n'+ + ' return true;\n'+ + ' }\n'+ + ' if (o == null || this.getClass() != o.getClass())\n'+ + ' {\n'+ + ' return false;\n'+ + ' }\n'+ + ' Firm that = (Firm) o;\n'+ + ' if (this.getLegalName() != null\n'+ + ' ? !this.getLegalName().equals(that.getLegalName())\n'+ + ' : that.getLegalName() != null)\n'+ + ' {\n'+ + ' return false;\n'+ + ' }\n'+ + ' if (this.getEmployees() != null\n'+ + ' ? !this.getEmployees().equals(that.getEmployees())\n'+ + ' : that.getEmployees() != null)\n'+ + ' {\n'+ + ' return false;\n'+ + ' }\n'+ + ' if (this.getAddresses() != null\n'+ + ' ? !this.getAddresses().equals(that.getAddresses())\n'+ + ' : that.getAddresses() != null)\n'+ + ' {\n'+ + ' return false;\n'+ + ' }\n'+ + ' if (this.getCount() != null\n'+ + ' ? !this.getCount().equals(that.getCount())\n'+ + ' : that.getCount() != null)\n'+ + ' {\n'+ + ' return false;\n'+ + ' }\n'+ + ' return true;\n'+ + ' }\n'+ + '\n'+ + ' @Override\n'+ + ' public int hashCode()\n'+ + ' {\n'+ + ' int result = this.getLegalName() != null ? this.getLegalName().hashCode() : 0;\n'+ + ' result = 31 * result + (this.getEmployees() != null ? this.getEmployees().hashCode() : 0);\n'+ + ' result = 31 * result + (this.getAddresses() != null ? this.getAddresses().hashCode() : 0);\n'+ + ' result = 31 * result + (this.getCount() != null ? this.getCount().hashCode() : 0);\n'+ + ' return result;\n'+ + ' }\n'+ + '\n'+ + ' @Override\n'+ + ' public String toString()\n'+ + ' {\n'+ + ' return "Firm" + "{" + "legalName=" + this.getLegalName() + ", " + "employees=" + this\n'+ + ' .getEmployees() + ", " + "addresses=" + this\n'+ + ' .getAddresses() + ", " + "count=" + this\n'+ + ' .getCount() + "}";\n'+ + ' }\n'+ + '}'; +} + +function <> meta::external::language::java::generation::featureBased::tests::expectedSourceForSimpleChoiceWithConstructorInjection():String[1] +{ + 'package meta.external.language.java.generation.featureBased.tests.constructorInjection;\n'+ + '\n'+ + 'import javax.annotation.Generated;\n'+ + '\n'+ + '@Generated("meta::external::language::java::generation::featureBased::tests::constructorInjection::ASimpleChoice")\n'+ + 'public enum ASimpleChoice\n'+ + '{\n'+ + ' A,\n'+ + ' B\n'+ + '}'; +}