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;
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
add a comment
|
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
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
add a comment
|
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
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
java validation univocity
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
add a comment
|
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
add a comment
|
1 Answer
1
active
oldest
votes
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.
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
add a comment
|
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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.
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
add a comment
|
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.
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
add a comment
|
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.
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.
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
add a comment
|
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
add a comment
|
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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