Author: hardy.ferentschik
Date: 2009-08-26 06:56:08 -0400 (Wed, 26 Aug 2009)
New Revision: 17420
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/ValidatorImpl.java
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/metadata/BeanDescriptorImpl.java
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/metadata/BeanMetaData.java
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/metadata/BeanMetaDataImpl.java
Log:
Also fixed several typos in comments and method names
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-08-26
10:54:59 UTC (rev 17419)
+++
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ConstraintTree.java 2009-08-26
10:56:08 UTC (rev 17420)
@@ -38,7 +38,7 @@
import org.hibernate.validation.util.ValidatorTypeHelper;
/**
- * Due to constraint conposition a single constraint annotation can lead to a whole
constraint tree beeing validated.
+ * Due to constraint composition a single constraint annotation can lead to a whole
constraint tree being validated.
* This class encapsulates such a tree.
*
* @author Hardy Ferentschik
@@ -116,7 +116,7 @@
descriptor
);
}
- ConstraintValidator<A, V> validator = getInitalizedValidator(
+ ConstraintValidator<A, V> validator = getInitializedValidator(
localExecutionContext.getCurrentValidatedValue(),
type,
executionContext.getConstraintValidatorFactory()
@@ -170,10 +170,10 @@
* @param type The type of the value to be validated (the type of the member/class the
constraint was placed on).
* @param constraintFactory constraint factory used to instantiate the constraint
validator.
*
- * @return A initalized constraint validator matching the type of the value to be
validated.
+ * @return A initialized constraint validator matching the type of the value to be
validated.
*/
@SuppressWarnings("unchecked")
- private <V> ConstraintValidator<A, V> getInitalizedValidator(V value, Type
type, ConstraintValidatorFactory constraintFactory) {
+ private <V> ConstraintValidator<A, V> getInitializedValidator(V value, Type
type, ConstraintValidatorFactory constraintFactory) {
Class<? extends ConstraintValidator<?, ?>> validatorClass =
findMatchingValidatorClass( value, type );
ConstraintValidator<A, V> constraintValidator;
@@ -209,20 +209,20 @@
* @return The class of a matching validator.
*/
private Class<? extends ConstraintValidator<?, ?>>
findMatchingValidatorClass(Object value, Type type) {
- Map<Type, Class<? extends ConstraintValidator<?, ?>>> validatorsTypes
=
+ Map<Type, Class<? extends ConstraintValidator<?, ?>>> validatorTypes
=
ValidatorTypeHelper.getValidatorsTypes( descriptor.getConstraintValidatorClasses()
);
List<Type> suitableTypes = new ArrayList<Type>();
- findSuitableValidatorTypes( type, validatorsTypes, suitableTypes );
+ findSuitableValidatorTypes( type, validatorTypes, suitableTypes );
if ( value != null ) {
- findSuitableValidatorTypes( value.getClass(), validatorsTypes, suitableTypes );
+ findSuitableValidatorTypes( value.getClass(), validatorTypes, suitableTypes );
}
resolveAssignableTypes( suitableTypes );
verifyResolveWasUnique( type, suitableTypes );
- return validatorsTypes.get( suitableTypes.get( 0 ) );
+ return validatorTypes.get( suitableTypes.get( 0 ) );
}
private void verifyResolveWasUnique(Type valueClass, List<Type> assignableClasses)
{
@@ -231,7 +231,7 @@
}
else if ( assignableClasses.size() > 1 ) {
StringBuilder builder = new StringBuilder();
- builder.append( "There are multiple validators which could validate the type
" );
+ builder.append( "There are multiple validator classes which could validate the
type " );
builder.append( valueClass );
builder.append( ". The validator classes are: " );
for ( Type clazz : assignableClasses ) {
@@ -286,7 +286,7 @@
constraintValidator.initialize( descriptor.getAnnotation() );
}
catch ( RuntimeException e ) {
- throw new ValidationException( "Unable to intialize " +
constraintValidator.getClass().getName(), e );
+ throw new ValidationException( "Unable to initialize " +
constraintValidator.getClass().getName(), e );
}
}
Modified:
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ValidatorImpl.java
===================================================================
---
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ValidatorImpl.java 2009-08-26
10:54:59 UTC (rev 17419)
+++
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/engine/ValidatorImpl.java 2009-08-26
10:56:08 UTC (rev 17420)
@@ -184,8 +184,8 @@
*
* @param value The value to validate.
* @param context Global context. Used amongst others to collect all failing
constraints.
- * @param groupChain Contains the information which and in which oder groups have to be
executed
- * @param path The current path of the valiation.
+ * @param groupChain Contains the information which and in which order groups have to be
executed
+ * @param path The current path of the validation.
* @param <T> The root bean type.
* @param <V> The type of the current object on the validation stack.
*
@@ -243,7 +243,7 @@
boolean validatingDefault = localExecutionContext.validatingDefault();
boolean validatedBeanRedefinesDefault =
beanMetaData.defaultGroupSequenceIsRedefined();
- // if we are not validating the default group there is nothing slecial to consider
+ // if we are not validating the default group there is nothing special to consider
if ( !validatingDefault ) {
validateConstraintsForNonDefaultGroup( globalExecutionContext, localExecutionContext,
path );
return;
@@ -265,7 +265,7 @@
private <T, U, V> void
validateConstraintsForRedefinedDefaultGroup(GlobalExecutionContext<T>
globalExecutionContext, LocalExecutionContext<U, V> localExecutionContext, PathImpl
path, BeanMetaData<U> beanMetaData) {
// in the case where the main entity does not redefine the default group we have to
check whether the entity which defines the constraint does
- for ( Map.Entry<Class<?>, List<MetaConstraint<U, ? extends
Annotation>>> entry : beanMetaData.geMetaConstraintsAsMap()
+ for ( Map.Entry<Class<?>, List<MetaConstraint<U, ? extends
Annotation>>> entry : beanMetaData.getMetaConstraintsAsMap()
.entrySet() ) {
Class<?> hostingBeanClass = entry.getKey();
List<MetaConstraint<U, ? extends Annotation>> constraints =
entry.getValue();
@@ -288,13 +288,13 @@
}
private <T, U, V> void
validateConstraintsForRedefinedDefaultGroupOnMainEntity(GlobalExecutionContext<T>
globalExecutionContext, LocalExecutionContext<U, V> localExecutionContext, PathImpl
path, BeanMetaData<U> beanMetaData) {
- // in the case where the main entity redefines the default group we can interate over
all constraints independend of the bean they are
+ // in the case where the main entity redefines the default group we can iterate over
all constraints independent of the bean they are
// defined in. The redefined group sequence applies for all constraints.
List<Class<?>> defaultGroupSequence =
beanMetaData.getDefaultGroupSequence();
for ( Class<?> defaultSequenceMember : defaultGroupSequence ) {
localExecutionContext.setCurrentGroup( defaultSequenceMember );
boolean validationSuccessful = true;
- for ( MetaConstraint<U, ? extends Annotation> metaConstraint :
beanMetaData.geMetaConstraintsAsList() ) {
+ for ( MetaConstraint<U, ? extends Annotation> metaConstraint :
beanMetaData.getMetaConstraintsAsList() ) {
boolean tmp = validateConstraint(
globalExecutionContext, localExecutionContext, metaConstraint, path
);
@@ -308,7 +308,7 @@
private <T, U, V> void
validateConstraintsForNonDefaultGroup(GlobalExecutionContext<T>
globalExecutionContext, LocalExecutionContext<U, V> localExecutionContext, PathImpl
path) {
BeanMetaData<U> beanMetaData = getBeanMetaData(
localExecutionContext.getCurrentBeanType() );
- for ( MetaConstraint<U, ? extends Annotation> metaConstraint :
beanMetaData.geMetaConstraintsAsList() ) {
+ for ( MetaConstraint<U, ? extends Annotation> metaConstraint :
beanMetaData.getMetaConstraintsAsList() ) {
validateConstraint( globalExecutionContext, localExecutionContext, metaConstraint,
path );
}
}
@@ -348,7 +348,7 @@
*
* @param globalExecutionContext The execution context
* @param localExecutionContext Collected information for single validation
- * @param path The current path of the valiation.
+ * @param path The current path of the validation.
*/
private <T, U, V> void validateCascadedConstraints(GlobalExecutionContext<T>
globalExecutionContext, LocalExecutionContext<U, V> localExecutionContext, PathImpl
path) {
List<Member> cascadedMembers = getBeanMetaData(
localExecutionContext.getCurrentBeanType() )
@@ -599,7 +599,7 @@
);
}
- // process squences
+ // process sequences
Iterator<List<Group>> sequenceIterator = groupChain.getSequenceIterator();
while ( sequenceIterator.hasNext() ) {
List<Group> sequence = sequenceIterator.next();
@@ -688,7 +688,7 @@
}
if ( !propertyIter.hasNext() ) {
- List<MetaConstraint<T, ? extends Annotation>> metaConstraintList =
metaData.geMetaConstraintsAsList();
+ List<MetaConstraint<T, ? extends Annotation>> metaConstraintList =
metaData.getMetaConstraintsAsList();
for ( MetaConstraint<T, ?> metaConstraint : metaConstraintList ) {
if ( elem.getName() != null && elem.getName().equals(
metaConstraint.getPropertyName() ) ) {
metaConstraints.add( metaConstraint );
Modified:
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/metadata/BeanDescriptorImpl.java
===================================================================
---
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/metadata/BeanDescriptorImpl.java 2009-08-26
10:54:59 UTC (rev 17419)
+++
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/metadata/BeanDescriptorImpl.java 2009-08-26
10:56:08 UTC (rev 17420)
@@ -17,7 +17,7 @@
}
public boolean isBeanConstrained() {
- return metadataBean.geMetaConstraintsAsMap().size() > 0;
+ return metadataBean.getMetaConstraintsAsMap().size() > 0;
}
public PropertyDescriptor getConstraintsForProperty(String propertyName) {
Modified:
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/metadata/BeanMetaData.java
===================================================================
---
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/metadata/BeanMetaData.java 2009-08-26
10:54:59 UTC (rev 17419)
+++
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/metadata/BeanMetaData.java 2009-08-26
10:56:08 UTC (rev 17420)
@@ -61,13 +61,13 @@
* @return A map of {@code MetaConstraint} instances encapsulating the information of
all the constraints
* defined on the bean mapped to the class in which the constraints is defined.
*/
- Map<Class<?>, List<MetaConstraint<T, ? extends Annotation>>>
geMetaConstraintsAsMap();
+ Map<Class<?>, List<MetaConstraint<T, ? extends Annotation>>>
getMetaConstraintsAsMap();
/**
* @return A list of {@code MetaConstraint} instances encapsulating the information of
all the constraints
* defined on the bean.
*/
- List<MetaConstraint<T, ? extends Annotation>> geMetaConstraintsAsList();
+ List<MetaConstraint<T, ? extends Annotation>> getMetaConstraintsAsList();
/**
* Return {@code PropertyDescriptor} for the given property.
Modified:
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/metadata/BeanMetaDataImpl.java
===================================================================
---
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/metadata/BeanMetaDataImpl.java 2009-08-26
10:54:59 UTC (rev 17419)
+++
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validation/metadata/BeanMetaDataImpl.java 2009-08-26
10:56:08 UTC (rev 17420)
@@ -126,11 +126,11 @@
return Collections.unmodifiableList( cascadedMembers );
}
- public Map<Class<?>, List<MetaConstraint<T, ? extends
Annotation>>> geMetaConstraintsAsMap() {
+ public Map<Class<?>, List<MetaConstraint<T, ? extends
Annotation>>> getMetaConstraintsAsMap() {
return Collections.unmodifiableMap( metaConstraints );
}
- public List<MetaConstraint<T, ? extends Annotation>>
geMetaConstraintsAsList() {
+ public List<MetaConstraint<T, ? extends Annotation>>
getMetaConstraintsAsList() {
List<MetaConstraint<T, ? extends Annotation>> constraintList = new
ArrayList<MetaConstraint<T, ? extends Annotation>>();
for ( List<MetaConstraint<T, ? extends Annotation>> list :
metaConstraints.values() ) {
constraintList.addAll( list );
@@ -219,10 +219,10 @@
}
/**
- * Create bean desciptor, find all classes/subclasses/interfaces which have to be taken
in consideration
+ * Create bean descriptor, find all classes/subclasses/interfaces which have to be taken
in consideration
* for this validator and create meta data.
*
- * @param annotationIgnores Datastructure keeping track on which annotation should be
ignored.
+ * @param annotationIgnores Data structure keeping track on which annotation should be
ignored.
*/
private void createMetaData(AnnotationIgnores annotationIgnores) {
beanDescriptor = new BeanDescriptorImpl<T>( this );
@@ -403,7 +403,7 @@
}
/**
- * Examines the given annotation to see whether it is a single or multi valued
constraint annotation.
+ * Examines the given annotation to see whether it is a single- or multi-valued
constraint annotation.
*
* @param clazz the class we are currently processing.
* @param annotation The annotation to examine.
@@ -463,7 +463,7 @@
* Finds all constraint annotations defined for the given field/method and returns them
in a list of
* constraint descriptors.
*
- * @param member The fiels or method to check for constraints annotations.
+ * @param member The fields or method to check for constraints annotations.
*
* @return A list of constraint descriptors for all constraint specified for the given
field or method.
*/