de.smartics.exceptions.code
Class NumberCodeInfo

Package class diagram package NumberCodeInfo
java.lang.Object
  extended by de.smartics.exceptions.code.NumberCodeInfo
All Implemented Interfaces:
NumberCode, Code, Serializable
Direct Known Subclasses:
TwoNumberCodeInfo

public class NumberCodeInfo
     
     
extends Object
implements NumberCode

This Code implementation models the exception code as a number. It supports a component identifier as an arbitrary string and provides a facility to specify the number as a major an minor number that will be added.

Author:
Robert Reiner
See Also:
Serialized Form

Field Summary
protected  String componentId
          The identifier of the component this code belongs to.
protected  Integer majorNumber
          The major number of the code defines a group of codes.
protected  Integer minorNumber
          The minor number gives additional information about the problem.
 
Constructor Summary
NumberCodeInfo(Integer majorNumber)
          Convenience constructor.
NumberCodeInfo(String componentId, Integer majorNumber)
          Convenience constructor.
NumberCodeInfo(String componentId, Integer majorNumber, Integer minorNumber)
          Default constructor.
 
Method Summary
 String getCode()
          Returns the string representation of the code.
 String getComponentId()
          Returns the identifier of the component this code belongs to.
 String getDisplayId()
          Returns the string representation of the code.
 Integer getMajorNumber()
          Returns the major number of the code defines a group of codes.
 Integer getMinorNumber()
          Returns the minor number gives additional information about the problem.
 String toString()
          Returns the string representation of the object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

componentId

protected final String componentId
The identifier of the component this code belongs to.


majorNumber

protected final Integer majorNumber
The major number of the code defines a group of codes. This group is associated with a certain type of problem within the component.

For example HTTP knows the major numbers 100, 200, 300, 400, etc.


minorNumber

protected final Integer minorNumber
The minor number gives additional information about the problem. It specifies exactly the type of problem. If this value is null, there is no minor number specified.

For example HTTP knows the minor number 4 for page not found. This will add with the major number to 404.

Constructor Detail

NumberCodeInfo

public NumberCodeInfo(Integer majorNumber)
Convenience constructor.

Parameters:
majorNumber - the major number of the code defines a group of codes.

NumberCodeInfo

public NumberCodeInfo(String componentId,
                      Integer majorNumber)
Convenience constructor.

Parameters:
componentId - the identifier of the component this code belongs to.
majorNumber - the major number of the code defines a group of codes.

NumberCodeInfo

public NumberCodeInfo(String componentId,
                      Integer majorNumber,
                      Integer minorNumber)
               throws NullPointerException
Default constructor.

Parameters:
componentId - the identifier of the component this code belongs to.
majorNumber - the major number of the code defines a group of codes.
minorNumber - the minor number gives additional information about the problem.
Throws:
NullPointerException - if the major number is null.
Method Detail

getComponentId

public String getComponentId()
Returns the identifier of the component this code belongs to.

Specified by:
getComponentId in interface Code
Returns:
the identifier of the component this code belongs to.

getMajorNumber

public Integer getMajorNumber()
Returns the major number of the code defines a group of codes. This group is associated with a certain type of problem within the component.

For example HTTP knows the major numbers 100, 200, 300, 400, etc.

Specified by:
getMajorNumber in interface NumberCode
Returns:
the major number of the code defines a group of codes.
See Also:
NumberCode.getMajorNumber()

getMinorNumber

public Integer getMinorNumber()
Returns the minor number gives additional information about the problem. It specifies exactly the type of problem. If this value is null, there is no minor number specified.

For example HTTP knows the minor number 4 for page not found. This will add with the major number to 404.

Specified by:
getMinorNumber in interface NumberCode
Returns:
the minor number gives additional information about the problem.
See Also:
NumberCode.getMinorNumber()

getDisplayId

public 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 Code.toString() as this method can be used via property getter..

Specified by:
getDisplayId in interface Code
Returns:
the string representation of the code.
See Also:
Code.getDisplayId()

getCode

public 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.

Specified by:
getCode in interface Code
Returns:
the string representation of the code.

toString

public String toString()
Returns the string representation of the object.

Specified by:
toString in interface Code
Overrides:
toString in class Object
Returns:
the string representation of the object.


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