@Test(expectedExceptions = ControllerValidationException.class) public void testControllerCannotHaveMoreThanOnePreDestroy() throws ControllerValidationException{ controllerValidator.validate(ControllerWithMoreThanOnePreDestroy.class); }
public void validate(final Class<?> clazz) throws ControllerValidationException { Assert.requireNonNull(clazz, "Controller class"); if(!isClassAnnotatedWithDolhinController(clazz)){ throw new ControllerValidationException("Dolphin Controller " + clazz.getName() + " must be must be annotated with @RemotingController."); } if (isInterface(clazz)) { throw new ControllerValidationException("Dolphin Controller " + ControllerUtils.getControllerName(clazz) + " must be a class."); } if (isAbstract(clazz)) { throw new ControllerValidationException("Dolphin Controller " + ControllerUtils.getControllerName(clazz) + " can't be abstract."); } if (isFinal(clazz)) { throw new ControllerValidationException("Dolphin Controller " + ControllerUtils.getControllerName(clazz) + " can't be final."); } if (isMoreThanOnePostConstruct(clazz)) { throw new ControllerValidationException("Only one PostConstruct method is allowed in Controller " + ControllerUtils.getControllerName(clazz)); } if (isMoreThanOnePreDestroy(clazz)) { throw new ControllerValidationException("Only one PreDestroy method is allowed in Controller " + ControllerUtils.getControllerName(clazz)); } if (isMoreThanOneDolphinModel(clazz)) { throw new ControllerValidationException("Controller " + ControllerUtils.getControllerName(clazz) + " should not contain more than one RemotingModel."); } checkPreDestroyContainsParameter(clazz); checkPostConstructContainsParameter(clazz); checkDolphinActionVoid(clazz); checkDolphinActionAnnotatedWithParam(clazz); }
ControllerValidator { public void validate(final Class<?> clazz) throws ControllerValidationException { Assert.requireNonNull(clazz, "Controller class"); if(!isClassAnnotatedWithDolhinController(clazz)){ throw new ControllerValidationException("Dolphin Controller " + clazz.getName() + " must be must be annotated with @RemotingController."); } if (isInterface(clazz)) { throw new ControllerValidationException("Dolphin Controller " + ControllerUtils.getControllerName(clazz) + " must be a class."); } if (isAbstract(clazz)) { throw new ControllerValidationException("Dolphin Controller " + ControllerUtils.getControllerName(clazz) + " can't be abstract."); } if (isFinal(clazz)) { throw new ControllerValidationException("Dolphin Controller " + ControllerUtils.getControllerName(clazz) + " can't be final."); } if (isMoreThanOnePostConstruct(clazz)) { throw new ControllerValidationException("Only one PostConstruct method is allowed in Controller " + ControllerUtils.getControllerName(clazz)); } if (isMoreThanOnePreDestroy(clazz)) { throw new ControllerValidationException("Only one PreDestroy method is allowed in Controller " + ControllerUtils.getControllerName(clazz)); } if (isMoreThanOneDolphinModel(clazz)) { throw new ControllerValidationException("Controller " + ControllerUtils.getControllerName(clazz) + " should not contain more than one RemotingModel."); } checkPreDestroyContainsParameter(clazz); checkPostConstructContainsParameter(clazz); checkDolphinActionVoid(clazz); checkDolphinActionAnnotatedWithParam(clazz); } }
ControllerValidator { public void validate(final Class<?> clazz) throws ControllerValidationException { Assert.requireNonNull(clazz, "Controller class"); if(!isClassAnnotatedWithDolhinController(clazz)){ throw new ControllerValidationException("Dolphin Controller " + clazz.getName() + " must be must be annotated with @RemotingController."); } if (isInterface(clazz)) { throw new ControllerValidationException("Dolphin Controller " + ControllerUtils.getControllerName(clazz) + " must be a class."); } if (isAbstract(clazz)) { throw new ControllerValidationException("Dolphin Controller " + ControllerUtils.getControllerName(clazz) + " can't be abstract."); } if (isFinal(clazz)) { throw new ControllerValidationException("Dolphin Controller " + ControllerUtils.getControllerName(clazz) + " can't be final."); } if (isMoreThanOnePostConstruct(clazz)) { throw new ControllerValidationException("Only one PostConstruct method is allowed in Controller " + ControllerUtils.getControllerName(clazz)); } if (isMoreThanOnePreDestroy(clazz)) { throw new ControllerValidationException("Only one PreDestroy method is allowed in Controller " + ControllerUtils.getControllerName(clazz)); } if (isMoreThanOneDolphinModel(clazz)) { throw new ControllerValidationException("Controller " + ControllerUtils.getControllerName(clazz) + " should not contain more than one RemotingModel."); } checkPreDestroyContainsParameter(clazz); checkPostConstructContainsParameter(clazz); checkDolphinActionVoid(clazz); checkDolphinActionAnnotatedWithParam(clazz); }  }
ControllerValidator { public void validate(final Class<?> clazz) throws ControllerValidationException { Assert.requireNonNull(clazz, "Controller class"); if(!isClassAnnotatedWithDolhinController(clazz)){ throw new ControllerValidationException("Dolphin Controller " + clazz.getName() + " must be must be annotated with @RemotingController."); } if (isInterface(clazz)) { throw new ControllerValidationException("Dolphin Controller " + ControllerUtils.getControllerName(clazz) + " must be a class."); } if (isAbstract(clazz)) { throw new ControllerValidationException("Dolphin Controller " + ControllerUtils.getControllerName(clazz) + " can't be abstract."); } if (isFinal(clazz)) { throw new ControllerValidationException("Dolphin Controller " + ControllerUtils.getControllerName(clazz) + " can't be final."); } if (isMoreThanOnePostConstruct(clazz)) { throw new ControllerValidationException("Only one PostConstruct method is allowed in Controller " + ControllerUtils.getControllerName(clazz)); } if (isMoreThanOnePreDestroy(clazz)) { throw new ControllerValidationException("Only one PreDestroy method is allowed in Controller " + ControllerUtils.getControllerName(clazz)); } if (isMoreThanOneDolphinModel(clazz)) { throw new ControllerValidationException("Controller " + ControllerUtils.getControllerName(clazz) + " should not contain more than one RemotingModel."); } checkPreDestroyContainsParameter(clazz); checkPostConstructContainsParameter(clazz); checkDolphinActionVoid(clazz); checkDolphinActionAnnotatedWithParam(clazz); }  void validate(final Class<?> clazz); }
ControllerValidator { public void validate(final Class<?> clazz) throws ControllerValidationException { Assert.requireNonNull(clazz, "Controller class"); if(!isClassAnnotatedWithDolhinController(clazz)){ throw new ControllerValidationException("Dolphin Controller " + clazz.getName() + " must be must be annotated with @RemotingController."); } if (isInterface(clazz)) { throw new ControllerValidationException("Dolphin Controller " + ControllerUtils.getControllerName(clazz) + " must be a class."); } if (isAbstract(clazz)) { throw new ControllerValidationException("Dolphin Controller " + ControllerUtils.getControllerName(clazz) + " can't be abstract."); } if (isFinal(clazz)) { throw new ControllerValidationException("Dolphin Controller " + ControllerUtils.getControllerName(clazz) + " can't be final."); } if (isMoreThanOnePostConstruct(clazz)) { throw new ControllerValidationException("Only one PostConstruct method is allowed in Controller " + ControllerUtils.getControllerName(clazz)); } if (isMoreThanOnePreDestroy(clazz)) { throw new ControllerValidationException("Only one PreDestroy method is allowed in Controller " + ControllerUtils.getControllerName(clazz)); } if (isMoreThanOneDolphinModel(clazz)) { throw new ControllerValidationException("Controller " + ControllerUtils.getControllerName(clazz) + " should not contain more than one RemotingModel."); } checkPreDestroyContainsParameter(clazz); checkPostConstructContainsParameter(clazz); checkDolphinActionVoid(clazz); checkDolphinActionAnnotatedWithParam(clazz); }  void validate(final Class<?> clazz);  }