/**
* Throws an exception if the given property isn't set or of the wrong type.
*/
protected void checkProperty(Properties properties, String propertyId, Class<?> clazz) {
if (properties.getProperties() == null) {
throw new CmisInvalidArgumentException("Property " + propertyId + " must be set!");
}
PropertyData<?> property = properties.getProperties().get(propertyId);
if (property == null) {
throw new CmisInvalidArgumentException("Property " + propertyId + " must be set!");
}
Object value = property.getFirstValue();
if (value == null) {
throw new CmisInvalidArgumentException("Property " + propertyId + " must have a value!");
}
if (!clazz.isAssignableFrom(value.getClass())) {
throw new CmisInvalidArgumentException("Property " + propertyId + " has the wrong type!");
}
}