Author: epbernard
Date: 2009-03-16 19:34:13 -0400 (Mon, 16 Mar 2009)
New Revision: 16162
Modified:
beanvalidation/trunk/validation-api/src/main/java/javax/validation/ConstraintDescriptor.java
beanvalidation/trunk/validation-api/src/main/java/javax/validation/PropertyDescriptor.java
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ConstraintDescriptorImpl.java
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ConstraintTree.java
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ExecutionContext.java
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ResourceBundleMessageInterpolator.java
Log:
BVAL-141 Rename ConstraintDescriptor.getParameters() to getAttributes()
Modified:
beanvalidation/trunk/validation-api/src/main/java/javax/validation/ConstraintDescriptor.java
===================================================================
---
beanvalidation/trunk/validation-api/src/main/java/javax/validation/ConstraintDescriptor.java 2009-03-16
23:26:39 UTC (rev 16161)
+++
beanvalidation/trunk/validation-api/src/main/java/javax/validation/ConstraintDescriptor.java 2009-03-16
23:34:13 UTC (rev 16162)
@@ -32,8 +32,8 @@
public interface ConstraintDescriptor<T extends Annotation> {
/**
* Returns the annotation describing the constraint declaration.
- * If a composing constraint, parameter values are reflecting
- * the overridden parameters from the main constraint
+ * If a composing constraint, attribute values are reflecting
+ * the overridden attributes from the composing constraint
*
* @return The annotation for this constraint.
*/
@@ -54,24 +54,24 @@
* @return list of the constraint validation implementation classes.
*/
List<Class<? extends ConstraintValidator<T, ?>>>
- getConstraintValidatorClasses();
+ getConstraintValidatorClasses();
/**
- * Returns a map containing the annotation parameter names as keys and the
- * annotation parameter values as value.
- * If this constraint is used as part of a composed constraint, parameter
- * values are reflecting the overridden parameters from the main constraint.
+ * Returns a map containing the annotation attribute names as keys and the
+ * annotation attribute values as value.
+ * If this constraint is used as part of a composed constraint, attribute
+ * values are reflecting the overridden attribute from the composing constraint.
*
- * @return a map containing the annotation paramter names as keys
- * and the annotation parameter values as value.
+ * @return a map containing the annotation attribute names as keys
+ * and the annotation attribute values as value.
*/
- Map<String, Object> getParameters();
+ Map<String, Object> getAttributes();
/**
* Return a set of composing <code>ConstraintDescriptor</code>s where each
* descriptor describes a composing constraint.
<code>ConstraintDescriptor</code>
- * instances of composing constraints reflect overridden parameter values in
- * {@link #getParameters()} and {@link #getAnnotation()}.
+ * instances of composing constraints reflect overridden attribute values in
+ * {@link #getAttributes()} and {@link #getAnnotation()}.
*
* @return a set of <code>ConstraintDescriptor<code> objects or an empty
set
* in case there are no composing constraints.
Modified:
beanvalidation/trunk/validation-api/src/main/java/javax/validation/PropertyDescriptor.java
===================================================================
---
beanvalidation/trunk/validation-api/src/main/java/javax/validation/PropertyDescriptor.java 2009-03-16
23:26:39 UTC (rev 16161)
+++
beanvalidation/trunk/validation-api/src/main/java/javax/validation/PropertyDescriptor.java 2009-03-16
23:34:13 UTC (rev 16162)
@@ -3,7 +3,7 @@
/**
* Describes a Java Bean property hosting validation constraints.
*
- * Constraints placed on the attribute and the getter for a given property
+ * Constraints placed on the attribute and the getter of a given property
* are all referenced by this object.
*
* @author Emmanuel Bernard
Modified:
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ConstraintDescriptorImpl.java
===================================================================
---
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ConstraintDescriptorImpl.java 2009-03-16
23:26:39 UTC (rev 16161)
+++
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ConstraintDescriptorImpl.java 2009-03-16
23:34:13 UTC (rev 16162)
@@ -73,7 +73,7 @@
* The constraint parameters as map. The key is the paramter name and the value the
* parameter value as specified in the constraint.
*/
- private final Map<String, Object> parameters;
+ private final Map<String, Object> attributes;
/**
* The composing constraints for this constraints.
@@ -106,7 +106,7 @@
private ConstraintDescriptorImpl(T annotation, Set<Class<?>> groups,
ConstraintHelper constraintHelper) {
this.annotation = annotation;
this.groups = groups;
- this.parameters = getAnnotationParameters( annotation );
+ this.attributes = getAnnotationParameters( annotation );
this.constraintHelper = constraintHelper;
this.isReportAsSingleInvalidConstraint =
annotation.annotationType().isAnnotationPresent(
@@ -161,8 +161,8 @@
/**
* {@inheritDoc}
*/
- public Map<String, Object> getParameters() {
- return Collections.unmodifiableMap( parameters );
+ public Map<String, Object> getAttributes() {
+ return Collections.unmodifiableMap( attributes );
}
/**
@@ -185,7 +185,7 @@
"annotation=" + annotation +
", constraintValidatorDefinitonClasses=" +
constraintValidatorDefinitonClasses.toString() +
", groups=" + groups +
- ", parameters=" + parameters +
+ ", attributes=" + attributes +
", composingConstraints=" + composingConstraints +
", isReportAsSingleInvalidConstraint=" + isReportAsSingleInvalidConstraint
+
'}';
@@ -199,10 +199,10 @@
parameters.put( m.getName(), m.invoke( annotation ) );
}
catch ( IllegalAccessException e ) {
- throw new ValidationException( "Unable to read annotation parameters: " +
annotation.getClass(), e );
+ throw new ValidationException( "Unable to read annotation attributes: " +
annotation.getClass(), e );
}
catch ( InvocationTargetException e ) {
- throw new ValidationException( "Unable to read annotation parameters: " +
annotation.getClass(), e );
+ throw new ValidationException( "Unable to read annotation attributes: " +
annotation.getClass(), e );
}
}
return Collections.unmodifiableMap( parameters );
Modified:
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ConstraintTree.java
===================================================================
---
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ConstraintTree.java 2009-03-16
23:26:39 UTC (rev 16161)
+++
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ConstraintTree.java 2009-03-16
23:34:13 UTC (rev 16162)
@@ -118,7 +118,7 @@
}
if ( reportAsSingleViolation() && constraintViolations.size() > 0 ) {
constraintViolations.clear();
- final String message = ( String ) getParent().getDescriptor().getParameters().get(
"message" );
+ final String message = ( String ) getParent().getDescriptor().getAttributes().get(
"message" );
final String property = executionContext.peekPropertyPath();
ExecutionContext<T>.ErrorMessage error = executionContext.new ErrorMessage(
message, property );
constraintViolations.add( executionContext.createConstraintViolation( value, error )
);
Modified:
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ExecutionContext.java
===================================================================
---
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ExecutionContext.java 2009-03-16
23:26:39 UTC (rev 16161)
+++
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ExecutionContext.java 2009-03-16
23:34:13 UTC (rev 16162)
@@ -328,7 +328,7 @@
}
public String getDefaultErrorMessage() {
- return ( String ) constraintDescriptor.getParameters().get( "message" );
+ return ( String ) constraintDescriptor.getAttributes().get( "message" );
}
public void addError(String message) {
Modified:
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ResourceBundleMessageInterpolator.java
===================================================================
---
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ResourceBundleMessageInterpolator.java 2009-03-16
23:26:39 UTC (rev 16161)
+++
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ResourceBundleMessageInterpolator.java 2009-03-16
23:34:13 UTC (rev 16162)
@@ -89,14 +89,14 @@
public String interpolate(String message, Context context) {
// probably no need for caching, but it could be done by parameters since the map
// is immutable and uniquely built per Validation definition, the comparaison has to be
based on == and not equals though
- return interpolateMessage( message, context.getConstraintDescriptor().getParameters(),
defaultLocale );
+ return interpolateMessage( message, context.getConstraintDescriptor().getAttributes(),
defaultLocale );
}
/**
* {@inheritDoc}
*/
public String interpolate(String message, Context context, Locale locale) {
- return interpolateMessage( message, context.getConstraintDescriptor().getParameters(),
locale );
+ return interpolateMessage( message, context.getConstraintDescriptor().getAttributes(),
locale );
}
/**