User: rinkrank
Date: 02/04/21 15:18:53
Modified: core/src/xdoclet XDocletTagSupport.java
Log:
-quickfix for vincent's latest patch which broke delim and defaultvalue.
vincent, I've commented out your stuff. can you take a look?
Revision Changes Path
1.42 +114 -76 xdoclet/core/src/xdoclet/XDocletTagSupport.java
Index: XDocletTagSupport.java
===================================================================
RCS file: /cvsroot/xdoclet/xdoclet/core/src/xdoclet/XDocletTagSupport.java,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -w -r1.41 -r1.42
--- XDocletTagSupport.java 21 Apr 2002 20:40:14 -0000 1.41
+++ XDocletTagSupport.java 21 Apr 2002 22:18:52 -0000 1.42
@@ -39,7 +39,7 @@
*
* @author Dmitri Colebatch ([EMAIL PROTECTED])
* @created October 12, 2001
- * @version $Revision: 1.41 $
+ * @version $Revision: 1.42 $
*/
public abstract class XDocletTagSupport extends TemplateTagHandler
{
@@ -419,17 +419,48 @@
if( for_type == FOR_METHOD && getCurrentMethodTag() != null &&
getCurrentMethodTag().name().equals( tag_name ) && Arrays.asList(
getCurrentMethodTag().attributeValueNames() ).contains( param_name ) )
{
- tagValue = getCurrentMethodTag().attributeValue( param_name );
+ //COMMENTED OUT (ASLAK). BREAKS DEFAULTVALUE. tagValue =
getCurrentMethodTag().attributeValue( param_name );
+ XTag tag = getCurrentMethodTag();
+
+ tagValue = getTagValue(
+ getCurrentMethod().doc(),
+ tag,
+ param_name,
+ valid_values,
+ default_value,
+ is_mandatory
+ );
}
else if( for_type == FOR_METHOD && getCurrentMethodTag() != null &&
getCurrentMethodTag().name().equals( tag_name ) && ( param_name == null || param_num
== null ) )
{
// somebody is just interested in tag contens.
// return whole
- return getCurrentMethodTag().value();
+ //COMMENTED OUT (ASLAK). BREAKS DEFAULTVALUE. return
getCurrentMethodTag().value();
+ XTag tag = getCurrentMethodTag();
+
+ tagValue = getTagValue(
+ getCurrentMethod().doc(),
+ tag,
+ param_name,
+ valid_values,
+ default_value,
+ is_mandatory
+ );
+
}
else if( for_type == FOR_CLASS && getCurrentClassTag() != null )
{
- tagValue = getCurrentClassTag().attributeValue( param_name );
+ //COMMENTED OUT (ASLAK). BREAKS DEFAULTVALUE. tagValue =
getCurrentClassTag().attributeValue( param_name );
+ XTag tag = getCurrentClassTag();
+
+ tagValue = getTagValue(
+ getCurrentClass().doc(),
+ tag,
+ param_name,
+ valid_values,
+ default_value,
+ is_mandatory
+ );
}
else
{
@@ -568,14 +599,35 @@
);
}
+ protected static String getTagValue(
+ XDoc doc,
+ String tag_name,
+ String param_name,
+ String valid_values,
+ String default_value,
+ boolean superclasses,
+ boolean is_mandatory
+ ) throws XDocletException
+ {
+ XTag tag = doc.tag( tag_name, superclasses );
+
+ return getTagValue(
+ doc,
+ tag,
+ param_name,
+ valid_values,
+ default_value,
+ is_mandatory
+ );
+ }
+
/**
- * @param doc Describe what the parameter does
- * @param tag_name Describe what the parameter does
* @param param_name Describe what the parameter does
* @param valid_values Describe what the parameter does
* @param default_value Describe what the parameter does
- * @param superclasses Describe what the parameter does
* @param is_mandatory Describe what the parameter does
+ * @param tag
+ * @param tagOwnerDoc
* @return The TagValue value
* @exception XDocletException Describe the exception
* @todo (Aslak) maybe this method ought to be moved to
@@ -590,17 +642,15 @@
* @todo-javadoc Write javadocs for exception
*/
protected static String getTagValue(
- XDoc doc,
- String tag_name,
+ // passed to method only for the sake of proper error reporting
+ XDoc tagOwnerDoc,
+ XTag tag,
String param_name,
String valid_values,
String default_value,
- boolean superclasses,
boolean is_mandatory
) throws XDocletException
{
- XTag tag = doc.tag( tag_name, superclasses );
-
String value = null;
// check if we have a tag at all
@@ -622,8 +672,7 @@
// nothing found in javadocs
if( is_mandatory )
{
- // throws XDocletException
- mandatoryParamNotFound( doc, param_name, tag_name );
+ mandatoryParamNotFound( tagOwnerDoc, param_name,
tag.name() );
}
if( default_value != null )
{
@@ -649,7 +698,7 @@
return value;
}
}
- invalidParamValueFound( doc, param_name, tag_name,
value, valid_values );
+ invalidParamValueFound( tagOwnerDoc, param_name,
tag.name(), value, valid_values );
}
}
return value;
@@ -702,56 +751,6 @@
}
/**
- * Throws an XDocletException exception to stop the build process. The
- * exception has an informative message to help user find out the cause of the
- * error (not specifying a mandatory parameter for a tag).
- *
- * @param param_name Description of Parameter
- * @param tag_name Description of Parameter
- * @param doc Describe what the parameter does
- * @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
- {
- XProgramElement programElement = doc.getOwner();
-
- 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 )
- {
- 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 )
- {
- 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 )
- {
- 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
- {
- 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
* with the specified name.
@@ -867,6 +866,56 @@
/**
* Throws an XDocletException exception to stop the build process. The
* exception has an informative message to help user find out the cause of the
+ * error (not specifying a mandatory parameter for a tag).
+ *
+ * @param param_name Description of Parameter
+ * @param tag_name Description of Parameter
+ * @param doc Describe what the parameter does
+ * @exception XDocletException Description of Exception
+ * @todo-javadoc Write javadocs for method parameter
+ */
+ private static void mandatoryParamNotFound( XDoc doc, String param_name,
String tag_name ) throws XDocletException
+ {
+ XProgramElement programElement = doc.getOwner();
+
+ 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 )
+ {
+ 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 )
+ {
+ 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 )
+ {
+ 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
+ {
+ throw new XDocletException( Translator.getString(
"bad_prgelemdoc_type",
+ new String[]{programElement.toString()} ) );
+ }
+ }
+
+ /**
+ * Throws an XDocletException exception to stop the build process. The
+ * exception has an informative message to help user find out the cause of the
* error (specifying an incorrect value for a parameter of a tag).
*
* @param param_name Description of Parameter
@@ -930,17 +979,6 @@
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