You aren’t talking about bringing another jar as a required dependency are you? Required dependencies for core should be 0.
Ralph On Sep 15, 2014, at 9:31 AM, Gary Gregory <[email protected]> wrote: > This is all in the core, so I do not see the need to repackage anything. We > certainly do not do it for anything else. Why would you want to do it here? > > Gary > > On Mon, Sep 15, 2014 at 12:28 PM, Matt Sicker <[email protected]> wrote: > Well, it's certainly worth trying. However, if we went that route, would we > have a hard dependency on the javax.validation API? Or would we > package-rename things and embed it? > > On 15 September 2014 11:24, Gary Gregory <[email protected]> wrote: > It all depends on your POV ;-) , one of which is, what we are doing now is > overkill compared to what we started with... > > So, why not Bean Validation, more precisely? It seems we owe it to the > project to try it (in a branch perhaps) and _know_ that it is possible or not > a right fit. > > Conceptually, it's hard to see how it would not be a right fit. > > Gary > > On Mon, Sep 15, 2014 at 11:10 AM, Matt Sicker <[email protected]> wrote: > I was looking at bean validation, and not only is it overkill for our > situation, but I don't know how well it would work either. > > On 15 September 2014 05:50, Gary Gregory <[email protected]> wrote: > I don't about this... I feel we need to discuss this before we reinvent the > bean validation JSR wheel and Hibernate Validator or some other > implementation. Why are we forcing users to learn another framework instead > of using a standard? This is almost -1 territory... I feel we need to clean > up the builder pattern mess before we make another decision on plugins... > > Gary > > > -------- Original message -------- > From: [email protected] > Date:09/14/2014 23:34 (GMT-05:00) > To: [email protected] > Subject: [2/8] git commit: Add validation message to @RequiresNonNull. > > Add validation message to @RequiresNonNull. > > > Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo > Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/20e739a5 > Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/20e739a5 > Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/20e739a5 > > Branch: refs/heads/master > Commit: 20e739a5308023e4f5b03a49ea12f473193dcbea > Parents: 84e7fed > Author: Matt Sicker <[email protected]> > Authored: Sun Sep 14 20:26:48 2014 -0500 > Committer: Matt Sicker <[email protected]> > Committed: Sun Sep 14 20:26:48 2014 -0500 > > ---------------------------------------------------------------------- > .../validation/constraints/RequiresNonNull.java | 5 +++++ > .../validators/RequiresNonNullValidator.java | 14 +++++++++++++- > 2 files changed, 18 insertions(+), 1 deletion(-) > ---------------------------------------------------------------------- > > > http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/20e739a5/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/validation/constraints/RequiresNonNull.java > ---------------------------------------------------------------------- > diff --git > a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/validation/constraints/RequiresNonNull.java > > b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/validation/constraints/RequiresNonNull.java > index b3ef11d..7eb83e2 100644 > --- > a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/validation/constraints/RequiresNonNull.java > +++ > b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/validation/constraints/RequiresNonNull.java > @@ -36,4 +36,9 @@ import > org.apache.logging.log4j.core.config.plugins.validation.validators.Requir > @Target({ElementType.FIELD, ElementType.PARAMETER}) > @Constraint(RequiresNonNullValidator.class) > public @interface RequiresNonNull { > + > + /** > + * The message to be logged if this constraint is violated. This should > normally be overridden. > + */ > + String message() default "The parameter is null"; > } > > http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/20e739a5/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/validation/validators/RequiresNonNullValidator.java > ---------------------------------------------------------------------- > diff --git > a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/validation/validators/RequiresNonNullValidator.java > > b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/validation/validators/RequiresNonNullValidator.java > index 49c5806..9a39d4d 100644 > --- > a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/validation/validators/RequiresNonNullValidator.java > +++ > b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/validation/validators/RequiresNonNullValidator.java > @@ -16,8 +16,10 @@ > */ > package org.apache.logging.log4j.core.config.plugins.validation.validators; > > +import org.apache.logging.log4j.Logger; > import > org.apache.logging.log4j.core.config.plugins.validation.ConstraintValidator; > import > org.apache.logging.log4j.core.config.plugins.validation.constraints.RequiresNonNull; > +import org.apache.logging.log4j.status.StatusLogger; > > /** > * Validator implementation for {@link RequiresNonNull}. > @@ -25,12 +27,22 @@ import > org.apache.logging.log4j.core.config.plugins.validation.constraints.Requi > * @since 2.1 > */ > public class RequiresNonNullValidator implements > ConstraintValidator<RequiresNonNull, Object> { > + > + private static final Logger LOGGER = StatusLogger.getLogger(); > + > + private RequiresNonNull annotation; > + > @Override > public void initialize(final RequiresNonNull annotation) { > + this.annotation = annotation; > } > > @Override > public boolean isValid(final Object value) { > - return value != null; > + if (value != null) { > + return true; > + } > + LOGGER.error(annotation.message()); > + return false; > } > } > > > > > -- > Matt Sicker <[email protected]> > > > > -- > E-Mail: [email protected] | [email protected] > Java Persistence with Hibernate, Second Edition > JUnit in Action, Second Edition > Spring Batch in Action > Blog: http://garygregory.wordpress.com > Home: http://garygregory.com/ > Tweet! http://twitter.com/GaryGregory > > > > -- > Matt Sicker <[email protected]> > > > > -- > E-Mail: [email protected] | [email protected] > Java Persistence with Hibernate, Second Edition > JUnit in Action, Second Edition > Spring Batch in Action > Blog: http://garygregory.wordpress.com > Home: http://garygregory.com/ > Tweet! http://twitter.com/GaryGregory
