*/
private boolean verifyTimeout(Field field, Class<?> fsm)
{
// Timeouts must be integers
if (field.getType() != int.class) {
throw new FsmException("Timeout field " + field.getName()
+ "-Timeouts must be of type int");
//return false;
}
// Action name must correspond to an action method
// TODO: relax this to allow it to be a non-action void method?
// Or allow the @Action to have a 'timeout-only' flag?
String actionName = field.getAnnotation(Timeout.class).value();
for (Method method : fsm.getMethods()) {
if (method.isAnnotationPresent(Action.class)) {
if (method.getName().equals(actionName)) {
return true;
}
}
}
// no corresponding action
throw new FsmException("Timeout: " + field.getName()
+ "-No corresponding action was found");
//return false;
}