org.sandev.generator.tags
Class FieldTagDecimalize

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

public class FieldTagDecimalize
extends AbstractSandFieldTag

Handle @sand.decimalize declarations.

Declares this field should be converted to a decimal representation for display purposes, while being stored as the declared integer representation. The value is divided by 10 to the number of decimal places specified, and displayed as a floating point number. When read from an input form, the value is multiplied by 10 to the number of decimal places specified.

This tag allows for integer arithmetic with the specified degree of precision, which is useful for things like monetary implementations.

Note that locale does not come into play at the level of a struct declaration. Locale transformation is done as part of the display processing. You do not want your raw data being formatted for a locale, nor do you want it polluted with extraneous currency or percentage symbols, which is why this field tag exists.

parameters:

  1. the number of decimal places for display conversion
  2. comment (optional)


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 decimals
          The number of decimal places
protected  java.lang.String fieldName
          The name of the field which will be accessed in decimalized form.
protected  java.lang.String fieldType
          The type of the field which will be accessed in decimalized form.
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
FieldTagDecimalize()
           
 
Method Summary
static boolean exists(com.sun.javadoc.FieldDoc fd)
          Returns true if the given field contains this tag, false otherwise.
 java.lang.String getComment()
          accessor for comment
 java.lang.String getDecimals()
          accessor for decimals
 java.lang.String getFieldName()
          accessor for fieldName
static FieldTagDecimalize getFieldTagDecimalize(com.sun.javadoc.FieldDoc fd)
          Factory method for retrieving a new instance given a FieldDoc.
 java.lang.String getFieldType()
          accessor for fieldType
 java.lang.String getName()
          Return our tag name
 int getNumDecimals()
          Return the number of decimals as an integer.
 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 setDecimals(java.lang.String val)
          mutator for decimals
 void setFieldName(java.lang.String val)
          mutator for fieldName
 void setFieldType(java.lang.String val)
          mutator for fieldType
 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 the documentation text for when several of these tags are present
 
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

decimals

protected java.lang.String decimals
The number of decimal places


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 will be accessed in decimalized form. 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.


fieldType

protected java.lang.String fieldType
The type of the field which will be accessed in decimalized form. Available only when the fieldName is 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

FieldTagDecimalize

public FieldTagDecimalize()
Method Detail

getDecimals

public java.lang.String getDecimals()
accessor for decimals


setDecimals

public void setDecimals(java.lang.String val)
mutator for decimals


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


getFieldType

public java.lang.String getFieldType()
accessor for fieldType


setFieldType

public void setFieldType(java.lang.String val)
mutator for fieldType


init

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


getNumDecimals

public int getNumDecimals()
Return the number of decimals as an integer. Note that the number of decimals can be defined as the value of another constant, at which point this method will only work if that constant is known at build time. Typically only system constants are known at build time, so use this method 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.

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 the documentation text for when several of these tags are present

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.

getFieldTagDecimalize

public static FieldTagDecimalize getFieldTagDecimalize(com.sun.javadoc.FieldDoc fd)
Factory method for retrieving a new instance given a FieldDoc. Returns an initialized instance if the tag was found, null otherwise.


exists

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