org.sandev.generator.tags
Class FieldTagEnumint

java.lang.Object
  extended byorg.sandev.generator.tags.AbstractSandBaseTag
      extended byorg.sandev.generator.tags.AbstractSandFieldTag
          extended byorg.sandev.generator.tags.FieldTagEnumint
All Implemented Interfaces:
com.sun.tools.doclets.Taglet

public class FieldTagEnumint
extends AbstractSandFieldTag

Handle @sand.enumint declarations.

Declares an enumerated type value for this field. Can be used one or more times to declare enumerated values as integer constants. For example:

or alternatively:

parameters:

  1. the enumerated constant base name
  2. the integer value for the constant
  3. the default display value string (optional)
  4. comment (optional)
The optional display value can be used directly when mapping a message to a UI form, or can be used as a lookup key for localization.

The actual runtime constant name for the enumint value is the field name (all caps), followed by an underscore, followed by the specified constant base name. So for example, constant values for the sample above might be:

This avoids conflicts within the class, while keeping field values somewhat readable for context localized operations. We expect to migrate this forward to use the enum extensions being added to the java language in the future.


Field Summary
protected  java.lang.String comment
          Any comment text that was specified for this tag declaration
static java.lang.String CORENAME
          The core name of this tag.
protected  java.lang.String displayText
          The optional display text for this enumerated value.
protected  java.lang.String enumConstant
          The enumerated constant base name.
protected  java.lang.String enumValStr
          The integer value for this enumerated value constant, in its originally declared String form.
protected  java.lang.String fieldName
          The name of the field which had this enumint associated with it.
static java.lang.String TAGNAME
          Our fixed name, used for hash lookup and text parsing.
 
Fields inherited from class org.sandev.generator.tags.AbstractSandBaseTag
PREFIX
 
Constructor Summary
FieldTagEnumint()
           
 
Method Summary
static boolean exists(com.sun.javadoc.FieldDoc fd)
          Returns true if the given field contains this tag, false otherwise.
 java.lang.String getCodeConstant()
          Return the code constant
 java.lang.String getComment()
          accessor for comment
 java.lang.String getDisplayText()
          accessor for displayText
 java.lang.String getEnumConstant()
          accessor for enumConstant
 int getEnumVal()
          Return the enumeration value as an integer.
 java.lang.String getEnumValStr()
          accessor for enumValStr
 java.lang.String getFieldName()
          accessor for fieldName
static FieldTagEnumint[] getFieldTagEnumints(com.sun.javadoc.FieldDoc fd)
          Factory method to return the FieldTagEnumint elements of a field.
 java.lang.String getName()
          Return our tag name
 void init(com.sun.javadoc.Tag tag)
          Initialize this instance from the tag information.
static void register(java.util.Map tagletMap)
          Registers this taglet when triggered by the taglet declaration being loaded in as part of the build.
 void setComment(java.lang.String text)
          mutator for comment
 void setDisplayText(java.lang.String val)
          mutator for displayText
 void setEnumConstant(java.lang.String val)
          mutator for enumConstant
 void setEnumValStr(java.lang.String val)
          mutator for enumValStr
 void setFieldName(java.lang.String val)
          mutator for fieldName
 java.lang.String toString(com.sun.javadoc.Tag tag)
          Return a documentation description of this tag.
 java.lang.String toString(com.sun.javadoc.Tag[] tags)
          Return a documentation description of these tags.
 
Methods inherited from class org.sandev.generator.tags.AbstractSandFieldTag
inField
 
Methods inherited from class org.sandev.generator.tags.AbstractSandBaseTag
inConstructor, inMethod, inOverview, inPackage, inType, isInlineTag, registerHelper
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CORENAME

public static final java.lang.String CORENAME
The core name of this tag.

See Also:
Constant Field Values

enumConstant

protected java.lang.String enumConstant
The enumerated constant base name.


enumValStr

protected java.lang.String enumValStr
The integer value for this enumerated value constant, in its originally declared String form.


displayText

protected java.lang.String displayText
The optional display text for this enumerated value.


comment

protected java.lang.String comment
Any comment text that was specified for this tag declaration


fieldName

protected java.lang.String fieldName
The name of the field which had this enumint associated with it. Note that field information is only available when this instance had access to the FieldDoc. If you initialize an instance of this class from only the tags (such as in a taglet), then this information is not available.


TAGNAME

public static final java.lang.String TAGNAME
Our fixed name, used for hash lookup and text parsing.

See Also:
Constant Field Values
Constructor Detail

FieldTagEnumint

public FieldTagEnumint()
Method Detail

getEnumConstant

public java.lang.String getEnumConstant()
accessor for enumConstant


setEnumConstant

public void setEnumConstant(java.lang.String val)
mutator for enumConstant


getEnumValStr

public java.lang.String getEnumValStr()
accessor for enumValStr


setEnumValStr

public void setEnumValStr(java.lang.String val)
mutator for enumValStr


getDisplayText

public java.lang.String getDisplayText()
accessor for displayText


setDisplayText

public void setDisplayText(java.lang.String val)
mutator for displayText


getComment

public java.lang.String getComment()
accessor for comment


setComment

public void setComment(java.lang.String text)
mutator for comment


getFieldName

public java.lang.String getFieldName()
accessor for fieldName


setFieldName

public void setFieldName(java.lang.String val)
mutator for fieldName


init

public void init(com.sun.javadoc.Tag tag)
Initialize this instance from the tag information.


getCodeConstant

public java.lang.String getCodeConstant()
Return the code constant


getEnumVal

public int getEnumVal()
Return the enumeration value as an integer. Note that an enumerated constant can be initialized to the value of another enumerated constant, at which point this method will only work if that constant is known (so system constants work, other declared field constants usually don't). Use with caution.


getName

public java.lang.String getName()
Return our tag name


register

public static void register(java.util.Map tagletMap)
Registers this taglet when triggered by the taglet declaration being loaded in as part of the build.


toString

public java.lang.String toString(com.sun.javadoc.Tag tag)
Return a documentation description of this tag. Passthrough to toString(Tag[] tags) for consistent processing. We always want a listing, even with only one tag present.

Specified by:
toString in interface com.sun.tools.doclets.Taglet
Specified by:
toString in class AbstractSandBaseTag
Parameters:
tag - the Tag representation of this custom tag.

toString

public java.lang.String toString(com.sun.javadoc.Tag[] tags)
Return a documentation description of these tags. We essentially just init ourselves with each tag description and then dump out some descriptive text.

Specified by:
toString in interface com.sun.tools.doclets.Taglet
Specified by:
toString in class AbstractSandBaseTag
Parameters:
tags - the array of Tags representing of this custom tag.

getFieldTagEnumints

public static FieldTagEnumint[] getFieldTagEnumints(com.sun.javadoc.FieldDoc fd)
Factory method to return the FieldTagEnumint elements of a field. Returns an empty array if no elements were found.


exists

public static boolean exists(com.sun.javadoc.FieldDoc fd)
Returns true if the given field contains this tag, false otherwise.