UniVocity howto add parameters to a custom ValidatorValidate decimal numbers in JavaScript - IsNumeric()How to validate an email address in JavaScriptA comprehensive regex for phone number validation(Built-in) way in JavaScript to check if a string is a valid numberHow to validate an email address using a regular expression?What is the maximum length of a valid email address?Does Java support default parameter values?Sort ArrayList of custom Objects by propertyjpa2 db reverse engineering with bean validation annotationsBean Validation message interpolation with array constraint parameter used as variable in message

Does wetting a beer glass change the foam characteristics?

Is there any relation/leak between two sections of LM358 op-amp?

Is it more effective to add yeast before or after kneading?

Designing a time thief proof safe

Hilbert's hotel: why can't I repeat it infinitely many times?

Is it possible to encode a message in such a way that can only be read by someone or something capable of seeing into the very near future?

How to say "cheat sheet" in French

On the meaning of 'anyways' in "What Exactly Is a Quartz Crystal, Anyways?"

Word or Phrase Meaning False Self-Criticism

Under what circumstances would RAM locations 0 and 1 be written and/or read on the C64?

Why did the Soviet Union not "grant" Inner Mongolia to Mongolia after World War Two?

Lost Update Understanding

Symbol for function composition like a big sum

What are the consequences of high orphan block rate?

Why does C++ have 'Undefined Behaviour' and other languages like C# or Java don't?

How to clarify between imagined sensations and "real" fantasy events?

Clear text passwords in Unix

Do we know the situation in Britain before Sealion (summer 1940)?

Pi Zero Work With Embedded WIFI And Cellular USB Modem

What secular civic space would pioneers build for small frontier towns?

List of 1000 most common words across all languages

How can this Stack Exchange site have an animated favicon?

Carry vs Roll-Down on a zero-coupon IRS

What is the white pattern on trim wheel for?



UniVocity howto add parameters to a custom Validator


Validate decimal numbers in JavaScript - IsNumeric()How to validate an email address in JavaScriptA comprehensive regex for phone number validation(Built-in) way in JavaScript to check if a string is a valid numberHow to validate an email address using a regular expression?What is the maximum length of a valid email address?Does Java support default parameter values?Sort ArrayList of custom Objects by propertyjpa2 db reverse engineering with bean validation annotationsBean Validation message interpolation with array constraint parameter used as variable in message






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








2















I'm creating some custom Validators for univocity parser and I want to add some parameters like this:



 public class Size implements Validator<String>
int max;


and then use it like this:



 @Parsed
@Validate(nullable = false, validators = Size.class(8) )
private String someString;


I didn't found anything like this or examples with annotations.



Maybe using javax.validation annotations?



Or maybe injecting sizeValidation object created with range limit constructor?



Thanks!










share|improve this question
























  • Partially solved. Size could be validated with RegEx ^_^ matches = "^.3,5$" size min=3, max=5

    – Jesús David López
    Mar 29 at 9:29


















2















I'm creating some custom Validators for univocity parser and I want to add some parameters like this:



 public class Size implements Validator<String>
int max;


and then use it like this:



 @Parsed
@Validate(nullable = false, validators = Size.class(8) )
private String someString;


I didn't found anything like this or examples with annotations.



Maybe using javax.validation annotations?



Or maybe injecting sizeValidation object created with range limit constructor?



Thanks!










share|improve this question
























  • Partially solved. Size could be validated with RegEx ^_^ matches = "^.3,5$" size min=3, max=5

    – Jesús David López
    Mar 29 at 9:29














2












2








2


1






I'm creating some custom Validators for univocity parser and I want to add some parameters like this:



 public class Size implements Validator<String>
int max;


and then use it like this:



 @Parsed
@Validate(nullable = false, validators = Size.class(8) )
private String someString;


I didn't found anything like this or examples with annotations.



Maybe using javax.validation annotations?



Or maybe injecting sizeValidation object created with range limit constructor?



Thanks!










share|improve this question














I'm creating some custom Validators for univocity parser and I want to add some parameters like this:



 public class Size implements Validator<String>
int max;


and then use it like this:



 @Parsed
@Validate(nullable = false, validators = Size.class(8) )
private String someString;


I didn't found anything like this or examples with annotations.



Maybe using javax.validation annotations?



Or maybe injecting sizeValidation object created with range limit constructor?



Thanks!







java validation univocity






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 28 at 17:38









Jesús David LópezJesús David López

132 bronze badges




132 bronze badges















  • Partially solved. Size could be validated with RegEx ^_^ matches = "^.3,5$" size min=3, max=5

    – Jesús David López
    Mar 29 at 9:29


















  • Partially solved. Size could be validated with RegEx ^_^ matches = "^.3,5$" size min=3, max=5

    – Jesús David López
    Mar 29 at 9:29

















Partially solved. Size could be validated with RegEx ^_^ matches = "^.3,5$" size min=3, max=5

– Jesús David López
Mar 29 at 9:29






Partially solved. Size could be validated with RegEx ^_^ matches = "^.3,5$" size min=3, max=5

– Jesús David López
Mar 29 at 9:29













1 Answer
1






active

oldest

votes


















1
















Two options here:



1 - add the annotations on a setter (simple but not reusable:



 @Parsed
@Validate(nullable = false)
public void setSomeString(String value)


2 - extend class ValidatedConversion and use that class on a @Convert annotation:



public class LengthValidator extends ValidatedConversion 

private int min;
private int max;

public LengthValidator(String... args)
super(false, false); //not null / not blank
this.min = Integer.parseInt(args[0]);
this.max = Integer.parseInt(args[1]);


@Override
protected void validate(Object value)



Then add it to your attribute:



 @Parsed
@Convert(conversionClass = LengthValidator.class, args = "3", "5")
private String someString;


Hope this helps.






share|improve this answer

























  • It helps a lot. Thanks! excellent library btw. I'm combining RegEx with ValidatedConversion and it works ... fast! :-)

    – Jesús David López
    Apr 4 at 10:32













Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);














draft saved

draft discarded
















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55403794%2funivocity-howto-add-parameters-to-a-custom-validator%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1
















Two options here:



1 - add the annotations on a setter (simple but not reusable:



 @Parsed
@Validate(nullable = false)
public void setSomeString(String value)


2 - extend class ValidatedConversion and use that class on a @Convert annotation:



public class LengthValidator extends ValidatedConversion 

private int min;
private int max;

public LengthValidator(String... args)
super(false, false); //not null / not blank
this.min = Integer.parseInt(args[0]);
this.max = Integer.parseInt(args[1]);


@Override
protected void validate(Object value)



Then add it to your attribute:



 @Parsed
@Convert(conversionClass = LengthValidator.class, args = "3", "5")
private String someString;


Hope this helps.






share|improve this answer

























  • It helps a lot. Thanks! excellent library btw. I'm combining RegEx with ValidatedConversion and it works ... fast! :-)

    – Jesús David López
    Apr 4 at 10:32















1
















Two options here:



1 - add the annotations on a setter (simple but not reusable:



 @Parsed
@Validate(nullable = false)
public void setSomeString(String value)


2 - extend class ValidatedConversion and use that class on a @Convert annotation:



public class LengthValidator extends ValidatedConversion 

private int min;
private int max;

public LengthValidator(String... args)
super(false, false); //not null / not blank
this.min = Integer.parseInt(args[0]);
this.max = Integer.parseInt(args[1]);


@Override
protected void validate(Object value)



Then add it to your attribute:



 @Parsed
@Convert(conversionClass = LengthValidator.class, args = "3", "5")
private String someString;


Hope this helps.






share|improve this answer

























  • It helps a lot. Thanks! excellent library btw. I'm combining RegEx with ValidatedConversion and it works ... fast! :-)

    – Jesús David López
    Apr 4 at 10:32













1














1










1









Two options here:



1 - add the annotations on a setter (simple but not reusable:



 @Parsed
@Validate(nullable = false)
public void setSomeString(String value)


2 - extend class ValidatedConversion and use that class on a @Convert annotation:



public class LengthValidator extends ValidatedConversion 

private int min;
private int max;

public LengthValidator(String... args)
super(false, false); //not null / not blank
this.min = Integer.parseInt(args[0]);
this.max = Integer.parseInt(args[1]);


@Override
protected void validate(Object value)



Then add it to your attribute:



 @Parsed
@Convert(conversionClass = LengthValidator.class, args = "3", "5")
private String someString;


Hope this helps.






share|improve this answer













Two options here:



1 - add the annotations on a setter (simple but not reusable:



 @Parsed
@Validate(nullable = false)
public void setSomeString(String value)


2 - extend class ValidatedConversion and use that class on a @Convert annotation:



public class LengthValidator extends ValidatedConversion 

private int min;
private int max;

public LengthValidator(String... args)
super(false, false); //not null / not blank
this.min = Integer.parseInt(args[0]);
this.max = Integer.parseInt(args[1]);


@Override
protected void validate(Object value)



Then add it to your attribute:



 @Parsed
@Convert(conversionClass = LengthValidator.class, args = "3", "5")
private String someString;


Hope this helps.







share|improve this answer












share|improve this answer



share|improve this answer










answered Apr 4 at 1:31









Jeronimo BackesJeronimo Backes

4,8451 gold badge18 silver badges24 bronze badges




4,8451 gold badge18 silver badges24 bronze badges















  • It helps a lot. Thanks! excellent library btw. I'm combining RegEx with ValidatedConversion and it works ... fast! :-)

    – Jesús David López
    Apr 4 at 10:32

















  • It helps a lot. Thanks! excellent library btw. I'm combining RegEx with ValidatedConversion and it works ... fast! :-)

    – Jesús David López
    Apr 4 at 10:32
















It helps a lot. Thanks! excellent library btw. I'm combining RegEx with ValidatedConversion and it works ... fast! :-)

– Jesús David López
Apr 4 at 10:32





It helps a lot. Thanks! excellent library btw. I'm combining RegEx with ValidatedConversion and it works ... fast! :-)

– Jesús David López
Apr 4 at 10:32




















draft saved

draft discarded















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55403794%2funivocity-howto-add-parameters-to-a-custom-validator%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현