On Fri, Feb 20, 2009 at 8:56 AM, Asiri Rathnayake <
asiri.rathnayake(a)gmail.com> wrote:
Hi Vincent,
Can we use an Enum type instead?
Yep, sounds good.
On second thoughts, I don't see a benefit of using an Enum type because we
cannot substitute an Enum type where a String is required. For an example,
we would have something like below:
<code>
public enum HTMLTag
{
B("b"), STRONG("strong");
private final String name;
HTMLTag(String name)
{
this.name = name;
}
public String toString()
{
return this.name;
}
}
</code>
And then where HTML tag names are used, we will have to use:
<code>
TagTransformation tt = new TagTransformation(HTMLTag.B.toString(),
HTMLTag.STRONG.toString(), false);
</code>
But I think the following (what we have now) is much more readable:
<code>
TagTransformation tt = new TagTransformation(HTMLConstants.B,
HTMLConstants.STRONG, false);
</code>
WDYT?
- Asiri