## xdoclet.modules.ejb.entity
Class PkTagsHandler

    java.lang.Object
      xdoclet.template.TemplateTagHandler
          xdoclet.XDocletTagSupport
              xdoclet.modules.ejb.EjbTagsHandler
                  xdoclet.modules.ejb.entity.PkTagsHandler

public class PkTagsHandler
extends EjbTagsHandler

Tags used in generating PK classes for entity EJBs.

Version:
  $Revision: 1.18 $
Author:
  Ara Abrahamian (ara_e@email.com)
xdoclet.taghandler
  namespace="EjbPk"
created
  13. juni 2002

Field Summary

Fields inherited from class xdoclet.modules.ejb.EjbTagsHandler
`ALL, LOCAL_SUFFIX, SERVICE_ENDPOINT, SERVICE_ENDPOINT_SUFFIX`

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

Constructor Summary
`PkTagsHandler()`

Method Summary
`static boolean` `classHasPrimkeyField(xjavadoc.XClass clazz)` Returns true if the specified class has a primkey-field defined on the ejb.bean tag (opposed to having a separate PK class).
`String` `extendsFrom()` Returns the name of the class pk class extends.
`protected String` `getDependentClassFor(xjavadoc.XClass clazz, String type)` Gets the DependentClassFor attribute of the PkTagsHandler object
`protected static String` `getEntityPkClassPattern()` Returns the pattern which is used to calculate the Primary Key class' name from the EJB name.
`static String` `getPkClassFor(xjavadoc.XClass clazz)` Get the primary key class specified for a given class.
`static String` `getPkClassForEjbJarXmlFor(xjavadoc.XClass clazz)` Gets the PkClassForEjbJarXmlFor attribute of the PkTagsHandler class
`static String` `getPrimkeyFieldFor(xjavadoc.XClass clazz)` Get the primary key field specified for a given class.
`static String` `getPrimkeyGetterFor(xjavadoc.XClass clazz)` Returns the getter method of the primary key field specified for a given class.
`static String` `getPrimkeySetterFor(xjavadoc.XClass clazz)` Returns the setter method of the primary key field specified for a given class.
`void` `ifDoesntHavePrimkeyField(String template, Properties attributes)` Process the tag body if the current class doesn't have a defined primkey-field.
`void` `ifHasPrimkeyField(String template, Properties attributes)` Process the tag body if the current class has a defined primkey-field.
`void` `ifHasPrimkeySetter(String template, Properties attributes)` Process the tag body if the current class has defined a setter for the primkey-field.
`void` `ifIsNotPrimkeyField(String template, Properties attributes)` Process the tag body if the current method is not a getter or setter for the primkey-field.
`void` `ifIsPkField(String template)` Evaluates the body if the current method is a primary key field.
`void` `ifIsPrimkeyField(String template, Properties attributes)` Process the tag body if the current method is a getter or setter for the primkey-field.
`static boolean` `isMethodPrimkeyField(xjavadoc.XClass clazz, xjavadoc.XMethod method)` Test if a given method is the getter or setter for the primary key field specified for the class.
`String` `pkClass()` Returns the name of generated PK class for the current class.
`String` `pkClassForEjbJarXml()` Returns the name of PK class for the current class.
`String` `pkfieldList()` Returns a string containing comma-separated list of primary key fields with their types.
`String` `pkfieldListFrom(Properties attributes)` Returns a string containing comma-separated list of primary key fields getting from an object specified as parameter.
`String` `primkeyField(Properties attributes)` Returns the primkey-field defined for the current class.
`String` `primkeyGetter(Properties attributes)` Returns the getter name for the primkey-field.
`String` `primkeySetter(Properties attributes)` Returns the setter name for the primkey-field.

Methods inherited from class xdoclet.modules.ejb.EjbTagsHandler

`beanType, choosePackage, concreteFullClassName, ejbExternalRefName, ejbName, ejbRefName, ejbRefName, extendsFromFor, forAllBeans, getDependentClassTagName, getEjb, getEjbIdFor, getEjbNameFor, getEjbSpec, getShortEjbNameFor, hasTransaction, id, ifIsAConcreteEJBean, ifLocalEjb, ifNotLocalEjb, ifNotRemoteEjb, ifNotServiceEndpointEjb, ifRemoteEjb, ifServiceEndpointEjb, isAConcreteEJBean, isEjb, isLocalEjb, isOnlyLocalEjb, isOnlyRemoteEjb, isOnlyServiceEndpointEjb, isRemoteEjb, isServiceEndpointEjb, prefixWithEjbSlash, shortEjbName, shouldTraverseSuperclassForDependentClass, symbolicClassName`

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`

Constructor Detail

### PkTagsHandler

    public PkTagsHandler()

Method Detail

### getPrimkeyFieldFor

    public static String getPrimkeyFieldFor(xjavadoc.XClass clazz)
                                     throws XDocletException

  Get the primary key field specified for a given class. This is given by the `primkey-field` parameter on the `ejb.bean` tag, although this may be inherited from a superclass.

  Parameters:
    `clazz` - The class to look into
  Returns:
    The value of the ejb.bean primkey-field parameter
  Throws:
    `XDocletException`

### isMethodPrimkeyField

    public static boolean isMethodPrimkeyField(xjavadoc.XClass clazz,
                                               xjavadoc.XMethod method)
                                        throws XDocletException

  Test if a given method is the getter or setter for the primary key field specified for the class.

  Parameters:
    `clazz` - The class to look into
    `method` - The method to check for primkey-field
  Returns:
    true if the method is a getter or setter for the primkey-field
  Throws:
    `XDocletException`
  See Also:
    `getPrimkeyFieldFor(XClass)`

### getPrimkeyGetterFor

    public static String getPrimkeyGetterFor(xjavadoc.XClass clazz)
                                      throws XDocletException

  Returns the getter method of the primary key field specified for a given class.

  Parameters:
    `clazz` - The class to look into
  Returns:
    The name of the ejb.bean primkey-field parameter's getter method, or null if there isn't one
  Throws:
    `XDocletException`
  See Also:
    `getPrimkeyFieldFor(XClass)`

### getPrimkeySetterFor

    public static String getPrimkeySetterFor(xjavadoc.XClass clazz)
                                      throws XDocletException

  Returns the setter method of the primary key field specified for a given class.

  Parameters:
    `clazz` - The class to look into
  Returns:
    The name of the ejb.bean primkey-field parameter's setter method, or null if there isn't one
  Throws:
    `XDocletException`
  See Also:
    `getPrimkeyFieldFor(XClass)`

### getPkClassFor

    public static String getPkClassFor(xjavadoc.XClass clazz)
                                throws XDocletException

  Get the primary key class specified for a given class. If a primary key field has been specified, using the `primkey-field` parameter on the `ejb.bean` tag, this will be the return type of that field's getter method. Otherwise, it will be determined by the various parameters of the `ejb.pk` tag and the subtask's settings for default pattern, packageSubstitution, etc.

  Parameters:
    `clazz` - The class to look into
  Returns:
    Fully qualified name of the primary key's type
  Throws:
    `XDocletException`

### getPkClassForEjbJarXmlFor

    public static String getPkClassForEjbJarXmlFor(xjavadoc.XClass clazz)
                                            throws XDocletException

  Gets the PkClassForEjbJarXmlFor attribute of the PkTagsHandler class

  Parameters:
    `clazz` - The class to look into
  Returns:
    The PkClassForEjbJarXmlFor value
  Throws:
    `XDocletException`

### classHasPrimkeyField

    public static boolean classHasPrimkeyField(xjavadoc.XClass clazz)
                                        throws XDocletException

  Returns true if the specified class has a primkey-field defined on the ejb.bean tag (opposed to having a separate PK class).

  Parameters:
    `clazz` - The class to look into.
  Returns:
    true if the class has a defined primkey-field
  Throws:
    `XDocletException`
  See Also:
    `getPrimkeyFieldFor(XClass)`

### getEntityPkClassPattern

    protected static String getEntityPkClassPattern()

  Returns the pattern which is used to calculate the Primary Key class' name from the EJB name. The default is to append "PK", unless overridden on the subtask.

  Returns:
    pattern

### ifHasPrimkeyField

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

  Process the tag body if the current class has a defined primkey-field.

  Parameters:
    `template` - The body of the block tag
    `attributes` - The attributes of the template tag
  Throws:
    `XDocletException`
  doc.tag
    type="block"

### ifIsPrimkeyField

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

  Process the tag body if the current method is a getter or setter for the primkey-field.

  Parameters:
    `template` - The body of the block tag
    `attributes` - The attributes of the template tag
  Throws:
    `XDocletException`
  doc.tag
    type="block"

### ifIsNotPrimkeyField

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

  Process the tag body if the current method is not a getter or setter for the primkey-field.

  Parameters:
    `template` - The body of the block tag
    `attributes` - The attributes of the template tag
  Throws:
    `XDocletException`
  doc.tag
    type="block"

### ifDoesntHavePrimkeyField

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

  Process the tag body if the current class doesn't have a defined primkey-field.

  Parameters:
    `template` - The body of the block tag
    `attributes` - The attributes of the template tag
  Throws:
    `XDocletException`
  doc.tag
    type="block"

### primkeyField

    public String primkeyField(Properties attributes)
                        throws XDocletException

  Returns the primkey-field defined for the current class.

  Parameters:
    `attributes` - The attributes of the template tag
  Returns:
    The value of the ejb.bean primkey-field parameter
  Throws:
    `XDocletException`
  See Also:
    `getPrimkeyFieldFor(XClass)`
  doc.tag
    type="content"

### primkeyGetter

    public String primkeyGetter(Properties attributes)
                         throws XDocletException

  Returns the getter name for the primkey-field.

  Parameters:
    `attributes` - The attributes of the template tag
  Returns:
    The primkey-field getter
  Throws:
    `XDocletException`
  See Also:
    `getPrimkeyGetterFor(XClass)`
  doc.tag
    type="content"

### primkeySetter

    public String primkeySetter(Properties attributes)
                         throws XDocletException

  Returns the setter name for the primkey-field.

  Parameters:
    `attributes` - The attributes of the template tag
  Returns:
    The primkey-field setter
  Throws:
    `XDocletException`
  See Also:
    `getPrimkeySetterFor(XClass)`
  doc.tag
    type="content"

### ifHasPrimkeySetter

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

  Process the tag body if the current class has defined a setter for the primkey-field.

  Parameters:
    `template` - The body of the block tag
    `attributes` - The attributes of the template tag
  Throws:
    `XDocletException`
  See Also:
    `getPrimkeySetterFor(XClass)`
  doc.tag
    type="block"

### pkClass

    public String pkClass()
                   throws XDocletException

  Returns the name of generated PK class for the current class.

  Returns:
    The name of generated PK class.
  Throws:
    `XDocletException`
  doc.tag
    type="content"

### pkClassForEjbJarXml

    public String pkClassForEjbJarXml()
                               throws XDocletException

  Returns the name of PK class for the current class.

  Returns:
    The name of generated PK class.
  Throws:
    `XDocletException`
  doc.tag
    type="content"

### pkfieldList

    public String pkfieldList()
                       throws XDocletException

  Returns a string containing comma-separated list of primary key fields with their types.

  Returns:
    A string containing comma-separated list of primary key fields with their types.
  Throws:
    `XDocletException`
  See Also:
    `PersistentTagsHandler.fieldList(XClass, String, String, int, String, boolean)`
  doc.tag
    type="content"

### pkfieldListFrom

    public String pkfieldListFrom(Properties attributes)
                           throws XDocletException

  Returns a string containing comma-separated list of primary key fields getting from an object specified as parameter.

  Parameters:
    `attributes` - The attributes of the template tag
  Returns:
    A string containing comma-separated list of primary key fields without their types.
  Throws:
    `XDocletException`
  See Also:
    `PersistentTagsHandler.fieldList(XClass, String, String, int, String, boolean)`
  doc.tag
    type="content"
  doc.param
    name="name" optional="false" description="The name of the variable to get the fields from."

### extendsFrom

    public String extendsFrom()
                       throws XDocletException

  Returns the name of the class pk class extends.

  Returns:
    superclass name
  Throws:
    `XDocletException`
  doc.tag
    type="content"

### ifIsPkField

    public void ifIsPkField(String template)
                     throws XDocletException

  Evaluates the body if the current method is a primary key field.

  Parameters:
    `template` - The body of the block tag
  Throws:
    `XDocletException`
  doc.tag
    type="block"

### getDependentClassFor

    protected String getDependentClassFor(xjavadoc.XClass clazz,
                                          String type)
                                   throws XDocletException

  Gets the DependentClassFor attribute of the PkTagsHandler object

  Overrides:
    `getDependentClassFor` in class `EjbTagsHandler`
  Parameters:
    `clazz` - Describe what the parameter does
    `type` - Describe what the parameter does
  Returns:
    The DependentClassFor value
  Throws:
    `XDocletException`

http://xdoclet.sourceforge.net/