org.objectweb.fractal.adl.error
Interface ErrorTemplate

All Known Implementing Classes:
ADLErrors, ArgumentErrors, AttributeErrors, BindingErrors, ComponentErrors, GenericErrors, ImplementationErrors, InterfaceErrors, TypeErrors, XMLErrors

public interface ErrorTemplate

An error template defines a type of error that can be reported by the FractalADL tool-chain. It is identified by a groupId which identifies a group of related error types and a errorId which must be unique in a given group. An error template contains a #getFormat() string that defines the message to be issued for the type of error. This string is a "printf like" string as defined in the Formatter class.
It is recommended to implement this interface only in enumeration classes that regroup every ErrorTemplate of the same group (see package description for details)


Method Summary
 int getErrorId()
          Returns the number that identify this ErrorTemplate in its group.
 java.lang.String getFormat()
          Returns the format of the error message that will be issued for errors of that type.
 java.lang.String getFormatedMessage(java.lang.Object... args)
          Returns a formated error message using the given arguments.
 java.lang.String getGroupId()
          Returns the identifier of the error group this ErrorTemplate belongs.
 

Method Detail

getErrorId

int getErrorId()
Returns the number that identify this ErrorTemplate in its group. This number must be unique in the error group this ErrorTemplate belongs. It is recommended for this identifier not to be greater that 999.

Returns:
the number that identify this ErrorTemplate in its group.

getGroupId

java.lang.String getGroupId()
Returns the identifier of the error group this ErrorTemplate belongs. It is recommended for this identifier string to be upper case and as short as possible ( AC, BC for instance) since it will be issued in the error message as a prefix.

Returns:
the identifier of the error group this ErrorTemplate belongs.

getFormat

java.lang.String getFormat()
Returns the format of the error message that will be issued for errors of that type. This string is a "printf like" string as defined in the Formatter class.

Returns:
the format of the error message that will be issued for errors of that type

getFormatedMessage

java.lang.String getFormatedMessage(java.lang.Object... args)
Returns a formated error message using the given arguments.

Parameters:
args - the format arguments.
Returns:
a formated error message.
See Also:
String.format(String, Object...)


Copyright © 2001-2010 ObjectWeb Consortium. All Rights Reserved.