Skip to content
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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

MiguelSngularGithub
Copy link
Collaborator

Tests arrays completed:
String[]
boolean[], Boolean[]
byte[], Byte[]
short[], Short[]
int[], Integer[]
char[], Character[]
long[], Long[]
float[], Float[]
double[], Double[]
BigInteger[]
BigDecimal[]
ZonedDateTime[]
Date[]

Copy link
Collaborator

@tfdsimoes tfdsimoes left a 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
Copy link
Collaborator

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 @@
/*
Copy link
Collaborator

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.*;
Copy link
Collaborator

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 {

/**
Copy link
Collaborator

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";
Copy link
Collaborator

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";
Copy link
Collaborator

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> {
Copy link
Collaborator

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> {
Copy link
Collaborator

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[]"
Copy link
Collaborator

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) {
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants