-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
39 suport for array data types #52
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please run the code style file
case BIG_DECIMAL_ARRAY: | ||
case ZONED_DATE_TIME_ARRAY: | ||
case DATE_ARRAY: | ||
if (i == size) { //ultimo elemento |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove comments in Spanish or add in English
@@ -1,9 +1,3 @@ | |||
/* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why remove the license ?
import com.sngular.annotation.processor.mapping.StringMapping; | ||
import com.sngular.annotation.processor.mapping.TypeMapping; | ||
import com.sngular.annotation.processor.mapping.ZonedDateTimeMapping; | ||
import com.sngular.annotation.processor.mapping.*; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is better to have individual imports that a "wild" ( * )
I believe you did not import the style code file
*/ | ||
public enum TypeArray { | ||
|
||
/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to have a comment for each type :)
|
||
@Override | ||
public final String getRandomDefaultValue(final FieldValidations fieldValidations, final UniformRandomProvider uniformRandomProvider) { | ||
return "12345678901234567890123456789012345678901234567890123456789012345678901234567890.901234567890123456789012345678901234567890"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generate with a random is better
|
||
@Override | ||
public final String getRandomDefaultValue(final FieldValidations fieldValidations, final UniformRandomProvider uniformRandomProvider) { | ||
return "12345678901234567890123456789012345678901234567890123456789012345678901234567890"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generate with a random is better
import com.sngular.annotation.processor.model.FieldValidations; | ||
import org.apache.commons.rng.UniformRandomProvider; | ||
|
||
public class BigDecimalArrayMapping implements TypeMapping<String> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why TypeMapping should not be TypeMapping or TypeMapping?
* @author Miguel Angel Escobar | ||
* @version 1.0 | ||
*/ | ||
public class BooleanArrayWrapMapping implements TypeMapping<String> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the need for these class ?
@@ -1,7 +1,68 @@ | |||
<#assign constructor = false> | |||
<#macro writeAttrField field> | |||
<#if field.functionByType??> | |||
<#if field.fieldType == "boolean"> | |||
<#if field.fieldType == "String[]" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe is better to create a fieldType Array and then with a subFieldType that is the type of array?
And if fieldType == Array then send it to a new method to build to keep "low logic" in the method.
@@ -329,5 +405,121 @@ public class ${schema.className}Builder { | |||
} | |||
</#if> | |||
|
|||
} | |||
public static long[] getLongArray(String[] numbers) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These code will be insert everytime in the files whe is not necessary.
Besides is public and I believe is not necessayry
Tests arrays completed:
String[]
boolean[], Boolean[]
byte[], Byte[]
short[], Short[]
int[], Integer[]
char[], Character[]
long[], Long[]
float[], Float[]
double[], Double[]
BigInteger[]
BigDecimal[]
ZonedDateTime[]
Date[]