* @param entityClass
* @return Set of bk definitions or <code>null</code> if no business keys are
* defined for the given entity class.
*/
private static <E extends IEntity> Set<IBusinessKeyDefinition<E>> discoverBusinessKeys(Class<E> entityClass) {
BusinessObject bo = entityClass.getAnnotation(BusinessObject.class);
if(bo == null) {
// try the root entity
bo = EntityUtil.getRootEntityClass(entityClass).getAnnotation(BusinessObject.class);
}
if(bo == null) {
// no bks defined
return null;
}
final Set<IBusinessKeyDefinition<E>> set = new HashSet<IBusinessKeyDefinition<E>>();
for(final BusinessKeyDef def : bo.businessKeys()) {
set.add(new BusinessKeyDefinition<E>(entityClass, def.name(), def.properties()));
}
return set;
}