@(genType: GeneratedType, properties: Set[GeneratedProperty], importedNames: Map[String, String],
ImportedNamesWithProperties: Map[GeneratedProperty, String], augmentField: GeneratedProperty, copyConstructorHelper: String,
-getterMethods: List[String])
+getterMethods: List[String], parentTypeForBuilderName: String)
@if(genType != null) {
@{wrapToDocumentation(formatDataForJavaDocBuilder(importedNames.get("genType")))}
public class @{genType.getName}Builder implements @{getSimpleNameForBuilder} <@{importedNames.get("genType")}> {
}
private static final class @{genType.getName}Impl implements @{genType.getName} {
-
+ @if(parentTypeForBuilderName != null) {
@implementedInterfaceGetter()
-
+ }
@generateFields(true)
@generateAugmentField(true)
@generateEquals()
@generateToString()
+
+ @generateImplementedMethods()
}
}
}
}
@implementedInterfaceGetter() = {
- public @{importedNames.get("class")}<@{importedNames.get("genType")}> getImplementedInterface() {
+ @@Override
+ public @{importedNames.get("class")}<@{importedNames.get("genType")}> implementedInterface() {
return @{importedNames.get("genType")}.class;
}
}
}
}
+@generateImplType() = {
+@defining(genType.getName + "Impl") {typeImpl => @typeImpl}
+}
+
+@generateBuilderType() = {
+@defining(genType.getName + "Builder") {typeBuilder => @typeBuilder}
+}
+
+@generateInnerBuilderType() = {
+@defining("(" + genType.getName + "Builder base)") {typeInnerBuilder => @typeInnerBuilder}
+}
+
+@generateInnerType() = {
+@defining("(" + genType.getName + " base)") {innerType => @innerType}
+}
+
@generateCopyConstructor(impl: Boolean) = {
@if(impl) {private} else {public}
- @{genType.getName}
- @if(impl) {Impl} else {Builder}
- (@{genType.getName}
- @if(impl) {Builder} base) {
+ @if(impl) {@generateImplType()} else {@generateBuilderType()}
+ @if(impl) {@generateInnerBuilderType()} else {@generateInnerType()}
+ {
@{copyConstructorHelper}
@if(augmentField != null) {
@if(impl) {
@if(augmentField != null) {
@@SuppressWarnings("unchecked")
@if(addOverride) {@@Override}
- public <E extends @{importedNames.get("augmentFieldReturnType")}> E get@{toFirstUpper(augmentField.getName)}
+ public <E extends @{importedNames.get("augmentation")}<? super @{genType.getName}>> E get@{toFirstUpper(augmentField.getName)}
(@{importedNames.get("class")}<E> augmentationType) {
if (augmentationType == null) {
throw new IllegalArgumentException("Augmentation Type reference cannot be NULL!");
}
}
+@generateImplementedMethods() = {
+ @if(parentTypeForBuilderName != null) {
+ @@Override
+ public @{importedNames.get("item")}<@{parentTypeForBuilderName}> treeIdentifier() {
+ //TODO implement
+ return null;
+ }
+ }
+ @@Override
+ public @{importedNames.get("classInstMap")}<@{importedNames.get("augmentation")}<? super @{genType.getName}>>
+ augments() {
+ //TODO implement
+ return null;
+ }
+}
+
@generateEquals() = {
@if(!properties.isEmpty || augmentField != null) {
@@Override
if (!(obj instanceof @{importedNames.get("treeNode")})) {
return false;
}
- if (!@{importedNames.get("genType")}.class.equals(((@{importedNames.get("treeNode")})obj).getImplementedInterface)) {
+ @if(parentTypeForBuilderName != null) {
+ if (!(obj instanceof @{importedNames.get("instantiable")})) {
return false;
}
+ if (!@{importedNames.get("genType")}.class.equals(((@{importedNames.get("instantiable")})obj)
+ .implementedInterface())) {
+ return false;
+ }
+ }
@{importedNames.get("genType")} other = (@{importedNames.get("genType")})obj;
@for(property <- properties) {
@if(property.getReturnType.getName.contains("[")) {