You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bval.apache.org by mb...@apache.org on 2010/10/13 02:28:18 UTC
svn commit: r1021960 -
/incubator/bval/sandbox/lang3-work/bval-jsr303d/src/main/java/org/apache/bval/jsr303/dynamic/ConstraintAppender.java
Author: mbenson
Date: Wed Oct 13 00:28:18 2010
New Revision: 1021960
URL: http://svn.apache.org/viewvc?rev=1021960&view=rev
Log:
put null check into the right place (+ reformat)
Modified:
incubator/bval/sandbox/lang3-work/bval-jsr303d/src/main/java/org/apache/bval/jsr303/dynamic/ConstraintAppender.java
Modified: incubator/bval/sandbox/lang3-work/bval-jsr303d/src/main/java/org/apache/bval/jsr303/dynamic/ConstraintAppender.java
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-jsr303d/src/main/java/org/apache/bval/jsr303/dynamic/ConstraintAppender.java?rev=1021960&r1=1021959&r2=1021960&view=diff
==============================================================================
--- incubator/bval/sandbox/lang3-work/bval-jsr303d/src/main/java/org/apache/bval/jsr303/dynamic/ConstraintAppender.java (original)
+++ incubator/bval/sandbox/lang3-work/bval-jsr303d/src/main/java/org/apache/bval/jsr303/dynamic/ConstraintAppender.java Wed Oct 13 00:28:18 2010
@@ -27,26 +27,26 @@ import java.util.Collection;
import org.apache.bval.jsr303.util.SecureActions;
/**
- * <p>Interface specifying a means of applying a constraint annotation to a
- * collection of same, thus allowing for the situation where the addition of a
- * constraint must result in the eviction or modification of existing
- * constraints, the added constraint, or, indeed, any imaginable combination
- * thereof.</p>
- * <p>Current recommendation is to follow a principle of mutual annihilation
- * when a constraint encounters its anti-constraint; conversely, to allow even
- * a noop constraint to lie dormant in the collection of dynamic constraints
- * with the expectation that a subsequent merge of dynamic metadata will
- * result in its meeting its anti-constraint (that constraint having been specified
- * at a more generic level). Only time will tell if this approach satisfies
- * the principle of least surprise.</p>
+ * <p>
+ * Interface specifying a means of applying a constraint annotation to a collection of same, thus allowing for the
+ * situation where the addition of a constraint must result in the eviction or modification of existing constraints, the
+ * added constraint, or, indeed, any imaginable combination thereof.
+ * </p>
+ * <p>
+ * Current recommendation is to follow a principle of mutual annihilation when a constraint encounters its
+ * anti-constraint; conversely, to allow even a noop constraint to lie dormant in the collection of dynamic constraints
+ * with the expectation that a subsequent merge of dynamic metadata will result in its meeting its anti-constraint (that
+ * constraint having been specified at a more generic level). Only time will tell if this approach satisfies the
+ * principle of least surprise.
+ * </p>
*
* @version $Rev$ $Date$
*/
public interface ConstraintAppender {
/**
- * Meta-annotation to specify a {@link ConstraintAppender} implementation
- * that knows how to manage a given jsr303 annotation.
+ * Meta-annotation to specify a {@link ConstraintAppender} implementation that knows how to manage a given jsr303
+ * annotation.
*/
@Documented
@Retention(RetentionPolicy.RUNTIME)
@@ -66,11 +66,10 @@ public interface ConstraintAppender {
}
/**
- * Get a constraint appender for the specified constraint. If the
- * constraint does not declare an annotation method of
- * {@link ConstraintAppender#TYPE_ATTRIBUTE} returning
- * <code>Class<? extends {@link ConstraintAppender}></code>,
- * {@link DefaultConstraintAppender#INSTANCE} will be used.
+ * Get a constraint appender for the specified constraint. If the constraint does not declare an annotation
+ * method of {@link ConstraintAppender#TYPE_ATTRIBUTE} returning
+ * <code>Class<? extends {@link ConstraintAppender}></code>, {@link DefaultConstraintAppender#INSTANCE} will be
+ * used.
*
* @param constraint
* @return {@link ConstraintAppender}
@@ -78,9 +77,8 @@ public interface ConstraintAppender {
public ConstraintAppender constraintAppender(Annotation constraint) {
try {
Use use = constraint.annotationType().getAnnotation(Use.class);
- Class<? extends ConstraintAppender> appenderType = use.value();
- if (appenderType != null) {
- return SecureActions.newInstance(appenderType);
+ if (use != null) {
+ return SecureActions.newInstance(use.value());
}
} catch (RuntimeException e) {
}