org.apache.empire.commons
Class ErrorType

java.lang.Object
  extended by org.apache.empire.commons.ErrorType
All Implemented Interfaces:
Serializable

public class ErrorType
extends Object
implements Serializable

The ErrorType class defines a type of error. In order to define an error you need to provide an ErrorKey and a MessagePattern.

The ErrorKey is a unique identifier for the error that may also be used as a translation key The ErrorKey should always start with the "error." prefix.

The MessagePattern is a template containing the error message and placeholders for additional parameters. The MessagePattern must be formated according to the MessageFormat rules.

See Also:
Serialized Form

Constructor Summary
ErrorType(String errorKey, String msgPattern)
          Defines an error type.
 
Method Summary
 String getKey()
          Returns the error type key (might be used for internationalization).
 String getMessagePattern()
          Returns the message pattern.
 int getNumParams()
          Returns the number of parameters required for the message pattern.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ErrorType

public ErrorType(String errorKey,
                 String msgPattern)
Defines an error type.

Parameters:
errorKey - the error key string (can be used for internationalization)
msgPattern - message pattern in english language used e.g. for logging
Method Detail

getKey

public String getKey()
Returns the error type key (might be used for internationalization).

Returns:
the error type key

getMessagePattern

public String getMessagePattern()
Returns the message pattern.

Returns:
the message pattern

getNumParams

public int getNumParams()
Returns the number of parameters required for the message pattern.

Returns:
the number of parameters required for the message pattern


Copyright © 2008-2012 Apache Software Foundation. All Rights Reserved.