* type will be used for each element if no tag is found. */
public void setPropertyElementType (Class type, String propertyName, Class elementType) {
if (type == null) throw new IllegalArgumentException("type cannot be null.");
if (propertyName == null) throw new IllegalArgumentException("propertyName cannot be null.");
if (elementType == null) throw new IllegalArgumentException("propertyType cannot be null.");
Property property = null;
Exception cause = null;
try {
property = Beans.getProperty(type, propertyName, beanProperties, privateFields, this);
} catch (IntrospectionException ex) {
cause = ex;
}
if (property == null) {
throw new IllegalArgumentException("The class " + type.getName() + " does not have a property named: " + propertyName,
cause);
}
if (!Collection.class.isAssignableFrom(property.getType()) && !Map.class.isAssignableFrom(property.getType()))
throw new IllegalArgumentException("The '" + propertyName + "' property on the " + type.getName()
+ " class must be a Collection or Map: " + property.getType());
propertyToElementType.put(property, elementType);
}