User: dimc
Date: 02/03/11 05:42:48
Modified: core/src/xdoclet/tags TypeTagsHandler.java
Log:
Added support for primitive arrays in hashCode() calculation in dataobjects.
Revision Changes Path
1.12 +65 -1 xdoclet/core/src/xdoclet/tags/TypeTagsHandler.java
Index: TypeTagsHandler.java
===================================================================
RCS file: /cvsroot/xdoclet/xdoclet/core/src/xdoclet/tags/TypeTagsHandler.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -w -r1.11 -r1.12
--- TypeTagsHandler.java 7 Mar 2002 19:57:11 -0000 1.11
+++ TypeTagsHandler.java 11 Mar 2002 13:42:48 -0000 1.12
@@ -16,7 +16,7 @@
*
* @author Dmitri Colebatch ([EMAIL PROTECTED])
* @created October 12, 2001
- * @version $Revision: 1.11 $
+ * @version $Revision: 1.12 $
*/
public class TypeTagsHandler extends XDocletTagSupport
{
@@ -78,6 +78,20 @@
}
/**
+ * Returns true if name is a primitive type and is an array (ends with [])
+ *
+ * @param name The name of the type.
+ * @return The PrimitiveType value
+ * @see #isPrimitiveType
+ */
+ public static boolean isPrimitiveArray( String name )
+ {
+ return ( name.indexOf( '[' ) == name.length() - 2 ) &&
+ ( name.indexOf( ']' ) == name.length() - 1 ) &&
+ ( isPrimitiveType( name ) );
+ }
+
+ /**
* Returns true if cur_class is of type type. It searches for type in
* cur_class's hierarchy according to the value of extent parameter.
*
@@ -234,6 +248,56 @@
cat.debug( "value=" + value );
if( isPrimitiveType( value ) )
+ generate( template );
+ }
+
+ /**
+ * Evaluate the body block if the value is of a primitive array type.
+ *
+ * @param template The body of the block tag
+ * @param attributes The attributes of the template tag
+ * @exception XDocletException Description of Exception
+ * @see
#ifIsNotPrimitiveArray(java.lang.String,java.util.Properties)
+ * @see #isPrimitiveArray(java.lang.String)
+ * @doc:tag type="block"
+ * @doc:param name="value" optional="false" description="A
+ * string containsing the type name."
+ */
+ public void ifIsPrimitiveArray( String template, Properties attributes )
throws XDocletException
+ {
+ Category cat = Log.getCategory( TypeTagsHandler.class,
"ifIsPrimitiveArray" );
+
+ String value = attributes.getProperty( "value" );
+
+ if( cat.isDebugEnabled() )
+ cat.debug( "value=" + value );
+
+ if( isPrimitiveArray( value ) )
+ generate( template );
+ }
+
+ /**
+ * Evaluate the body block if the value is of a primitive array type.
+ *
+ * @param template The body of the block tag
+ * @param attributes The attributes of the template tag
+ * @exception XDocletException Description of Exception
+ * @see
#ifIsPrimitiveArray(java.lang.String,java.util.Properties)
+ * @see #isPrimitiveArray(java.lang.String)
+ * @doc:tag type="block"
+ * @doc:param name="value" optional="false" description="A
+ * string containsing the type name."
+ */
+ public void ifIsNotPrimitiveArray( String template, Properties attributes )
throws XDocletException
+ {
+ Category cat = Log.getCategory( TypeTagsHandler.class,
"ifIsNotPrimitiveArray" );
+
+ String value = attributes.getProperty( "value" );
+
+ if( cat.isDebugEnabled() )
+ cat.debug( "value=" + value );
+
+ if( !isPrimitiveArray( value ) )
generate( template );
}
_______________________________________________
Xdoclet-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-devel