You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by hl...@apache.org on 2012/11/03 00:30:48 UTC
[5/5] git commit: Document and cleanup the None validator
Document and cleanup the None validator
Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/fd7a5195
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/fd7a5195
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/fd7a5195
Branch: refs/heads/5.4-js-rewrite
Commit: fd7a519539a618e67683979351c688ec8016911e
Parents: 6581429
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Fri Nov 2 15:15:16 2012 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Fri Nov 2 15:15:16 2012 -0700
----------------------------------------------------------------------
.../java/org/apache/tapestry5/validator/None.java | 20 ++++++++++++---
.../resources/org/apache/tapestry5/core.properties | 1 +
2 files changed, 17 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/fd7a5195/tapestry-core/src/main/java/org/apache/tapestry5/validator/None.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/validator/None.java b/tapestry-core/src/main/java/org/apache/tapestry5/validator/None.java
index 49644a3..ad54efe 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/validator/None.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/validator/None.java
@@ -20,20 +20,32 @@ import org.apache.tapestry5.ValidationException;
import org.apache.tapestry5.ioc.MessageFormatter;
import org.apache.tapestry5.services.FormSupport;
+/**
+ * The none validator is does nothing on either the client or the server; primarily it is employed
+ * as the validate parameter, to override the validation specified in the {@link org.apache.tapestry5.beaneditor.Validate}
+ * annotation of a property.
+ */
public class None extends AbstractValidator<Void, Object>
{
public None()
{
- super(null, Object.class, "required", null);
+ // It is inefficient if there is not a valid matching message key even though the implementation does nothing.
+ // Previous releases used "required" here but that's confusing. The "private-" prefix keeps this from being
+ // sent to the client (every byte counts!).
+ super(null, Object.class, "private-no-validation-for-field", null);
}
- /** Does nothing. */
+ /**
+ * Does nothing.
+ */
public void render(Field field, Void constraintValue, MessageFormatter formatter, MarkupWriter writer,
- FormSupport formSupport)
+ FormSupport formSupport)
{
}
- /** Does nothing. */
+ /**
+ * Does nothing.
+ */
public void validate(Field field, Void constraintValue, MessageFormatter formatter, Object value)
throws ValidationException
{
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/fd7a5195/tapestry-core/src/main/resources/org/apache/tapestry5/core.properties
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/resources/org/apache/tapestry5/core.properties b/tapestry-core/src/main/resources/org/apache/tapestry5/core.properties
index 4d571bc..4ffa2fe 100644
--- a/tapestry-core/src/main/resources/org/apache/tapestry5/core.properties
+++ b/tapestry-core/src/main/resources/org/apache/tapestry5/core.properties
@@ -46,6 +46,7 @@ minimum-string-length=You must provide at least %d characters for %s.
number-format-exception=You must provide a numeric value for %s.
regexp=%2$s does not match pattern '%1$s'.
required=You must provide a value for %s.
+private-no-validation-for-field=placeholder message
core-page-initialization-template=\
require(["core/pageinit"], function(pageinit) {\