|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectpl.gda.pg.eti.ask.przemyslawbielicki.aeh.translation.ExceptionTranslation
ExceptionTranslation
contains translation list for concrete exceptionClass_
in Vector
messages_
.
ExceptionTranslation
contains methods that enable retrieving existing translations
from database by finder
methods. It also contains methods that enable adding new
translations to XML database.
ExceptionTranslation
can be converted to XML element Element
by
getElement(DocumentImpl)
method.
Field Summary | |
private String |
exceptionClass_
Exception class name |
private HashMap |
messages_
List of concrete exception messages_ translations |
Constructor Summary | |
ExceptionTranslation()
|
Method Summary | |
void |
addMessage(MessageTranslation message)
Adds new message translation to database. |
MessageTranslation |
findByLikeMessage(String message)
Finds message translation with given message. |
MessageTranslation |
findByMessage(String message)
Finds message translation with given message. |
ElementImpl |
getElement(DocumentImpl document)
Retrieves XML element for current exception translation subtree. |
String |
getExceptionClass()
Getter method for exception class name |
void |
setExceptionClass(String string)
Setter method for exception class name |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private String exceptionClass_
private HashMap messages_
MessageTranslation
Constructor Detail |
public ExceptionTranslation()
Method Detail |
public ElementImpl getElement(DocumentImpl document)
document
- parent document to add current element to
public String getExceptionClass()
public void setExceptionClass(String string)
string
- exception class namepublic void addMessage(MessageTranslation message) throws DuplicateMessageException
DuplicateMessageException
is thrown.
message
- message translation to add to database
DuplicateMessageException
- is thrown during the attempt to add message translation
that already exists in databasefindByMessage(String)
,
findByLikeMessage(String)
public MessageTranslation findByMessage(String message) throws TranslationNotFoundException
String.equals(java.lang.Object)
.
For example: user is looking for exception that message is Unable to add user
.
There are two exception messages_ for this class in XML database. First of them has exception message
as follows: Unable to add user to database
and the second one has exception
message: Unable to add user
. This method will retrieve second message translation.
See findByLikeMessage(String)
for other example.
message
- to find the message translation with
TranslationNotFoundException
- is thrown if there is no such message translation
in databasepublic MessageTranslation findByLikeMessage(String message) throws TranslationNotFoundException
String.indexOf(java.lang.String)
Note that this method
will retrieve the first found message translation that message fit to message
.
For example: user is looking for exception that message is Unable to add user
.
There are two exception messages_ for this class in XML database. First of them has exception message
as follows: Unable to add user to database
and the second one has exception
message: Unable to add user
. This method will retrieve second message translation.
Read careful this example: user is looking for exception that message is Unable to add
user to database
. Like in first example there are two exception messages_ for this class
in XML database. First of them has exception message as follows: Unable to add user
(note that order has changed) and the second one has exception message: Unable to
add user to database
. This method will retrieve the first message translation instead of
second message is more like searching message
.
message
- to find the message translation with
TranslationNotFoundException
- is thrown if there is no such message translation
in database
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |