}
Object[] keyValues = new Object[numberOfFields];
// check the cardinality of the keys with the number of key fields
if (numberOfIdFields == 1) {
Class<?> keyType = idFieldHandlers[0].getType();
DomainFieldHandler fmd = idFieldHandlers[0];
checkKeyType(fmd.getName(), keyType, keys);
int keyFieldNumber = fmd.getFieldNumber();
keyValues[keyFieldNumber] = keys;
} else {
if (!(keys.getClass().isArray())) {
throw new ClusterJUserException(
local.message("ERR_Key_Must_Be_An_Object_Array",
numberOfIdFields));
}
Object[]keyObjects = (Object[])keys;
for (int i = 0; i < numberOfIdFields; ++i) {
DomainFieldHandler fmd = idFieldHandlers[i];
int index = fmd.getFieldNumber();
Object keyObject = keyObjects[i];
Class<?> keyType = fmd.getType();
checkKeyType(fmd.getName(), keyType, keyObject);
keyValues[index] = keyObjects[i];
}
}
return new KeyValueHandlerImpl(keyValues);
}