xdoclet.tagshandler

Class PackageTagsHandler


public class PackageTagsHandler
extends AbstractProgramElementTagsHandler

Tags which manipulate package names and packages, including substitutions.

Version:
$Revision: 1.14 $

Author:
Ara Abrahamian (ara_e@email.com)

xdoclet.taghandler
namespace = "Package"

created
Oct 14, 2001

Nested Class Summary

static class
PackageTagsHandler.PackageSubstitution
It's good practice to put interfaces (such as remote/local interfaces, data objects and home interfaces) in a separate "interfaces" package rather than in the EJB bean implementation package.

Field Summary

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

void
forAllPackages(String template, Properties attributes)
Iterates over all packages loaded by XJavadoc.
static String
getPackageNameFor(String packageName)
Gets a package name with any subsitutions applied.
static String
getPackageNameFor(String packageName, boolean withSubstitution)
Apply package substitutions.
static String
getPackageNameFor(XPackage pak, boolean withSubstitution)
Gets the name of a package, optionally applying any substitutions.
static ArrayList
getPackageSubstitutions(String subtaskName)
Gets any PackageSubstitutions defined for a specified subtask.
String
packageName()
Returns the current package name.
String
packageNameAsPath()
Returns the current package name as a path.
static String
packageNameAsPathFor(String qualifiedName)
Returns a package name as a path, after applying any substitutions.
static String
packageNameAsPathFor(XPackage pak)
Returns a package name as a path, after applying any substitutions.
static String
packageNameAsPathWithoutSubstitutionFor(XPackage pak)
Returns a package name as a path, without applying any substitutions.
void
packageOf(String template)
Returns the not-full-qualified package name of the full-qualified class name specified in the body of this tag.
static String
replaceInline(String original, String oldOne, String newOne)
Replace the first occurrence of oldOne in original with newOne, or returns the original string if oldOne is not found.

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, 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

forAllPackages

public void forAllPackages(String template,
                           Properties attributes)
            throws XDocletException
Iterates over all packages loaded by XJavadoc. Subsequent calls to forAllClasses will only iterate over the classes in the current package.

Parameters:
template - The body of the block tag
attributes - The attributes of the template tag

Throws:
XDocletException - Description of Exception

doc.tag
type = "block"

doc.param
name = "abstract" optional = "true" values = "true,false" description = "If true then accept abstract classes also; otherwise don't."
name = "type" optional = "true" description = "For all classes by the type."
name = "extent" optional = "true" values = "concrete-type,superclass,hierarchy" description = "Specifies the extent of the type search. If concrete-type then only check the concrete type, if superclass then check also superclass, if hierarchy then search the whole hierarchy and find if the class is of the specified type. Default is hierarchy."


getPackageNameFor

public static String getPackageNameFor(String packageName)
Gets a package name with any subsitutions applied.

Parameters:
packageName - package name

Returns:
package name


getPackageNameFor

public static String getPackageNameFor(String packageName,
                                       boolean withSubstitution)
Apply package substitutions. If useFirst is true , the first occurrence of substituteWith will be replaced by packages , else the one of the direct container of the current class.

Parameters:
packageName - The (current) package name, on which substitution shall take place.
withSubstitution - true if package substitutions shall take place.

Returns:
The package name after substitutions.


getPackageNameFor

public static String getPackageNameFor(XPackage pak,
                                       boolean withSubstitution)
Gets the name of a package, optionally applying any substitutions.

Parameters:
pak - package
withSubstitution - whether to apply any substitutions

Returns:
package name


getPackageSubstitutions

public static ArrayList getPackageSubstitutions(String subtaskName)
Gets any PackageSubstitutions defined for a specified subtask.

Parameters:
subtaskName - subtask name

Returns:
ArrayList of substitutions


packageName

public String packageName()
            throws XDocletException
Returns the current package name. If we're in the context of a package iteration, this is the name of the current package. If we're in the context of a class iteration without a package iteration, return the name of the current class' package.

Returns:
current package name

Throws:
XDocletException - Description of Exception

doc.tag
type = "content"


packageNameAsPath

public String packageNameAsPath()
            throws XDocletException
Returns the current package name as a path.

Returns:
current package name as path

Throws:
XDocletException - Description of Exception

doc.tag
type = "content"


packageNameAsPathFor

public static String packageNameAsPathFor(String qualifiedName)
Returns a package name as a path, after applying any substitutions.

Parameters:
qualifiedName - package name

Returns:
package name as path

doc.tag
type = "content"


packageNameAsPathFor

public static String packageNameAsPathFor(XPackage pak)
Returns a package name as a path, after applying any substitutions.

Parameters:
pak - package

Returns:
package name as path

doc.tag
type = "content"


packageNameAsPathWithoutSubstitutionFor

public static String packageNameAsPathWithoutSubstitutionFor(XPackage pak)
Returns a package name as a path, without applying any substitutions.

Parameters:
pak - package

Returns:
package name as path

doc.tag
type = "content"


packageOf

public void packageOf(String template)
            throws XDocletException
Returns the not-full-qualified package name of the full-qualified class name specified in the body of this tag.

Parameters:
template - The body of the block tag

Throws:
XDocletException - Description of Exception

doc.tag
type = "block"


replaceInline

public static String replaceInline(String original,
                                   String oldOne,
                                   String newOne)
Replace the first occurrence of oldOne in original with newOne, or returns the original string if oldOne is not found.

Parameters:
original - String in which replacement should occour
oldOne - String to be replaced
newOne - String that replaces

Returns:
String original string with replacements