xdoclet.modules.mockobjects
Class MockObjectTagsHandler

java.lang.Object
  extended byxdoclet.template.TemplateTagHandler
      extended byxdoclet.XDocletTagSupport
          extended byxdoclet.tagshandler.AbstractProgramElementTagsHandler
              extended byxdoclet.tagshandler.ParameterTagsHandler
                  extended byxdoclet.modules.mockobjects.MockObjectTagsHandler

public class MockObjectTagsHandler
extends ParameterTagsHandler

Tagshandler for mockobject.

Author:
Joe Walnes, Stig Jørgensen
xdoclet.taghandler
namespace = "MockObject"
created
5. februar 2003

Field Summary
 
Fields inherited from class xdoclet.tagshandler.ParameterTagsHandler
currentMethodParameter, currentMethodParamTag, 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
 
Constructor Summary
MockObjectTagsHandler()
           
 
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(xjavadoc.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, forAllMembers, forAllMemberTags, forAllMemberTagTokens, getAllClasses, getClassNameFor, getFullClassNameFor, getFullSuperclassNameFor, getIndentChars, getXExecutableMemberForMemberName, getXExecutableMemberForMemberName, hasExecutableMember_OLD, hasExecutableMember, 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MockObjectTagsHandler

public MockObjectTagsHandler()
Method Detail

getMockClassFor

public static String getMockClassFor(xjavadoc.XClass clazz)
                              throws 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:
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

parameterTypeList

public String parameterTypeList(Properties attributes)
                         throws 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:
XDocletException

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.

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.

mockClass

public String mockClass()
                 throws XDocletException
Returns the mock classname for the current class.

Returns:
String the fully classified name of the mock class.
Throws:
XDocletException
See Also:
getMockClassFor(XClass)

uniqueMethodName

public String uniqueMethodName(Properties attributes)
                        throws 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:
XDocletException - not thrown.

uniqueMethodNameAndParam

public String uniqueMethodNameAndParam(Properties attributes)
                                throws 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:
XDocletException - not thrown.

forAllExceptions

public void forAllExceptions(String template,
                             Properties attributes)
                      throws 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:
XDocletException - not thrown by our code; might be thrown from generate.

currentException

public String currentException(Properties attributes)
                        throws XDocletException
Returns the current exception.

Parameters:
attributes - the parameters for the tag; not used.
Returns:
Throws:
XDocletException - not thrown by our code; might be thrown from getCurrentClass.

ifThrowsException

public void ifThrowsException(String template,
                              Properties attributes)
                       throws 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:
XDocletException - not thrown by our code; might be thrown from generate.

getTagParam

protected String getTagParam(String tagName,
                             String paramName,
                             String defaultValue)
                      throws XDocletException
Throws:
XDocletException

http://xdoclet.sourceforge.net/