<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html; charset=ISO-8859-1"
 http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
On 15.03.2010 13:46, Nilima R wrote:
<blockquote
 cite="mid:OFAAC8FFE0.1B358DE5-ON652576E7.0045FFFE-652576E7.0046312E@tcs.com"
 type="cite"><font face="sans-serif" size="2">Can someone tell me how
to use create
enums with Dynamic values in Guvnor.</font>
  <br>
  <font face="sans-serif" size="2">For example I need enum which does
not
contain static value like A,B,C rather these A,B,C values come from
database.</font>
  <br>
</blockquote>
<br>
Hi,<br>
<br>
if the set of allowable enum literals/values is altogether dynamic,
this probably cannot be achieved without dynamic bytecode generation
(i. e. generate the enum class at runtime). I'm not aware that Drools
supports this, you'd probably have to code this on your own.<br>
<br>
If your database contains a known set of enum values (like "A", "B",
"C"), you could create an enum with these values and perform string to
enum mapping using &lt;YourEnumClass&gt;.valueOf(nameOfLiteral).<br>
<br>
If both approaches don't fit your need, you can still stick with
ordinary strings.<br>
<br>
Most of the times I worked with "enums in a database", there actually
was a finite set of allowable values - sometimes it's hard to find out
all the values in this set, but should be doable. Otherwise an enum
seems kind of a mis-fit for the problem at hand, because an enum (short
for "enumeration") actually means the set of values can be enumerated.<br>
<br>
Ansgar<br>
<br>
<br>
</body>
</html>