1 55 package org.apache.avalon.framework.component; 56 57 import org.apache.avalon.framework.CascadingException; 58 59 72 public class ComponentException 73 extends CascadingException 74 { 75 private final String m_key; 76 77 83 public ComponentException( final String key, 84 final String message, 85 final Throwable throwable ) 86 { 87 super( message, throwable ); 88 m_key = key; 89 } 90 91 98 public ComponentException( final String message, final Throwable throwable ) 99 { 100 this( null, message, throwable ); 101 } 102 103 109 public ComponentException( final String message ) 110 { 111 this( null, message, null ); 112 } 113 114 119 public ComponentException( final String key, final String message ) 120 { 121 this( key, message, null ); 122 } 123 124 129 public final String getKey() 130 { 131 return m_key; 132 } 133 134 140 public final String getRole() 141 { 142 return getKey(); 143 } 144 145 150 public String getMessage() 151 { 152 if( m_key == null ) 153 { 154 return super.getMessage(); 155 } 156 else 157 { 158 return super.getMessage() + " (key [" + m_key + "])"; 159 } 160 } 161 } 162 | Popular Tags |