xdoclet.modules.mockobjects

Class MockObjectTagsHandler


public class MockObjectTagsHandler
extends xdoclet.tagshandler.ParameterTagsHandler

Tagshandler for mockobject.
Authors:
Joe Walnes
Stig Jørgensen
xdoclet.taghandler
namespace = "MockObject"
created
5. februar 2003

Field Summary

Fields inherited from class xdoclet.tagshandler.ParameterTagsHandler

currentMethodParamTag, currentMethodParameter, currentName

Fields inherited from class xdoclet.tagshandler.AbstractProgramElementTagsHandler

currentToken, matchPattern, tagTokenizer

Fields inherited from class xdoclet.XDocletTagSupport

FOR_CLASS, FOR_CONSTRUCTOR, FOR_FIELD, FOR_METHOD, PARAMETER_DELIMITER

Method Summary

String
currentException(Properties attributes)
Returns the current exception.
void
forAllExceptions(String template, Properties attributes)
Iterates over all the exceptions for the current method.
static String
getMockClassFor(XClass clazz)
Returns the fully classified name of the mock class from the specified class.
protected static String
getMockClassPattern()
Returns the pattern to be used for deciding the name of the class to be generated.
protected String
getTagParam(String tagName, String paramName, String defaultValue)
void
ifThrowsException(String template, Properties attributes)
Processes the text inside the tag if an exception is thrown by the current exception.
String
mockClass()
Returns the mock classname for the current class.
String
parameterTypeList(Properties attributes)
Iterates over all parameters in current method and returns a string containing the types of all those parameters.
String
uniqueMethodName(Properties attributes)
Returns a String with the current method using the supplied template as a boilerplate.
String
uniqueMethodNameAndParam(Properties attributes)
Returns a String with the current method concat with the param types using the supplied template as a boilerplate.
String
unwrap(Properties props)
Tag for unwrapping a simple type out of its object counterpart.
String
wrap(Properties props)
Tag for wrapping a simple type in its object counterpart.

Methods inherited from class xdoclet.tagshandler.ParameterTagsHandler

currentName, forAllConstructorParams, forAllMethodParams, forAllParameterTypes, getMethodParamTypeFor, ifHasParams, methodParamDescription, methodParamName, methodParamType, parameterList

Methods inherited from class xdoclet.tagshandler.AbstractProgramElementTagsHandler

checkForWrap, currentToken, exceptionList, firstSentenceDescriptionOfCurrentMember, forAllMemberTagTokens, forAllMemberTags, forAllMembers, getAllClasses, getClassNameFor, getFullClassNameFor, getFullSuperclassNameFor, getIndentChars, getXExecutableMemberForMemberName, getXExecutableMemberForMemberName, hasExecutableMember, hasExecutableMember_OLD, makeCopyOfArray, matchValue, memberComment, setMatchValue, skipToken

Methods inherited from class xdoclet.XDocletTagSupport

delimit, expandClassName, generate, getCurrentClass, getCurrentClassTag, getCurrentConstructor, getCurrentField, getCurrentFieldTag, getCurrentMethod, getCurrentMethodTag, getCurrentPackage, getDocletContext, getEngine, getExpandedDelimitedTagValue, getTagValue, getTagValue, getTagValue, hasHavingClassTag, hasTag, isTagValueEqual, mandatoryParamNotFound, mandatoryTemplateTagParamNotFound, modifiers, popCurrentClass, pushCurrentClass, setCurrentClass, setCurrentClassTag, setCurrentConstructor, setCurrentField, setCurrentFieldTag, setCurrentMethod, setCurrentMethodTag, setCurrentPackage

Methods inherited from class xdoclet.template.TemplateTagHandler

getXJavaDoc, setXJavaDoc

Method Details

currentException

public String currentException(Properties attributes)
            throws xdoclet.XDocletException
Returns the current exception.
Parameters:
attributes - the parameters for the tag; not used.
Returns:
Throws:
xdoclet.XDocletException - not thrown by our code; might be thrown from getCurrentClass.

forAllExceptions

public void forAllExceptions(String template,
                             Properties attributes)
            throws xdoclet.XDocletException
Iterates over all the exceptions for the current method.
Parameters:
template - the text inside the tag that should be processed.
attributes - the parameters for the tag; not used.
Throws:
xdoclet.XDocletException - not thrown by our code; might be thrown from generate.

getMockClassFor

public static String getMockClassFor(XClass clazz)
            throws xdoclet.XDocletException
Returns the fully classified name of the mock class from the specified class. It will do package substition (if it is specified) and use the class pattern specified to generate the class name.
Parameters:
clazz - the class to generate a mock classname for.
Returns:
String the fully classified name of the mock class.
Throws:
xdoclet.XDocletException -

getMockClassPattern

protected static String getMockClassPattern()
Returns the pattern to be used for deciding the name of the class to be generated. This is retrieved from the MockObjectSubTask instance.
Returns:
String The pattern to be used for deciding the name of the class to be generated

getTagParam

protected String getTagParam(String tagName,
                             String paramName,
                             String defaultValue)
            throws xdoclet.XDocletException

ifThrowsException

public void ifThrowsException(String template,
                              Properties attributes)
            throws xdoclet.XDocletException
Processes the text inside the tag if an exception is thrown by the current exception.
Parameters:
template - the text inside the tag that should be processed.
attributes - the parameters for the tag; not used.
Throws:
xdoclet.XDocletException - not thrown by our code; might be thrown from generate.

mockClass

public String mockClass()
            throws xdoclet.XDocletException
Returns the mock classname for the current class.
Returns:
String the fully classified name of the mock class.
Throws:
xdoclet.XDocletException -

parameterTypeList

public String parameterTypeList(Properties attributes)
            throws xdoclet.XDocletException
Iterates over all parameters in current method and returns a string containing the types of all those parameters.
Parameters:
attributes - The attributes of the template tag
Returns:
a string containing the types of all the parameters for the current method.
Throws:
xdoclet.XDocletException -

uniqueMethodName

public String uniqueMethodName(Properties attributes)
            throws xdoclet.XDocletException
Returns a String with the current method using the supplied template as a boilerplate.
Parameters:
attributes - holds the parameters for the tag: template
Returns:
String the current method concat with the param types using the supplied template as a boilerplate.
Throws:
xdoclet.XDocletException - not thrown.

uniqueMethodNameAndParam

public String uniqueMethodNameAndParam(Properties attributes)
            throws xdoclet.XDocletException
Returns a String with the current method concat with the param types using the supplied template as a boilerplate.
Parameters:
attributes - holds the parameters for the tag: template
Returns:
String the current method concat with the param types using the supplied template as a boilerplate.
Throws:
xdoclet.XDocletException - not thrown.

unwrap

public String unwrap(Properties props)
Tag for unwrapping a simple type out of its object counterpart.
Parameters:
props - holds the parameters for the tag: name & type
Returns:
code for unwrapping a simple type out of its object counterpart.

wrap

public String wrap(Properties props)
Tag for wrapping a simple type in its object counterpart.
Parameters:
props - holds the parameters for the tag: name & type
Returns:
code for wrapping a simple type in its object counterpart.