EMPTY_COMMENT
private static final String EMPTY_COMMENT
Default comment
NEWLINE
private static final String NEWLINE
Platform specific NEWLINE. Javadoc will use this as new line.
_commentText
private String _commentText
description of program element
_dirty
private boolean _dirty
_docListeners
private Set _docListeners
_firstSentence
private String _firstSentence
first sentence of comment text
_javadocToken
private Token _javadocToken
Token (which is linked in the AST) that holds the string representation of
the doc. Needed for printing out the class.
_tagMap
private Map _tagMap
Maps tag name to List. The Collection contains XTag instances whose name =
name (the map key). The tags in the Lists are ordered by occurrance
_tags
private List _tags
Contains all the tags in the doc, in order of occurrence.
instanceCount
public static int instanceCount
addDocListener
public void addDocListener(XDocListener docListener)
Add doc listener interested in changes.
docListener
- doc listener to register
addTag
public XTag addTag(String tagName,
String text)
Add a tag to the doc item.
tagName
- The name of the tag to addtext
- The value of the tag
addTag_Impl
private XTag addTag_Impl(String tagName,
String text,
int lineNumber)
throws TagValidationException
Creates and adds a tag
tagName
- The name of the tag (without the 'at')text
- The raw content of the taglineNumber
- The feature to be added to the Tag_Impl
attribute
- An instance of XTag, created by the
current XTagFactory
appendWhiteSpaces
private StringBuffer appendWhiteSpaces(StringBuffer sb)
Add some white space to the string being built up in toString().
sb
- StringBuffer that the text is being built in
dotted
public static String dotted(String tagName)
Convert a tag name from the old colon-separated form to the new preferred dot-separated form.
tagName
- The name of the tag
- Preferred form of the tag
ensureTagMapInitialised
private final void ensureTagMapInitialised()
fireDocChanged
private void fireDocChanged()
fire docChange event
getAllSuperDocs
private List getAllSuperDocs()
Returns the doc in all the superclasses. If the super element is null, or not from
source, an empty list is returned.
getCommentText
public String getCommentText()
return description of program element
- description of program element
getFirstSentence
public String getFirstSentence()
Return the first sentence of the text of the comment for this doc item.
getOwner
public XProgramElement getOwner()
Gets the Owner attribute of the XDoc object
getSuperDoc
private XDoc getSuperDoc()
Returns the doc in the superclass. If the super element is null, or not from
source, null is returned.
getTag
public XTag getTag(String tagName)
Get the first tag of name tagName from this doc. Superclasses are not searched.
tagName
- the name of the tag
getTag
public XTag getTag(String tagName,
boolean superclasses)
Get the first tag of name tagName.
tagName
- the name of the tag to get (without the 'at')superclasses
- if this is true, return tags from superclasses too.
- the first XTag with name equal to tagName
getTagAttributeValue
public String getTagAttributeValue(String tagName,
String attributeName)
Returns the tag attribute value. Does not look in superclasses. If nothing
is found, null is returned.
tagName
- The name of the tag to look for (without the 'at')attributeName
- The name of the attribute to look for within the tag.
- The value of the tag attribute.
getTagAttributeValue
public String getTagAttributeValue(String tagName,
String attributeName,
boolean superclasses)
Returns the tag attribute value. If superclasses is true, the first
occurrence is returned when walking up the class hierarchy. If nothing is
found, null is returned.
tagName
- The name of the tag to look for (without the 'at')attributeName
- The name of the attribute to look for within the tag.superclasses
- Set it to true to look in superclasses too.
- The value of the tag attribute.
getTags
public List getTags()
Returns all the tags in this doc (not superclasses). If No tags are found,
an empty Collection is returned.
getTags
public List getTags(String tagName)
Returns all the tags in this doc with the specified tagName (not
superclasses). If No tags are found, an empty Collection is returned.
tagName
- the name of the tags to return (without the 'at')
getTags
public List getTags(String tagName,
boolean superclasses)
Returns all the tags with the specified tagName. If No tags are found, an
empty Collection is returned.
tagName
- the name of the tags to return (without the 'at')superclasses
- if this is true, return tags from superclasses too.
getTags
public List getTags(boolean superclasses)
Returns all the tags. If no tags are found, an
empty List is returned.
superclasses
- if this is true, return tags from superclasses too.
hasTag
public boolean hasTag(String tagName)
Returns true if the tag exists. Does not look in superclasses.
tagName
- The name of the tag to look for (without the 'at')
hasTag
public boolean hasTag(String tagName,
boolean superclasses)
Returns true if the tag exists.
tagName
- The name of the tag to look for (without the 'at')superclasses
- If true, look in superclasses too.
parse
private void parse()
throws TagValidationException
Parse token into comments, tags and tag attributes. We remove excess spaces.
removeDocListener
public void removeDocListener(XDocListener docListener)
remove doc listener
removeTag
public boolean removeTag(XTag tag)
Removes tag. Note that XTag objects are compared by identity.
setCommentText
public void setCommentText(String commentText)
Set the text of the comment for this doc item.
commentText
- The new comment text
toString
public String toString()
Returns a String representation of this doc.
- a String representation of this doc.
tokenizeAndTrim
private static final String tokenizeAndTrim(String s)
updateTagValue
public XTag updateTagValue(String tagName,
String attributeName,
String attributeValue,
int tagIndex)
throws XJavaDocException
Utility method to set the value of a tag attribute. If the tag doesn't
exist, it is created. If the attribute doesn't exist it is created. If the
tag attribute exists, it is updated.
tagName
- The new name of the tag to update (without theattributeName
- The attribute nameattributeValue
- The new attribute valuetagIndex
- The index of the tag to update, in case there
are several tags with the same name.
updateToken
public void updateToken()
update token