Skip to content

Commit

Permalink
HV-371: Cleaning up: fixing typos, removing raw-type warnings, making…
Browse files Browse the repository at this point in the history
… variables unmodifiable
  • Loading branch information
gunnarmorling committed Mar 5, 2011
1 parent 1c5274c commit 44486c4
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
Expand Up @@ -208,7 +208,7 @@ public boolean isMultiValueConstraint(Class<? extends Annotation> annotationType
boolean isMultiValueConstraint = false;
final Method method = ReflectionHelper.getMethod( annotationType, "value" );
if ( method != null ) {
Class returnType = method.getReturnType();
Class<?> returnType = method.getReturnType();
if ( returnType.isArray() && returnType.getComponentType().isAnnotation() ) {
@SuppressWarnings("unchecked")
Class<? extends Annotation> componentType = (Class<? extends Annotation>) returnType.getComponentType();
Expand Down Expand Up @@ -237,7 +237,7 @@ public <A extends Annotation> List<Annotation> getMultiValueConstraints(A annota
try {
final Method method = ReflectionHelper.getMethod( annotation.getClass(), "value" );
if ( method != null ) {
Class returnType = method.getReturnType();
Class<?> returnType = method.getReturnType();
if ( returnType.isArray() && returnType.getComponentType().isAnnotation() ) {
Annotation[] annotations = (Annotation[]) method.invoke( annotation );
for ( Annotation a : annotations ) {
Expand Down
Expand Up @@ -59,20 +59,21 @@ public MethodMetaData(
boolean isCascading) {

this.method = method;
this.parameterMetaData = parameterMetaData;
this.constraints = constraints;
this.parameterMetaData = Collections.unmodifiableList( parameterMetaData );
this.constraints = Collections.unmodifiableList( constraints );
this.isCascading = isCascading;
this.hasParameterConstraints = hasParameterConstraints( parameterMetaData );
}

boolean foundParameterConstraint = false;
private boolean hasParameterConstraints(List<ParameterMetaData> parameterMetaData) {

for ( ParameterMetaData oneParameter : parameterMetaData ) {
if ( oneParameter.isConstrained() ) {
foundParameterConstraint = true;
break;
return true;
}
}

this.hasParameterConstraints = foundParameterConstraint;
return false;
}

/**
Expand Down
Expand Up @@ -17,6 +17,7 @@
package org.hibernate.validator.metadata;

import java.lang.annotation.Annotation;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;

Expand All @@ -42,7 +43,7 @@ public ParameterMetaData(int index, Class<?> type, String name, List<MetaConstra
this.index = index;
this.type = type;
this.name = name;
this.constraints = constraints;
this.constraints = Collections.unmodifiableList( constraints );
this.isCascading = isCascading;
}

Expand Down
Expand Up @@ -19,7 +19,7 @@
import javax.validation.metadata.PropertyDescriptor;

/**
* Describe a validated element (class, field or property).
* Describes a validated element (class, field or property).
*
* @author Emmanuel Bernard
* @author Hardy Ferentschik
Expand Down

0 comments on commit 44486c4

Please sign in to comment.