User: dimc
Date: 02/04/04 05:48:11
Modified: core/src/xdoclet XDocletTagSupport.java
Log:
Fix for bug 523372 - ant property variables were not being dereferenced.
Also changes that I believe are due to <pretty />
Revision Changes Path
1.34 +511 -433 xdoclet/core/src/xdoclet/XDocletTagSupport.java
Index: XDocletTagSupport.java
===================================================================
RCS file: /cvsroot/xdoclet/xdoclet/core/src/xdoclet/XDocletTagSupport.java,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -w -r1.33 -r1.34
--- XDocletTagSupport.java 4 Apr 2002 01:03:08 -0000 1.33
+++ XDocletTagSupport.java 4 Apr 2002 13:48:10 -0000 1.34
@@ -22,6 +22,7 @@
import xjavadoc.XTag;
import org.apache.log4j.Category;
+import org.apache.tools.ant.ProjectHelper;
import xdoclet.template.TemplateEngine;
import xdoclet.template.TemplateTagHandler;
@@ -29,6 +30,7 @@
import xdoclet.util.Log;
import xdoclet.util.Translator;
import xdoclet.util.TypeConversionUtil;
+import xdoclet.tags.ConfigTagsHandler;
/**
* Derives from TemplateTagHandler and adds handy support methods for working
@@ -36,9 +38,10 @@
*
* @author Dmitri Colebatch ([EMAIL PROTECTED])
* @created October 12, 2001
- * @version $Revision: 1.33 $
+ * @version $Revision: 1.34 $
*/
-public abstract class XDocletTagSupport extends TemplateTagHandler {
+public abstract class XDocletTagSupport extends TemplateTagHandler
+{
/**
* @todo-javadoc Describe the field
*/
@@ -61,33 +64,73 @@
*/
protected final static String PARAMETER_DELIMITER = ",";
+ /**
+ * @return The current tag.
+ */
+ public static XTag getCurrentTag()
+ {
+ return getDocletContext().getActiveSubTask().getCurrentTag();
+ }
/**
- * Describe what the method does
+ * Provides the current method in the XDoclet build, or null if there is no
+ * current method.
*
- * @param for_type Describe what the parameter does
- * @return Describe the return value
- * @exception XDocletException Describe the exception
- * @todo-javadoc Write javadocs for method
- * @todo-javadoc Write javadocs for method parameter
- * @todo-javadoc Write javadocs for return value
- * @todo-javadoc Write javadocs for exception
+ * @return The CurrentMethod value
+ * @see #setCurrentMethod
*/
- protected String modifiers(int for_type) throws XDocletException {
- return getPrgElem(for_type).modifiers();
+ public static XMethod getCurrentMethod()
+ {
+ return getDocletContext().getActiveSubTask().getCurrentMethod();
}
+ /**
+ * Provides the current field in the XDoclet build, or null if there is no
+ * current field.
+ *
+ * @return The CurrentField value
+ * @see #setCurrentField
+ */
+ public static XField getCurrentField()
+ {
+ return getDocletContext().getActiveSubTask().getCurrentField();
+ }
/**
- * @param template_tag_name
- * @param param_name
- * @exception XDocletException
+ * Provides the current constructor in the XDoclet build, or null if there is
+ * no current constructor.
+ *
+ * @return The CurrentConstructor value
+ * @see #setCurrentConstructor
*/
- protected void mandatoryTemplateTagParamNotFound(String template_tag_name,
String param_name) throws XDocletException {
- throw new
XDocletException(Translator.getString("mandatory_tag_param_missing_template",
- new String[]{param_name, template_tag_name}));
+ public static XConstructor getCurrentConstructor()
+ {
+ return getDocletContext().getActiveSubTask().getCurrentConstructor();
}
+ /**
+ * Provides the current class in the XDoclet build, or null if there is no
+ * current class.
+ *
+ * @return The CurrentClass value
+ * @see #pushCurrentClass
+ * @see #popCurrentClass
+ */
+ public static XClass getCurrentClass()
+ {
+ return getDocletContext().getActiveSubTask().getCurrentClass();
+ }
+
+ /**
+ * Provides the current package in the XDoclet build, or null if there is no
+ * current package.
+ *
+ * @return The CurrentPackage value
+ */
+ public static XPackage getCurrentPackage()
+ {
+ return getDocletContext().getActiveSubTask().getCurrentPackage();
+ }
/**
* Set the current method.
@@ -95,22 +138,22 @@
* @param method The method to make the current method
* @see #getCurrentMethod
*/
- public static void setCurrentMethod(XMethod method) {
+ public static void setCurrentMethod( XMethod method )
+ {
getDocletContext().getActiveSubTask().setCurrentMethod(method);
}
-
/**
* Set the current constructor.
*
* @param constructor The constructor to make the current constructor
* @see #getCurrentConstructor
*/
- public static void setCurrentConstructor(XConstructor constructor) {
+ public static void setCurrentConstructor( XConstructor constructor )
+ {
getDocletContext().getActiveSubTask().setCurrentConstructor(constructor);
}
-
/**
* Sets current class to clazz by clearing currentClassStack stack and pushing
* clazz into top of it.
@@ -118,126 +161,61 @@
* @param clazz The new CurrentClass value
* @see #getCurrentClass()
*/
- public static void setCurrentClass(XClass clazz) {
+ public static void setCurrentClass( XClass clazz )
+ {
getDocletContext().getActiveSubTask().setCurrentClass(clazz);
}
-
/**
* Set the current package
*
* @param pakkage The new CurrentPackage value
* @see #getCurrentPackage
*/
- public static void setCurrentPackage(XPackage pakkage) {
+ public static void setCurrentPackage( XPackage pakkage )
+ {
getDocletContext().getActiveSubTask().setCurrentPackage(pakkage);
}
-
/**
* Sets the CurrentTag attribute of the XDocletTagSupport class
*
* @param currentTag The new CurrentTag value
*/
- public static void setCurrentTag(XTag currentTag) {
+ public static void setCurrentTag( XTag currentTag )
+ {
getDocletContext().getActiveSubTask().setCurrentTag(currentTag);
}
-
/**
* Set the current field.
*
* @param field The field to make the current field
* @see #getCurrentMethod
*/
- public static void setCurrentField(XField field) {
+ public static void setCurrentField( XField field )
+ {
getDocletContext().getActiveSubTask().setCurrentField(field);
}
-
- /**
- * @return The current tag.
- */
- public static XTag getCurrentTag() {
- return getDocletContext().getActiveSubTask().getCurrentTag();
- }
-
-
- /**
- * Provides the current method in the XDoclet build, or null if there is no
- * current method.
- *
- * @return The CurrentMethod value
- * @see #setCurrentMethod
- */
- public static XMethod getCurrentMethod() {
- return getDocletContext().getActiveSubTask().getCurrentMethod();
- }
-
-
- /**
- * Provides the current field in the XDoclet build, or null if there is no
- * current field.
- *
- * @return The CurrentField value
- * @see #setCurrentField
- */
- public static XField getCurrentField() {
- return getDocletContext().getActiveSubTask().getCurrentField();
- }
-
-
- /**
- * Provides the current constructor in the XDoclet build, or null if there is
- * no current constructor.
- *
- * @return The CurrentConstructor value
- * @see #setCurrentConstructor
- */
- public static XConstructor getCurrentConstructor() {
- return getDocletContext().getActiveSubTask().getCurrentConstructor();
- }
-
-
- /**
- * Provides the current class in the XDoclet build, or null if there is no
- * current class.
- *
- * @return The CurrentClass value
- * @see #pushCurrentClass
- * @see #popCurrentClass
- */
- public static XClass getCurrentClass() {
- return getDocletContext().getActiveSubTask().getCurrentClass();
- }
-
-
- /**
- * Provides the current package in the XDoclet build, or null if there is no
- * current package.
- *
- * @return The CurrentPackage value
- */
- public static XPackage getCurrentPackage() {
- return getDocletContext().getActiveSubTask().getCurrentPackage();
- }
-
-
/**
* Replaces <code>${xxx}</code> style constructions in the given value with the
* string value of the corresponding data types. NOTE: This method was taken
* directly from Ant's source code (org.apache.tools.ant.ProjectHelper) and
* modified slightly to use a Map instead of a HashMap.
*
- * @param value The string to be scanned for property references. May be
<code>null</code>
- * , in which case this method returns immediately with no effect.
+ * @param value The string to be scanned for property references. May be
+ * <code>null</code> , in which case this method returns immediately with
+ * no effect.
* @param keys Mapping (String to String) of property names to their values.
* Must not be <code>null</code>.
* @return the original string with the properties replaced, or
<code>null</code>
* if the original string is <code>null</code>.
*/
- public static String replaceProperties(String value, Map keys) {
- if (value == null) {
+ public static String replaceProperties( String value, Map keys )
+ {
+ if( value == null )
+ {
return null;
}
@@ -250,10 +228,12 @@
Iterator i = fragments.iterator();
Iterator j = propertyRefs.iterator();
- while (i.hasNext()) {
+ while( i.hasNext() )
+ {
String fragment = (String)i.next();
- if (fragment == null) {
+ if( fragment == null )
+ {
String propertyName = (String)j.next();
fragment = (keys.containsKey(propertyName)) ?
(String)keys.get(propertyName)
@@ -265,7 +245,6 @@
return sb.toString();
}
-
/**
* Parses a string containing <code>${xxx}</code> style property references
* into two lists. The first list is a collection of text fragments, while the
@@ -275,55 +254,87 @@
* (org.apache.tools.ant.ProjectHelper) with the BuildException throwing
* removed.
*
- * @todo move to some Util class. -Not DocletUtil, some more generic util
- * class. .
* @param value Text to parse. Must not be <code>null</code>.
* @param fragments List to add text fragments to. Must not be
<code>null</code>
* .
* @param propertyRefs List to add property names to. Must not be
<code>null</code>
+ * @todo move to some Util class. -Not DocletUtil, some more
+ * generic util class. .
*/
- public static void parsePropertyString(String value, List fragments, List
propertyRefs) {
+ public static void parsePropertyString( String value, List fragments, List
propertyRefs )
+ {
+ Category cat = Log.getCategory( XDocletTagSupport.class,
"parsePropertyString" );
+
int prev = 0;
int pos;
- while ((pos = value.indexOf("$", prev)) >= 0) {
- if (pos > 0) {
- fragments.add(value.substring(prev, pos));
+ if( cat.isDebugEnabled() )
+ cat.debug( "value=" + value );
+
+ while( ( pos = value.indexOf( "$", prev ) ) >= 0 )
+ {
+
+ if( cat.isDebugEnabled() )
+ cat.debug( "pos=" + pos + ", prev=" + prev );
+
+ if( pos > 0 )
+ {
+ String fragment = value.substring( prev, pos );
+
+ if( cat.isDebugEnabled() )
+ cat.debug( "adding fragment '" + fragment +
"'" );
+ fragments.add( fragment );
}
- if (pos == (value.length() - 1)) {
+ if( pos == ( value.length() - 1 ) )
+ {
+ if( cat.isDebugEnabled() )
+ cat.debug( "adding fragment '$'" );
fragments.add("$");
prev = pos + 1;
}
- else if (value.charAt(pos + 1) != '{') {
+ else if( value.charAt( pos + 1 ) != '{' )
+ {
fragments.add(value.substring(pos, pos + 1));
prev = pos + 1;
}
- else {
+ else
+ {
int endName = value.indexOf('}', pos);
- if (endName < 0) {
+ if( endName < 0 )
+ {
// In Ant this is a BuildException condition
as its an
// incomplete property reference. Here we'll
leave it
// in the output string
- fragments.add(value.substring(pos));
- return;
+ String fragment = value.substring( pos );
+
+ if( cat.isDebugEnabled() )
+ cat.debug( "adding fragment '" +
fragment + "'" );
+ fragments.add( fragment );
+ continue;
}
String propertyName = value.substring(pos + 2,
endName);
+ if( cat.isDebugEnabled() )
+ cat.debug( "adding NULL fragment" );
fragments.add(null);
propertyRefs.add(propertyName);
prev = endName + 1;
}
}
- if (prev < value.length()) {
- fragments.add(value.substring(prev));
+ if( prev < value.length() )
+ {
+ String fragment = value.substring( prev );
+
+ if( cat.isDebugEnabled() )
+ cat.debug( "adding fragment '" + fragment + "'" );
+ fragments.add( fragment );
}
}
-
/**
* Push the specified class to the top of the current class stack making it
* effectively the current class.
@@ -333,11 +344,11 @@
* @see #getCurrentClass
* @see #popCurrentClass
*/
- public static XClass pushCurrentClass(XClass clazz) {
+ public static XClass pushCurrentClass( XClass clazz )
+ {
return getDocletContext().getActiveSubTask().pushCurrentClass(clazz);
}
-
/**
* Pop the current class off the top of the class stack.
*
@@ -345,34 +356,35 @@
* @see #getCurrentClass
* @see #pushCurrentClass
*/
- public static XClass popCurrentClass() {
+ public static XClass popCurrentClass()
+ {
return getDocletContext().getActiveSubTask().popCurrentClass();
}
-
/**
* @return the context object casted to DocletContext
*/
- protected static DocletContext getDocletContext() {
+ protected static DocletContext getDocletContext()
+ {
return DocletContext.getInstance();
}
-
/**
* Return the Value of a tag specified in a Properties object. This method work
* on the currentTag object variable, matchs it against the XTag specified in
* the attributes Properties and returns the value of the specified tag.
*
* @param attributes The attributes of the template tag
- * @param for_type if FOR_CLASS, then a fifth property superclasses is
- * searched, if this is set to true, then the tag is also searched in all
- * superclasses of current class. If for_type is set to FOR_METHOD or
- * FOR_CONSTRUCTOR or FOR_FIELD, current method or field is searched for
- * the tag.
+ * @param for_type if FOR_CLASS, then a fifth property
+ * superclasses is searched, if this is set to true, then the tag is also
+ * searched in all superclasses of current class. If for_type is set to
+ * FOR_METHOD or FOR_CONSTRUCTOR or FOR_FIELD, current method or field is
+ * searched for the tag.
* @return The TagValue value
* @exception XDocletException Description of Exception
*/
- protected static String getTagValue(Properties attributes, int for_type)
throws XDocletException {
+ protected static String getTagValue( Properties attributes, int for_type )
throws XDocletException
+ {
String tag_name = attributes.getProperty("tagName");
String param_name = attributes.getProperty("paramName");
String valid_values = attributes.getProperty("values");
@@ -390,21 +402,26 @@
);
// Case of jboss:table-name "abc"
- if (tagValue == null) {
+ if( tagValue == null )
+ {
String paramNum = attributes.getProperty("paramNum");
- if (paramNum != null) {
+ if( paramNum != null )
+ {
XProgramElement prg_elem = getPrgElem(for_type);
XDoc doc = prg_elem.doc();
XTag tag = doc.tag(tag_name, superclasses);
- if (tag != null) {
+ if( tag != null )
+ {
tagValue = tag.value();
}
- if (tagValue != null && tagValue.trim().length() == 0)
{
+ if( tagValue != null && tagValue.trim().length() == 0 )
+ {
tagValue = null;
}
- if (tagValue != null && tagValue.startsWith("\"")) {
+ if( tagValue != null && tagValue.startsWith( "\"" ) )
+ {
tagValue = tagValue.substring(1,
tagValue.length() - 1);
}
}
@@ -415,7 +432,6 @@
return tagValue;
}
-
/**
* Gets the TagValue attribute of the XDocletTagSupport class
*
@@ -445,11 +461,13 @@
String default_value,
boolean superclasses,
boolean is_mandatory
- ) throws XDocletException {
+ ) throws XDocletException
+ {
XProgramElement prg_elem = getPrgElem(for_type);
- if (prg_elem == null) {
+ if( prg_elem == null )
+ {
return null;
}
@@ -466,10 +484,7 @@
);
}
-
/**
- * @todo (Aslak) maybe this method ought to be moved to xjavadoc.XDoc? Not a
- * big deal though.
* @param doc Describe what the parameter does
* @param tag_name Describe what the parameter does
* @param param_name Describe what the parameter does
@@ -479,6 +494,8 @@
* @param is_mandatory Describe what the parameter does
* @return The TagValue value
* @exception XDocletException Describe the exception
+ * @todo (Aslak) maybe this method ought to be moved to
+ * xjavadoc.XDoc? Not a big deal though.
* @todo-javadoc Write javadocs for method parameter
* @todo-javadoc Write javadocs for method parameter
* @todo-javadoc Write javadocs for method parameter
@@ -496,11 +513,13 @@
String default_value,
boolean superclasses,
boolean is_mandatory
- ) throws XDocletException {
+ ) throws XDocletException
+ {
// first try to get current tag
XTag tag = getCurrentTag();
- if (tag == null) {
+ if( tag == null )
+ {
// if there is no current tag, look in the doc
tag = doc.tag(tag_name, superclasses);
}
@@ -508,37 +527,48 @@
String value = null;
// check if we have a tag at all
- if (tag != null) {
- if (param_name == null) {
+ if( tag != null )
+ {
+ if( param_name == null )
+ {
// the value of the tag is requested
value = tag.value();
}
- else {
+ else
+ {
value = tag.attributeValue(param_name);
}
}
- if (value == null) {
+ if( value == null )
+ {
// nothing found in javadocs
- if (is_mandatory) {
+ if( is_mandatory )
+ {
// throws XDocletException
mandatoryParamNotFound(doc, param_name, tag_name);
}
- if (default_value != null) {
+ if( default_value != null )
+ {
return default_value;
}
- else {
+ else
+ {
return null;
}
}
- else {
+ else
+ {
// a value was found. perform sanity checks on valid values
- if (valid_values != null) {
+ if( valid_values != null )
+ {
// check if the value is among the valid values
StringTokenizer st = new StringTokenizer(valid_values,
",");
- while (st.hasMoreTokens()) {
- if (st.nextToken().equals(value)) {
+ while( st.hasMoreTokens() )
+ {
+ if( st.nextToken().equals( value ) )
+ {
return value;
}
}
@@ -548,7 +578,6 @@
return value;
}
-
/**
* A utility method used by ifMethodTagValueEquals/ifMethodTagValueNotEquals
* and ifClassTagValueEquals/ifClassTagValueNotEquals, return true if the value
@@ -560,11 +589,13 @@
* @exception XDocletException Description of Exception
* @todo-javadoc Write javadocs for method parameter
*/
- protected static boolean isTagValueEqual(Properties attributes, int for_type)
throws XDocletException {
+ protected static boolean isTagValueEqual( Properties attributes, int for_type
) throws XDocletException
+ {
// the value to check for
String value = attributes.getProperty("value");
- if (value == null) {
+ if( value == null )
+ {
throw new XDocletException("The value property is not
specified");
}
@@ -576,10 +607,12 @@
String tag_name = attributes.getProperty("tagName");
String param_name = attributes.getProperty("paramName");
- if (getCurrentTag() != null &&
getCurrentTag().name().equals(tag_name)) {
+ if( getCurrentTag() != null && getCurrentTag().name().equals( tag_name
) )
+ {
attribute_value = getCurrentTag().attributeValue(param_name);
}
- else {
+ else
+ {
attribute_value = getTagValue(attributes, for_type);
}
attribute_value = delimit(attribute_value, attributes);
@@ -587,7 +620,6 @@
return value.equals(attribute_value);
}
-
/**
* Throws an XDocletException exception to stop the build process. The
* exception has an informative message to help user find out the cause of the
@@ -599,40 +631,45 @@
* @exception XDocletException Description of Exception
* @todo-javadoc Write javadocs for method parameter
*/
- protected static void mandatoryParamNotFound(XDoc doc, String param_name,
String tag_name) throws XDocletException {
+ protected static void mandatoryParamNotFound( XDoc doc, String param_name,
String tag_name ) throws XDocletException
+ {
XProgramElement programElement = doc.getOwner();
- if (programElement instanceof XMethod) {
+ if( programElement instanceof XMethod )
+ {
XMethod method = (XMethod)programElement;
throw new
XDocletException(Translator.getString("mandatory_tag_param_missing_method",
new String[]{param_name, tag_name,
method.name(), method.containingClass().qualifiedName()}));
}
- else if (programElement instanceof XClass) {
+ else if( programElement instanceof XClass )
+ {
XClass clazz = (XClass)programElement;
throw new
XDocletException(Translator.getString("mandatory_tag_param_missing_class",
new String[]{param_name, tag_name,
clazz.qualifiedName()}));
}
- else if (programElement instanceof XConstructor) {
+ else if( programElement instanceof XConstructor )
+ {
XConstructor constructor = (XConstructor)programElement;
throw new
XDocletException(Translator.getString("mandatory_tag_param_missing_constructor",
new String[]{param_name, tag_name,
constructor.containingClass().qualifiedName()}));
}
- else if (programElement instanceof XField) {
+ else if( programElement instanceof XField )
+ {
XField field = (XField)programElement;
throw new
XDocletException(Translator.getString("mandatory_tag_param_missing_field",
new String[]{param_name, tag_name,
field.name(), field.containingClass().qualifiedName()}));
}
- else {
+ else
+ {
throw new
XDocletException(Translator.getString("bad_prgelemdoc_type",
new String[]{programElement.toString()}));
}
}
-
/**
* A utility method used by ifHasClassTag/ifDoesntHaveClassTag and
* ifHasMethodTag/ifDoesntHaveMethodTag, return true if at least one tag exists
@@ -643,43 +680,51 @@
* @return Description of the Returned Value
* @exception XDocletException Description of Exception
*/
- protected static boolean hasTag(Properties attributes, int for_type) throws
XDocletException {
+ protected static boolean hasTag( Properties attributes, int for_type ) throws
XDocletException
+ {
return getTagValue(attributes, for_type) != null;
}
-
/**
- * @todo fix the () equals test, it is not nice. Test : finder Home definition
- * on AccountBean
* @param attribute_value Describe what the parameter does
* @param attributes Describe what the parameter does
* @return Describe the return value
+ * @todo fix the () equals test, it is not nice. Test :
+ * finder Home definition on AccountBean
* @todo-javadoc Write javadocs for method parameter
* @todo-javadoc Write javadocs for method parameter
* @todo-javadoc Write javadocs for return value
*/
- protected static String delimit(String attribute_value, Properties attributes)
{
+ protected static String delimit( String attribute_value, Properties attributes
)
+ {
// Optional Parameter
String delim = attributes.getProperty("delimiter");
String tokenNumberStr = attributes.getProperty("tokenNumber");
int tokenNumber = 0;
- if (tokenNumberStr != null) {
+ if( tokenNumberStr != null )
+ {
tokenNumber = Integer.parseInt(tokenNumberStr);
}
- if (delim != null) {
- if (delim.equals("()") && attribute_value.indexOf(delim) !=
-1) {
+ if( delim != null )
+ {
+ if( delim.equals( "()" ) && attribute_value.indexOf( delim )
!= -1 )
+ {
attribute_value = null;
}
- else {
+ else
+ {
StringTokenizer st = new
StringTokenizer(attribute_value, delim);
String tok = null;
- for (int i = 0; i <= tokenNumber; i++) {
- if (st.hasMoreTokens()) {
+ for( int i = 0; i <= tokenNumber; i++ )
+ {
+ if( st.hasMoreTokens() )
+ {
tok = st.nextToken();
}
- else {
+ else
+ {
tok = null;
}
}
@@ -689,6 +734,20 @@
return attribute_value;
}
+ /**
+ * Replace properties in a string. Properties are in the form ${prop.name} and
+ * the replace properties are obtained from the DocletContext.
+ *
+ * @param value The string to check for properties.
+ * @return The value replaced with any property substitutions
+ */
+ protected static String dereferenceProperties( String value )
+ {
+ // check to see if the property has a value.
+ Map properties = DocletContext.getInstance().getProperties();
+
+ return replaceProperties( value, properties );
+ }
/**
* Gets the PrgElem attribute of the XDocletTagSupport class
@@ -699,10 +758,12 @@
* @todo-javadoc Write javadocs for method parameter
* @todo-javadoc Write javadocs for exception
*/
- private static XProgramElement getPrgElem(int for_type) throws
XDocletException {
+ private static XProgramElement getPrgElem( int for_type ) throws
XDocletException
+ {
XProgramElement prg_elem = null;
- switch (for_type) {
+ switch ( for_type )
+ {
case FOR_CLASS:
prg_elem = getCurrentClass();
break;
@@ -721,22 +782,6 @@
return prg_elem;
}
-
- /**
- * Replace properties in a string. Properties are in the form ${prop.name} and
- * the replace properties are obtained from the DocletContext.
- *
- * @param value The string to check for properties.
- * @return The value replaced with any property substitutions
- */
- private static String dereferenceProperties(String value) {
- // check to see if the property has a value.
- Map properties = DocletContext.getInstance().getProperties();
-
- return replaceProperties(value, properties);
- }
-
-
/**
* Throws an XDocletException exception to stop the build process. The
* exception has an informative message to help user find out the cause of the
@@ -750,37 +795,70 @@
* @exception XDocletException Description of Exception
* @todo-javadoc Write javadocs for method parameter
*/
- private static void invalidParamValueFound(XDoc doc, String param_name, String
tag_name, String value, String valid_values) throws XDocletException {
+ private static void invalidParamValueFound( XDoc doc, String param_name,
String tag_name, String value, String valid_values ) throws XDocletException
+ {
XProgramElement programElement = doc.getOwner();
- if (programElement instanceof XMethod) {
+ if( programElement instanceof XMethod )
+ {
XMethod method = (XMethod)programElement;
throw new
XDocletException(Translator.getString("invalid_tag_param_value_method",
new String[]{value, param_name, tag_name,
method.name(), method.containingClass().qualifiedName(), valid_values}));
}
- else if (programElement instanceof XClass) {
+ else if( programElement instanceof XClass )
+ {
XClass clazz = (XClass)programElement;
throw new
XDocletException(Translator.getString("invalid_tag_param_value_class",
new String[]{value, param_name, tag_name,
clazz.qualifiedName(), valid_values}));
}
- else if (programElement instanceof XConstructor) {
+ else if( programElement instanceof XConstructor )
+ {
XConstructor constructor = (XConstructor)programElement;
throw new
XDocletException(Translator.getString("invalid_tag_param_value_constructor",
new String[]{value, param_name, tag_name,
constructor.containingClass().qualifiedName(), valid_values}));
}
- else if (programElement instanceof XField) {
+ else if( programElement instanceof XField )
+ {
XField field = (XField)programElement;
throw new
XDocletException(Translator.getString("invalid_tag_param_value_field",
new String[]{value, param_name, tag_name,
field.name(), field.containingClass().qualifiedName(), valid_values}));
}
- else {
+ else
+ {
throw new
XDocletException(Translator.getString("bad_prgelemdoc_type",
new String[]{programElement.toString()}));
}
+ }
+
+ /**
+ * Describe what the method does
+ *
+ * @param for_type Describe what the parameter does
+ * @return Describe the return value
+ * @exception XDocletException Describe the exception
+ * @todo-javadoc Write javadocs for method
+ * @todo-javadoc Write javadocs for method parameter
+ * @todo-javadoc Write javadocs for return value
+ * @todo-javadoc Write javadocs for exception
+ */
+ protected String modifiers( int for_type ) throws XDocletException
+ {
+ return getPrgElem( for_type ).modifiers();
+ }
+
+ /**
+ * @param template_tag_name
+ * @param param_name
+ * @exception XDocletException
+ */
+ protected void mandatoryTemplateTagParamNotFound( String template_tag_name,
String param_name ) throws XDocletException
+ {
+ throw new XDocletException( Translator.getString(
"mandatory_tag_param_missing_template",
+ new String[]{param_name, template_tag_name} ) );
}
}
_______________________________________________
Xdoclet-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-devel