Skip to content

Commit

Permalink
issue 26 - Correction bug for char (#32)
Browse files Browse the repository at this point in the history
* issue 26 - Correction bug for char

* issue 26 - Correction bug for char
  • Loading branch information
tfdsimoes authored Nov 16, 2023
1 parent 3fdd66f commit 2db801a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>com.sngular</groupId>
<artifactId>pact-annotation-processor</artifactId>
<version>1.0.3</version>
<version>1.0.4</version>

<name>PactDslBuilder - Annotation Processor</name>
<description>Pact DSL Builder annotation processor.</description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ public final String getFieldType() {

@Override
public final String getFunctionType() {
return "charType";
return "stringType";
}

@Override
public final String getFunctionOnlyValue() {
return "charValue";
return "stringValue";
}

@Override
Expand Down
10 changes: 8 additions & 2 deletions src/main/resources/templates/templateDslBuilder.ftlh
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@

<#macro writeAttrField field>
<#if field.functionByType??>
<#if field.defaultValue?is_number>
<#if field.fieldType == "char">
String ${field.name} = "${field.defaultValue}";
<#elseif field.defaultValue?is_number>
<#if field.functionByType == "decimalType">
${field.fieldType} ${field.name} = new BigDecimal("${field.defaultValue?c}");
<#else>
Expand Down Expand Up @@ -37,7 +39,11 @@

<#macro writeSetterField field builderName>
<#if field.functionByType??>
public ${builderName}Builder set${field.name?cap_first}(final ${field.fieldType?no_esc} ${field.name}) {
<#if field.fieldType == "char">
public ${builderName}Builder set${field.name?cap_first}(final String ${field.name}) {
<#else>
public ${builderName}Builder set${field.name?cap_first}(final ${field.fieldType?no_esc} ${field.name}) {
</#if>
<#elseif field.complexType??>
<#if field.complexType.name() == "COLLECTION">
public ${builderName}Builder set${field.name?cap_first}(final ${field.fieldType?no_esc} ${field.name}) {
Expand Down

0 comments on commit 2db801a

Please sign in to comment.