xjavadoc

Class DefaultXTag

Implemented Interfaces:
XTag

public class DefaultXTag
extends java.lang.Object
implements XTag

Author:
Aslak Helles?y

Field Summary

private List
_attributeNames
Ordered List of attribute names
private Map
_attributes
attribute map
private XDoc
_doc
private int
_hash
private boolean
_isDirty
indicate dirty state
private boolean
_isParsed
tag parse status
private int
_lineNumber
private String
_name
tag name
private Set
_tagListeners
tag listeners interested in changes.
private String
_value
string representation of tag
private XJavaDoc
_xJavaDoc
static int
instanceCount

Constructor Summary

DefaultXTag()

Method Summary

void
addTagListener(XTagListener tagListener)
add doc listener interested in chages
private void
ensureTagListenersInitialised()
boolean
equals(Object o)
protected void
fail(String message)
Utility method that should be called from validate() in case ov a validation failure.
private void
fireTagChanged()
fire tagChanged event
Collection
getAttributeNames()
Returns all tag parameters with the given name, or an empty List if none exist;
String
getAttributeValue(String attributeName)
Returns the first tag parameter with the given name, or null if none exist;
XDoc
getDoc()
String
getInfo()
int
getLineNumber()
String
getName()
Returns the full name of the tag, excluding the @
String
getValue()
Returns the full value of the tag.
int
hashCode()
(package private) void
init(String name, String value, XDoc doc, int lineNumber)
Sets the name and value.
private void
parse()
Given the raw javadoc tag content as the value parameter parses it and sets the parameter.
String
removeAttribute(String attributeName)
Removes an attribute
void
removeTagListener(XTagListener tagListener)
remove doc listener
private void
resetValue()
void
setAttribute(String attributeName, String attributeValue)
Adds a parameter
private void
setAttribute_Impl(String attributeName, String attributeValue)
private static int
skipWhitespace(String s, int i)
Skips whitespaces, starting from index i till the first non-whitespace character or end of s and returns the new index.
void
validate()
Validates the tag

Field Details

_attributeNames

private List _attributeNames
Ordered List of attribute names

_attributes

private Map _attributes
attribute map

_doc

private XDoc _doc

_hash

private int _hash

_isDirty

private boolean _isDirty
indicate dirty state

_isParsed

private boolean _isParsed
tag parse status

_lineNumber

private int _lineNumber

_name

private String _name
tag name

_tagListeners

private Set _tagListeners
tag listeners interested in changes. This would be parent xdoc

_value

private String _value
string representation of tag

_xJavaDoc

private XJavaDoc _xJavaDoc

instanceCount

public static int instanceCount

Constructor Details

DefaultXTag

public DefaultXTag()

Method Details

addTagListener

public final void addTagListener(XTagListener tagListener)
add doc listener interested in chages
Specified by:
addTagListener in interface XTag
Parameters:
tagListener - The feature to be added to the TagListener attribute

ensureTagListenersInitialised

private final void ensureTagListenersInitialised()

equals

public final boolean equals(Object o)
Specified by:
equals in interface XTag

fail

protected final void fail(String message)
            throws TagValidationException
Utility method that should be called from validate() in case ov a validation failure. Throws a new TagValidationException with
Parameters:
message - the message to include
Throws:
TagValidationException - always thrown.

fireTagChanged

private void fireTagChanged()
fire tagChanged event

getAttributeNames

public final Collection getAttributeNames()
Returns all tag parameters with the given name, or an empty List if none exist;
Specified by:
getAttributeNames in interface XTag
Returns:
The Parameters value

getAttributeValue

public final String getAttributeValue(String attributeName)
Returns the first tag parameter with the given name, or null if none exist;
Specified by:
getAttributeValue in interface XTag
Parameters:
attributeName - Describe what the parameter does
Returns:
The Parameter value

getDoc

public final XDoc getDoc()
Specified by:
getDoc in interface XTag

getInfo

public final String getInfo()
Specified by:
getInfo in interface XTag

getLineNumber

public final int getLineNumber()
Specified by:
getLineNumber in interface XTag

getName

public final String getName()
Returns the full name of the tag, excluding the @
Specified by:
getName in interface XTag
Returns:
tag name

getValue

public final String getValue()
Returns the full value of the tag.
Specified by:
getValue in interface XTag
Returns:
full value of the tag

hashCode

public final int hashCode()
Specified by:
hashCode in interface XTag

init

(package private) final void init(String name,
                                  String value,
                                  XDoc doc,
                                  int lineNumber)
Sets the name and value. Called immediately after initialisation by XTagFactory. Don't call this method from anywhere else.
Parameters:
name -
value -
doc -
lineNumber -

parse

private final void parse()
Given the raw javadoc tag content as the value parameter parses it and sets the parameter. If anything is malformed (not (foo="xxx")+), then nothing is set.

removeAttribute

public final String removeAttribute(String attributeName)
Removes an attribute
Specified by:
removeAttribute in interface XTag
Parameters:
attributeName - atribute to remove
Returns:
the removed attribute value or null if it didn't exist

removeTagListener

public final void removeTagListener(XTagListener tagListener)
remove doc listener
Specified by:
removeTagListener in interface XTag
Parameters:
tagListener -

resetValue

private final void resetValue()

setAttribute

public final void setAttribute(String attributeName,
                               String attributeValue)
Adds a parameter
Specified by:
setAttribute in interface XTag
Parameters:
attributeName - The new Attribute value
attributeValue - The new Attribute value

setAttribute_Impl

private final void setAttribute_Impl(String attributeName,
                                     String attributeValue)

skipWhitespace

private static int skipWhitespace(String s,
                                  int i)
Skips whitespaces, starting from index i till the first non-whitespace character or end of s and returns the new index.
Parameters:
s - Describe what the parameter does
i - Describe what the parameter does
Returns:
Describe the return value

validate

public void validate()
            throws TagValidationException
Validates the tag
Specified by:
validate in interface XTag