From 7558594ded5fde27f83f51332023bd822d442ea8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emmanuel=20Beno=C3=AEt?= Date: Thu, 17 Sep 2015 09:18:41 +0200 Subject: [PATCH] Lifecycle stage enum describes exception types --- .../info/ebenoit/ebul/cmp/LifecycleStage.java | 23 +++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/src/main/java/info/ebenoit/ebul/cmp/LifecycleStage.java b/src/main/java/info/ebenoit/ebul/cmp/LifecycleStage.java index 8e9ffd2..430d7d9 100644 --- a/src/main/java/info/ebenoit/ebul/cmp/LifecycleStage.java +++ b/src/main/java/info/ebenoit/ebul/cmp/LifecycleStage.java @@ -9,12 +9,27 @@ package info.ebenoit.ebul.cmp; public enum LifecycleStage { /** Initialisation stage */ - INITIALISE , + INITIALISE( ComponentInitialisationException.class ) , /** Startup stage */ - START , + START( ComponentStartupException.class ) , /** Shutdown stage */ - STOP , + STOP( ComponentShutdownException.class ) , /** Destruction stage */ - DESTROY + DESTROY( ComponentDestructionException.class ); + + /** The type of exceptions thrown by this lifecycle stage action */ + public final Class< ? extends ComponentLifecycleException > exceptionType; + + + /** + * Sets the type of exceptions for the lifecycle stage + * + * @param exceptionType + * the type of exceptions + */ + private LifecycleStage( Class< ? extends ComponentLifecycleException > exceptionType ) + { + this.exceptionType = exceptionType; + } }