|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectua.in.hutorny.util.CommentRetriever
public class CommentRetriever
CommentRetriever - this class implements reading the content of the comments
embraced with /*-- and --*/.
All job is done in a single method retrieve.
Other public methods facilitates setting/clearing options (
setOption, setOptions,
clrOption, clrOptions),
changing patterns ( setStopperPattern,
setContentPattern, setDiscriminatorPattern),
and changing values to return in different cases ( setBlankValue,
setErrorValue, setMessagePrefix ).
| Nested Class Summary | |
|---|---|
static class |
CommentRetriever.BlankContentException
|
static class |
CommentRetriever.FileReadException
|
static class |
CommentRetriever.HeaderIsNotBlankException
|
static class |
CommentRetriever.NoMatchException
|
static class |
CommentRetriever.NoStopperException
|
static class |
CommentRetriever.Option
A set of options to opt CommentRetriever behavior - (
THROWERRORS,
RETURNERRORS,
VOIDERRORS,
BLANKISERROR,
NODEFAULTS,
TRIMRESULT ) |
static class |
CommentRetriever.RetrieverException
Descendants of this RetrieverException is thrown when and error occurs and option THROWERRORS is set It extends RuntimeException to avoid try ... catch blocks in the static initializers |
| Constructor Summary | |
|---|---|
CommentRetriever()
Constructs CommentRetriever with default options ( RETURNERRORS ) |
|
CommentRetriever(CommentRetriever.Option[] options)
Constructs CommentRetriever with provided options |
|
| Method Summary | |
|---|---|
void |
clrOption(CommentRetriever.Option opt)
Clears option opt. |
void |
clrOptions(CommentRetriever.Option[] options)
Clears all options passed via array using setOption |
java.lang.String |
getBlankValue()
|
java.lang.String |
getContentPattern()
|
java.lang.String |
getDiscriminatorPattern()
|
java.lang.String |
getErrorValue()
|
java.util.logging.Logger |
getLogger()
|
java.lang.String |
getMessagePrefix()
|
java.lang.String |
getStopperPattern()
|
boolean |
hasOption(CommentRetriever.Option opt)
Returns true if queried option is set |
java.lang.String |
retrieve(java.lang.String discriminator,
java.lang.String file,
java.lang.String clazz,
int line)
This method reads the source file from the specified line until the line read contains the stopper pattern --*/. |
void |
setBlankValue(java.lang.String blankValue)
Blank value is returned when there is no other content to return and BLANKISERROR is not set |
void |
setContentPattern(java.lang.String contentPattern)
Sets the content pattern. |
void |
setDiscriminatorPattern(java.lang.String discriminatorPattern)
Sets the discriminator pattern. |
void |
setErrorValue(java.lang.String errorValue)
ErrorValue is returned when option VOIDERRORS is set and an error occured |
void |
setLogger(java.util.logging.Logger logger)
|
void |
setMessagePrefix(java.lang.String messagePrefix)
Message prefix is prepended to an error message if it is returned as the output value |
void |
setOption(CommentRetriever.Option opt)
Sets option opt. |
void |
setOptions(CommentRetriever.Option[] options)
Sets all options passed via array using setOption |
void |
setStopperPattern(java.lang.String stopperPattern)
Sets the stopper pattern. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public CommentRetriever()
RETURNERRORS )
public CommentRetriever(CommentRetriever.Option[] options)
options - see Option| Method Detail |
|---|
public java.lang.String retrieve(java.lang.String discriminator,
java.lang.String file,
java.lang.String clazz,
int line)
THROWERRORS, RETURNERRORS).
discriminator - -- a discriminator to look for, if equals("") default value returned, if is null, entire block is returnedfile - - file name to read comments fromline - - line number to start fromclazz - - reference to the class that possess resources.
CommentRetriever.RetrieverException
java.lang.RuntimeExceptionpublic void setOption(CommentRetriever.Option opt)
VOIDERRORS clears THROWERRORS and RETURNERRORS.
opt - public void clrOption(CommentRetriever.Option opt)
VOIDERRORS sets RETURNERRORS
opt - Optionpublic boolean hasOption(CommentRetriever.Option opt)
opt -
public void setMessagePrefix(java.lang.String messagePrefix)
messagePrefix - public java.lang.String getMessagePrefix()
public void setBlankValue(java.lang.String blankValue)
blankValue - public java.lang.String getBlankValue()
public void setErrorValue(java.lang.String errorValue)
VOIDERRORS is set and an error occured
errorValue - public java.lang.String getErrorValue()
public void setLogger(java.util.logging.Logger logger)
public java.util.logging.Logger getLogger()
public void setStopperPattern(java.lang.String stopperPattern)
stopperPattern -
PatternSyntaxException - see Pattern.compile
java.lang.IllegalArgumentException - see Pattern.compilepublic java.lang.String getStopperPattern()
public void setContentPattern(java.lang.String contentPattern)
contentPattern -
PatternSyntaxException - see Pattern.compile
java.lang.IllegalArgumentException - see Pattern.compilepublic java.lang.String getContentPattern()
public void setDiscriminatorPattern(java.lang.String discriminatorPattern)
discriminatorPattern -
PatternSyntaxException - see Pattern.compile
java.lang.IllegalArgumentException - see Pattern.compilepublic java.lang.String getDiscriminatorPattern()
public final void setOptions(CommentRetriever.Option[] options)
setOption
options - - array of options to setpublic final void clrOptions(CommentRetriever.Option[] options)
setOption
options - - array of options to set
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||