de.smartics.exceptions.core
Interface Code

Package class diagram package Code
All Superinterfaces:
Serializable
All Known Subinterfaces:
NumberCode
All Known Implementing Classes:
ConfigurationExceptionCode, NumberCodeInfo, ParseExceptionCode, RunningZerosNumberCodeInfo, TwoNumberCodeInfo

public interface Code
     
     
extends Serializable

This interface defines error and exception codes to identify exception classes.

It is intended that this interface is implemented by enumerations that define all or part of these codes for an application.

Since the implementing classes are used as members of exceptions they have to be serializable. Instances of implementing classes should also be immutable.


Method Summary
 String getCode()
          Returns the string representation of the code.
 String getComponentId()
          Returns the component identifier that raised an exception with this code.
 String getDisplayId()
          Returns the string representation of the code.
 String toString()
          Returns the string representation of the code.
 

Method Detail

getComponentId

String getComponentId()
Returns the component identifier that raised an exception with this code.

This number enables the system to separate the error codes of different sub systems.

Returns:
the component identifier.

getCode

String getCode()
Returns the string representation of the code.

This is the code within the component and lacks the component identifier. If the component is interested in the code, this identifier is used.

Returns:
the string representation of the code.

getDisplayId

String getDisplayId()
Returns the string representation of the code. This includes the component identifier and the code. If the code is presented (e.g. in a log file) the return value of this method is used.

This returns the same value as toString() as this method can be used via property getter.

Returns:
the string representation of the code.

toString

String toString()
Returns the string representation of the code. This includes the component identifier and the code. If the code is presented (e.g. in a log file) the return value of this method is used.

This returns the same value as getDisplayId() as this makes it easier to print the code in a String context (e.g. writing to a log file).

Overrides:
toString in class Object
Returns:
the string representation of the code.


Copyright © 2007-2013 Kronseder & Reiner GmbH - smartics. All Rights Reserved.