## xdoclet.tagshandler
Class TypeTagsHandler

    java.lang.Object
      xdoclet.template.TemplateTagHandler
          xdoclet.XDocletTagSupport
              xdoclet.tagshandler.TypeTagsHandler

public class TypeTagsHandler
extends XDocletTagSupport

Simple tag support class.

Version:
  $Revision: 1.16 $
Author:
  Dmitri Colebatch (dim@bigpond.net.au)
xdoclet.taghandler
  namespace="Type"
created
  October 12, 2001

Field Summary
`static int` `TYPE_CONCRETE_TYPE` Used by `isOfType(xjavadoc.XClass, java.lang.String, int)`.
`static int` `TYPE_HIERARCHY` Used by `isOfType(xjavadoc.XClass, java.lang.String, int)`.
`static int` `TYPE_SUPERCLASS` Used by `isOfType(xjavadoc.XClass, java.lang.String, int)`.

Fields inherited from class xdoclet.XDocletTagSupport
`FOR_CLASS, FOR_CONSTRUCTOR, FOR_FIELD, FOR_METHOD, PARAMETER_DELIMITER`

Constructor Summary
`TypeTagsHandler()`

Method Summary
`static int` `extractExtentType(String extent_str)` Return the integer constant based on the extent_str.
`void` `ifIsNotOfType(String template, Properties attributes)` Evaluate the body block if the entity is not of the specified type.
`void` `ifIsNotPrimitive(String template, Properties attributes)` Evaluate the body block if the value is not of a primitive type.
`void` `ifIsNotPrimitiveArray(String template, Properties attributes)` Evaluate the body block if the value is not of a primitive array type.
`void` `ifIsNotPrimitiveOrString(String template, Properties attributes)` Evaluate the body block if the value is of a primitive type or String.
`protected void` `ifIsOfType_Impl(String template, Properties attributes, boolean condition)` Implementation of `ifIsOfType` and `ifIsNotOfType` tags.
`void` `ifIsOfType(String template, Properties attributes)` Evaluate the body block if the entity is of the specified type.
`void` `ifIsPrimitive(String template, Properties attributes)` Evaluate the body block if the value is of a primitive type.
`void` `ifIsPrimitiveArray(String template, Properties attributes)` Evaluate the body block if the value is of a primitive array type.
`void` `ifIsPrimitiveOrString(String template, Properties attributes)` Evaluate the body block if the value is of a primitive type or String.
`static boolean` `isOfType(xjavadoc.XClass clazz, String type, int extent)` Returns true if cur_class is of type type.
`static boolean` `isPrimitiveArray(String name)` Returns true if name is a primitive type and is an array (ends with [])
`static boolean` `isPrimitiveType(String name)` Returns true if name is a primitive type, in that case name contains the string "int"/"float"/etc.
`String` `typeWithoutDimensions(Properties attributes)` Returns the type specified with the `type` parameter without dimensions.

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`

Field Detail

### TYPE_CONCRETE_TYPE

    public static final int TYPE_CONCRETE_TYPE

  Used by `isOfType(xjavadoc.XClass, java.lang.String, int)`. The isOfType method searches for the type according to the type parameter. `TYPE_CONCRETE_TYPE` specifies that only the type of the current entity (class, method return type, parameter type depending on the context) should be checked for equality.

  See Also:
    Constant Field Values

### TYPE_SUPERCLASS

    public static final int TYPE_SUPERCLASS

  Used by `isOfType(xjavadoc.XClass, java.lang.String, int)`. The isOfType method searches for the type according to the type parameter. `TYPE_SUPERCLASS` specifies that not only the type of the current entity (class, method return type, parameter type depending on the context) should be checked for equality, but also direct superclasses and interfaces of the entity.

  See Also:
    Constant Field Values

### TYPE_HIERARCHY

    public static final int TYPE_HIERARCHY

  Used by `isOfType(xjavadoc.XClass, java.lang.String, int)`. The isOfType method searches for the type according to the type parameter. `TYPE_HIERARCHY` specifies that not only the type of the current entity (class, method return type, parameter type depending on the context) should be checked for equality, but also superclasses and interfaces of the entity and recursively superclasses and interfaces.

  See Also:
    Constant Field Values

Constructor Detail

### TypeTagsHandler

    public TypeTagsHandler()

Method Detail

### isPrimitiveType

    public static boolean isPrimitiveType(String name)

  Returns true if name is a primitive type, in that case name contains the string "int"/"float"/etc.

  Parameters:
    `name` - The passed type to check
  Returns:
    true if this is a primitive type

### isPrimitiveArray

    public static boolean isPrimitiveArray(String name)

  Returns true if name is a primitive type and is an array (ends with [])

  Parameters:
    `name` - The name of the type.
  Returns:
    true if name is an array of a primitive type.
  See Also:
    `isPrimitiveType(java.lang.String)`

### isOfType

    public static boolean isOfType(xjavadoc.XClass clazz,
                                   String type,
                                   int extent)

  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.

  Parameters:
    `type` - The reference type
    `clazz` - The passed class to compare to the reference type
    `extent` - One of TypeTagsHandler.TYPE_*
  Returns:
    True if there is a match.
  See Also:
    `TYPE_HIERARCHY`, `TYPE_CONCRETE_TYPE`, `TYPE_SUPERCLASS`
  To do:
    move this to xjavadoc

### extractExtentType

    public static int extractExtentType(String extent_str)

  Return the integer constant based on the extent_str. Used by forAllClasses and ifIsOfType_Impl. If the string doesn't have one of the expected values TYPE_HIERARCHY is returned.

  Parameters:
    `extent_str` - Description of Parameter
  Returns:
    Description of the Returned Value
  See Also:
    `ClassTagsHandler.forAllClasses(java.lang.String,java.util.Properties)`, `ifIsOfType_Impl(java.lang.String,java.util.Properties,boolean)`, `TYPE_HIERARCHY`, `TYPE_CONCRETE_TYPE`, `TYPE_SUPERCLASS`

### ifIsPrimitive

    public void ifIsPrimitive(String template,
                              Properties attributes)
                       throws XDocletException

  Evaluate the body block if the value is of a primitive type.

  Parameters:
    `template` - The body of the block tag
    `attributes` - The attributes of the template tag
  Throws:
    `XDocletException` - Description of Exception
  See Also:
    `ifIsNotPrimitive(java.lang.String,java.util.Properties)`, `isPrimitiveType(java.lang.String)`
  doc.tag
    type="block"
  doc.param
    name="value" optional="false" description="A string containsing the type name."

### ifIsPrimitiveArray

    public void ifIsPrimitiveArray(String template,
                                   Properties attributes)
                            throws XDocletException

  Evaluate the body block if the value is of a primitive array type.

  Parameters:
    `template` - The body of the block tag
    `attributes` - The attributes of the template tag
  Throws:
    `XDocletException` - Description of Exception
  See Also:
    `ifIsNotPrimitiveArray(java.lang.String,java.util.Properties)`, `isPrimitiveArray(java.lang.String)`
  doc.tag
    type="block"
  doc.param
    name="value" optional="false" description="A string containsing the type name."

### ifIsNotPrimitiveArray

    public void ifIsNotPrimitiveArray(String template,
                                      Properties attributes)
                               throws XDocletException

  Evaluate the body block if the value is not of a primitive array type.

  Parameters:
    `template` - The body of the block tag
    `attributes` - The attributes of the template tag
  Throws:
    `XDocletException` - Description of Exception
  See Also:
    `ifIsPrimitiveArray(java.lang.String,java.util.Properties)`, `isPrimitiveArray(java.lang.String)`
  doc.tag
    type="block"
  doc.param
    name="value" optional="false" description="A string containsing the type name."

### ifIsPrimitiveOrString

    public void ifIsPrimitiveOrString(String template,
                                      Properties attributes)
                               throws XDocletException

  Evaluate the body block if the value is of a primitive type or String.

  Parameters:
    `template` - The body of the block tag
    `attributes` - The attributes of the template tag
  Throws:
    `XDocletException` - Description of Exception
  See Also:
    `ifIsNotPrimitive(java.lang.String,java.util.Properties)`, `isPrimitiveType(java.lang.String)`
  doc.tag
    type="block"
  doc.param
    name="value" optional="false" description="A string containsing the type name."

### ifIsNotPrimitiveOrString

    public void ifIsNotPrimitiveOrString(String template,
                                         Properties attributes)
                                  throws XDocletException

  Evaluate the body block if the value is of a primitive type or String.

  Parameters:
    `template` - The body of the block tag
    `attributes` - The attributes of the template tag
  Throws:
    `XDocletException` - Description of Exception
  See Also:
    `ifIsNotPrimitive(java.lang.String,java.util.Properties)`, `isPrimitiveType(java.lang.String)`
  doc.tag
    type="block"
  doc.param
    name="value" optional="false" description="A string containsing the type name."

### ifIsNotPrimitive

    public void ifIsNotPrimitive(String template,
                                 Properties attributes)
                          throws XDocletException

  Evaluate the body block if the value is not of a primitive type.

  Parameters:
    `template` - The body of the block tag
    `attributes` - The attributes of the template tag
  Throws:
    `XDocletException` - If the evaluation of the body block fails.
  See Also:
    `ifIsPrimitive(java.lang.String,java.util.Properties)`, `isPrimitiveType(java.lang.String)`
  doc.tag
    type="block"
  doc.param
    name="value" optional="false" description="A string containsing the type name."

### ifIsNotOfType

    public void ifIsNotOfType(String template,
                              Properties attributes)
                       throws XDocletException

  Evaluate the body block if the entity is not of the specified type.

  Parameters:
    `template` - The body of the block tag
    `attributes` - The attributes of the template tag
  Throws:
    `XDocletException` - Description of Exception
  See Also:
    `ifIsOfType(java.lang.String,java.util.Properties)`
  doc.tag
    type="block"
  doc.param
    name="value" optional="false" values="class,return-type" description="If class then check current class's type, if return-type then check current method return type, if property-type and the current method is a getter or setter then check current method's property type. Default is class.", name="type" optional="false" description="The type we are checking against.", 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."

### ifIsOfType

    public void ifIsOfType(String template,
                           Properties attributes)
                    throws XDocletException

  Evaluate the body block if the entity is of the specified type.

  Parameters:
    `template` - The body of the block tag
    `attributes` - The attributes of the template tag
  Throws:
    `XDocletException` - Description of Exception
  See Also:
    `ifIsNotOfType(java.lang.String,java.util.Properties)`
  doc.tag
    type="block"
  doc.param
    name="value" optional="true" values="class,return-type,property-type" description="If class then check current class's type, if return-type then check current method return type, if property-type and the current method is a getter or setter then check current method's property type. Default is class.", name="type" optional="false" description="The type we are checking against.", 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."

### typeWithoutDimensions

    public String typeWithoutDimensions(Properties attributes)
                                 throws XDocletException

  Returns the type specified with the `type` parameter without dimensions.

  Parameters:
    `attributes` -
  Returns:
  Throws:
    `XDocletException`
  doc.tag
    type="content"
  doc.param
    name="type" optional="false" description="Specifies the type to return without dimensions. So, the value `String[][]` will be returned as `String`."

### ifIsOfType_Impl

    protected void ifIsOfType_Impl(String template,
                                   Properties attributes,
                                   boolean condition)
                            throws XDocletException

  Implementation of `ifIsOfType` and `ifIsNotOfType` tags.

  Parameters:
    `template` - The body of the block tag
    `attributes` - The attributes of the template tag
    `condition` - Whether to look for a match (true) or non-match (false)
  Throws:
    `XDocletException` - Description of Exception
  See Also:
    `ifIsOfType(java.lang.String,java.util.Properties)`, `ifIsNotOfType(java.lang.String,java.util.Properties)`

http://xdoclet.sourceforge.net/