// if it is a list, then ensure that all the types in list are valid and consistent
if (this.getTypedExprList().size() == 0)
throw new InvalidTypeException("Parameter " + this.getParamName() + " is assigned a collection with no values");
// Look at the type of the first item and then make sure the rest match that one
final GenericValue firstval = this.getTypedExprList().get(0);
final Class<? extends GenericValue> clazzToMatch = TypeSupport.getGenericExprType(firstval);
for (final GenericValue val : this.getTypedExprList()) {
final Class<? extends GenericValue> clazz = TypeSupport.getGenericExprType(val);
if (clazz == null)
throw new InvalidTypeException("Parameter " + this.getParamName()
+ " assigned a collection value with invalid type "
+ firstval.getClass().getSimpleName());
if (!clazz.equals(clazzToMatch))
throw new InvalidTypeException("Parameter " + this.getParamName()
+ " assigned a collection value with type "
+ firstval.getClass().getSimpleName()
+ " which is inconsistent with the type of the first element");
}
return clazzToMatch;
}