ua.in.hutorny.util
Class Comments

java.lang.Object
  extended by ua.in.hutorny.util.Comments

public class Comments
extends java.lang.Object

Comments - this class provides facilities for loading Java comments, see Comments.load for details

Author:
Eugene@hutorny.in.ua

Constructor Summary
Comments()
           
 
Method Summary
static CommentRetriever getRetriever()
           
static java.lang.String load()
           
static java.lang.String load(java.lang.String discriminator)
          String load();
/*-- <content> --*/
String load(String discriminator);
/*-- <content>
--:<discriminator>
<content>
--*/
These two methods read the source file (.java) from the line that follows load invocation until the line read contains the stopper pattern --*/.
static void setRetriever(CommentRetriever retriever)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Comments

public Comments()
Method Detail

load

public static java.lang.String load(java.lang.String discriminator)
String load();
/*-- <content> --*/
String load(String discriminator);
/*-- <content>
--:<discriminator>
<content>
--*/
These two methods read the source file (.java) from the line that follows load invocation until the line read contains the stopper pattern --*/.
Then all read content (the block) is matched against the block pattern and content between /*-- and --*/ is retrieved.
This content is then split by discriminating designators --:<discriminator>. The content before the first designator is treated as the default value.
The content between the current designator and the next designator (or the end of the block) is associated with <discriminator>.
If the discriminator parameter is null or blank, it returns the default value. Otherwise it parses the block and, as it goes, it tests equity of the current discriminator and the discriminator parameter.
When they are equal, associated content is returned.
N.B.: Any non-whitespace characters preceding /*-- are treated as an error and signaled according to the actual retriever options.

Parameters:
discriminator -
Returns:
content between /*-- and --*/ following the invocation point

load

public static java.lang.String load()
Returns:
content between /*-- and --*/ following the invocation point
See Also:
load(String)

setRetriever

public static void setRetriever(CommentRetriever retriever)

getRetriever

public static CommentRetriever getRetriever()