You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by mg...@apache.org on 2012/11/25 22:42:37 UTC

git commit: Add the trailing underscores to the field member which should not be used directly

Updated Branches:
  refs/heads/master 45bd80572 -> fd1b33987


Add the trailing underscores to the field member which should not be used directly


Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/fd1b3398
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/fd1b3398
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/fd1b3398

Branch: refs/heads/master
Commit: fd1b3398764a554995f4f5784c4534e39a0513c2
Parents: 45bd805
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Sun Nov 25 22:41:27 2012 +0100
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Sun Nov 25 22:41:27 2012 +0100

----------------------------------------------------------------------
 .../wicket/bean/validation/PropertyValidator.java  |   31 ++++++++-------
 1 files changed, 17 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/fd1b3398/wicket-experimental/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/PropertyValidator.java
----------------------------------------------------------------------
diff --git a/wicket-experimental/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/PropertyValidator.java b/wicket-experimental/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/PropertyValidator.java
index e625f38..04a82bc 100644
--- a/wicket-experimental/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/PropertyValidator.java
+++ b/wicket-experimental/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/PropertyValidator.java
@@ -29,14 +29,14 @@ import org.apache.wicket.validation.IValidator;
  * </p>
  * 
  * <p>
- * The validator will set the reqiured flag on the form component it is attached to based on the
+ * The validator will set the required flag on the form component it is attached to based on the
  * presence of the @NotNull annotation. Notice, the required flag will only be set to {@code true},
  * components with the required flag already set to {@code true} will not have the flag set to
  * {@code false} by this validator.
  * </p>
  * 
  * <p>
- * The validator will allow {@link ITagModifier}s condigured in {@link BeanValidationConfiguration}
+ * The validator will allow {@link ITagModifier}s configured in {@link BeanValidationConfiguration}
  * to mutate the markup tag of the component it is attached to.
  * </p>
  * 
@@ -55,8 +55,11 @@ public class PropertyValidator<T> extends Behavior implements IValidator<T>
 	private static final Class<?>[] EMPTY = new Class<?>[0];
 
 	private FormComponent<T> component;
-	private Property property;
-	private final IModel<Class<?>[]> groups;
+
+	// the trailing underscore means that these members should not be used
+	// directly. ALWAYS use the respective getter instead.
+	private Property property_;
+	private final IModel<Class<?>[]> groups_;
 
 	public PropertyValidator(Class<?>... groups)
 	{
@@ -75,16 +78,16 @@ public class PropertyValidator<T> extends Behavior implements IValidator<T>
 
 	public PropertyValidator(Property property, IModel<Class<?>[]> groups)
 	{
-		this.property = property;
-		this.groups = groups;
+		this.property_ = property;
+		this.groups_ = groups;
 	}
 
 	private Property getProperty()
 	{
-		if (property == null)
+		if (property_ == null)
 		{
-			property = BeanValidationConfiguration.get().resolveProperty(component);
-			if (property == null)
+			property_ = BeanValidationConfiguration.get().resolveProperty(component);
+			if (property_ == null)
 			{
 				throw new IllegalStateException(
 					"Could not resolve Property from component: " +
@@ -94,16 +97,16 @@ public class PropertyValidator<T> extends Behavior implements IValidator<T>
 						" to resolve the Property automatically");
 			}
 		}
-		return property;
+		return property_;
 	}
 
 	private Class<?>[] getGroups()
 	{
-		if (groups == null)
+		if (groups_ == null)
 		{
 			return EMPTY;
 		}
-		return groups.getObject();
+		return groups_.getObject();
 	}
 
 	@SuppressWarnings("unchecked")
@@ -136,9 +139,9 @@ public class PropertyValidator<T> extends Behavior implements IValidator<T>
 	public void detach(Component component)
 	{
 		super.detach(component);
-		if (groups != null)
+		if (groups_ != null)
 		{
-			groups.detach();
+			groups_.detach();
 		}
 	}